aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-08-11 17:10:00 +0200
committerAndreas Schneider <mail@cynapses.org>2009-08-11 17:10:00 +0200
commit9b13390ad08c84946386ae395870938daf89b116 (patch)
tree77db50d5b7bd5b5751e553378827082e5be228ef
parent81fe4299f7a6d36fbebd7c71dfb8f7c8d7ff501b (diff)
downloadlibssh-9b13390ad08c84946386ae395870938daf89b116.tar.gz
libssh-9b13390ad08c84946386ae395870938daf89b116.tar.xz
libssh-9b13390ad08c84946386ae395870938daf89b116.zip
Use gcc visibility attribute to get rid of the map file.
-rw-r--r--ConfigureChecks.cmake2
-rw-r--r--include/libssh/libssh.h54
-rw-r--r--libssh/CMakeLists.txt22
-rw-r--r--libssh/libssh.map215
4 files changed, 45 insertions, 248 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 679dea7..482ce65 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -16,6 +16,8 @@ set(SYSCONFDIR ${SYSCONF_INSTALL_DIR})
set(BINARYDIR ${CMAKE_BINARY_DIR})
set(SOURCEDIR ${CMAKE_SOURCE_DIR})
+check_c_compiler_flag("-fvisibility=hidden" WITH_VISIBILITY_HIDDEN)
+
# HEADER FILES
check_include_file(pty.h HAVE_PTY_H)
check_include_file(terminos.h HAVE_TERMIOS_H)
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h
index 6689bea..9a6b9f8 100644
--- a/include/libssh/libssh.h
+++ b/include/libssh/libssh.h
@@ -22,30 +22,44 @@
#ifndef _LIBSSH_H
#define _LIBSSH_H
-#ifndef _MSC_VER
-#include <unistd.h>
-#include <inttypes.h>
+#if defined _WIN32 || defined __CYGWIN__
+ #ifdef SSH_EXPORTS
+ #ifdef __GNUC__
+ #define LIBSSH_API __attribute__((dllexport))
+ #else
+ #define LIBSSH_API __declspec(dllexport)
+ #endif
+ #else
+ #ifdef __GNUC__
+ #define LIBSSH_API __attribute__((dllimport))
+ #else
+ #define LIBSSH_API __declspec(dllimport)
+ #endif
+ #endif
+#else
+ #if __GNUC__ >= 4
+ #define LIBSSH_API __attribute__((visibility("default")))
+ #else
+ #define LIBSSH_API
+ #endif
+#endif
+
+#ifdef _MSC_VER
+ /* Visual Studio hasn't inttypes.h so it doesn't know uint32_t */
+ typedef unsigned int uint32_t;
+ typedef unsigned short uint16_t;
+ typedef unsigned char uint8_t;
+ typedef unsigned long long uint64_t;
#else /* _MSC_VER */
-//visual studio hasn't inttypes.h so it doesn't know uint32_t
-typedef unsigned int uint32_t;
-typedef unsigned short uint16_t;
-typedef unsigned char uint8_t;
-typedef unsigned long long uint64_t;
+ #include <unistd.h>
+ #include <inttypes.h>
#endif /* _MSC_VER */
#ifdef _WIN32
-#include <winsock2.h>
-
-/* export functions */
-# ifdef SSH_EXPORTS
-# define LIBSSH_API __declspec(dllexport)
-# else
-# define LIBSSH_API __declspec(dllimport)
-# endif
-#else
-# include <sys/select.h> /* for fd_set * */
-# include <netdb.h>
-# define LIBSSH_API
+ #include <winsock2.h>
+#else /* _WIN32 */
+ #include <sys/select.h> /* for fd_set * */
+ #include <netdb.h>
#endif /* _WIN32 */
#define SSH_STRINGIFY(s) SSH_TOSTRING(s)
diff --git a/libssh/CMakeLists.txt b/libssh/CMakeLists.txt
index edf0c58..631df40 100644
--- a/libssh/CMakeLists.txt
+++ b/libssh/CMakeLists.txt
@@ -73,6 +73,9 @@ if (GCRYPT_LIBRARY)
)
endif (GCRYPT_LIBRARY)
+if (WITH_VISIBILITY_HIDDEN)
+ set(LIBSSH_SHARED_CFLAGS "-fvisibility=hidden")
+endif (WITH_VISIBILITY_HIDDEN)
set(libssh_SRCS
agent.c
@@ -154,19 +157,14 @@ set_target_properties(
${LIBRARY_SOVERSION}
OUTPUT_NAME
ssh
+ CLEAN_DIRECT_OUTPUT
+ 1
DEFINE_SYMBOL
SSH_EXPORTS
+ COMPILE_FLAGS
+ ${LIBSSH_SHARED_CFLAGS}
)
-if (UNIX AND CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
- set_target_properties(
- ${LIBSSH_SHARED_LIBRARY}
- PROPERTIES
- LINK_FLAGS
- -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libssh.map
-)
-endif (UNIX AND CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
-
install(
TARGETS
${LIBSSH_SHARED_LIBRARY}
@@ -179,8 +177,6 @@ install(
if (WITH_STATIC_LIB)
add_library(${LIBSSH_STATIC_LIBRARY} STATIC ${libssh_SRCS})
- target_link_libraries(${LIBSSH_STATIC_LIBRARY} ${LIBSSH_LINK_LIBRARIES})
-
set_target_properties(
${LIBSSH_STATIC_LIBRARY}
PROPERTIES
@@ -190,8 +186,8 @@ if (WITH_STATIC_LIB)
${LIBRARY_SOVERSION}
OUTPUT_NAME
ssh
- DEFINE_SYMBOL
- SSH_EXPORTS
+ CLEAN_DIRECT_OUTPUT
+ 1
)
install(
diff --git a/libssh/libssh.map b/libssh/libssh.map
deleted file mode 100644
index 26e2fb1..0000000
--- a/libssh/libssh.map
+++ /dev/null
@@ -1,215 +0,0 @@
-SSH_0.3 {
- global:
- buffer_free;
- buffer_get;
- buffer_get_len;
- buffer_new;
- channel_change_pty_size;
- channel_close;
- channel_free;
- channel_get_exit_status;
- channel_get_session;
- channel_is_closed;
- channel_is_eof;
- channel_is_open;
- channel_new;
- channel_open_forward;
- channel_open_session;
- channel_poll;
- channel_read;
- channel_read_buffer;
- channel_read_nonblocking;
- channel_request_env;
- channel_request_exec;
- channel_request_pty;
- channel_request_pty_size;
- channel_request_sftp;
- channel_request_shell;
- channel_request_subsystem;
- channel_select;
- channel_send_eof;
- channel_set_blocking;
- channel_write;
- privatekey_free;
- privatekey_from_file;
- publickey_free;
- publickey_from_file;
- publickey_from_privatekey;
- publickey_to_string;
- sftp_async_read;
- sftp_async_read_begin;
- sftp_attributes_free;
- sftp_canonicalize_path;
- sftp_chmod;
- sftp_chown;
- sftp_close;
- sftp_closedir;
- sftp_dir_eof;
- sftp_file_set_blocking;
- sftp_file_set_nonblocking;
- sftp_free;
- sftp_fstat;
- sftp_get_error;
- sftp_init;
- sftp_lstat;
- sftp_mkdir;
- sftp_new;
- sftp_open;
- sftp_opendir;
- sftp_read;
- sftp_readdir;
- sftp_readlink;
- sftp_rename;
- sftp_rewind;
- sftp_rmdir;
- sftp_seek;
- sftp_seek64;
- sftp_server_init;
- sftp_server_new;
- sftp_server_version;
- sftp_setstat;
- sftp_stat;
- sftp_symlink;
- sftp_tell;
- sftp_tell64;
- sftp_unlink;
- sftp_utimes;
- sftp_write;
- ssh_accept;
- ssh_auth_list;
- ssh_bind_accept;
- ssh_bind_fd_toaccept;
- ssh_bind_free;
- ssh_bind_get_fd;
- ssh_bind_listen;
- ssh_bind_new;
- ssh_bind_set_blocking;
- ssh_bind_set_fd;
- ssh_bind_set_options;
- ssh_clean_pubkey_hash;
- ssh_connect;
- ssh_copyright;
- ssh_disconnect;
- ssh_finalize;
- ssh_get_disconnect_message;
- ssh_get_error;
- ssh_get_error_code;
- ssh_get_fd;
- ssh_get_hexa;
- ssh_get_issue_banner;
- ssh_get_openssh_version;
- ssh_get_pubkey;
- ssh_get_pubkey_hash;
- ssh_get_random;
- ssh_get_status;
- ssh_get_version;
- ssh_init;
- ssh_is_server_known;
- ssh_log;
- ssh_message_auth_password;
- ssh_message_auth_publickey;
- ssh_message_auth_reply_pk_ok;
- ssh_message_auth_reply_success;
- ssh_message_auth_set_methods;
- ssh_message_auth_user;
- ssh_message_channel_request_open_reply_accept;
- ssh_message_channel_request_reply_success;
- ssh_message_free;
- ssh_message_get;
- ssh_message_reply_default;
- ssh_message_retrieve;
- ssh_message_service_reply_success;
- ssh_message_service_service;
- ssh_message_subtype;
- ssh_message_type;
- ssh_new;
- ssh_options_allow_ssh1;
- ssh_options_allow_ssh2;
- ssh_options_copy;
- ssh_options_free;
- ssh_options_getopt;
- ssh_options_new;
- ssh_options_set_auth_callback;
- ssh_options_set_banner;
- ssh_options_set_bind;
- ssh_options_set_dsa_server_key;
- ssh_options_set_fd;
- ssh_options_set_host;
- ssh_options_set_identity;
- ssh_options_set_known_hosts_file;
- ssh_options_set_log_function;
- ssh_options_set_log_verbosity;
- ssh_options_set_port;
- ssh_options_set_rsa_server_key;
- ssh_options_set_ssh_dir;
- ssh_options_set_status_callback;
- ssh_options_set_timeout;
- ssh_options_set_username;
- ssh_options_set_wanted_algos;
- ssh_print_hexa;
- ssh_select;
- ssh_service_request;
- ssh_set_blocking;
- ssh_set_fd_except;
- ssh_set_fd_toread;
- ssh_set_fd_towrite;
- ssh_set_options;
- ssh_silent_disconnect;
- ssh_userauth_agent_pubkey;
- ssh_userauth_autopubkey;
- ssh_userauth_kbdint;
- ssh_userauth_kbdint_getinstruction;
- ssh_userauth_kbdint_getname;
- ssh_userauth_kbdint_getnprompts;
- ssh_userauth_kbdint_getprompt;
- ssh_userauth_kbdint_setanswer;
- ssh_userauth_list;
- ssh_userauth_none;
- ssh_userauth_offer_pubkey;
- ssh_userauth_password;
- ssh_userauth_pubkey;
- ssh_version;
- ssh_write_knownhost;
- string_burn;
- string_copy;
- string_data;
- string_fill;
- string_free;
- string_from_char;
- string_len;
- string_new;
- string_to_char;
- local:
- *;
-};
-
-SSH_0.4 {
- global:
- channel_write_stderr;
- channel_request_x11;
- channel_accept_x11;
- ssh_scp_close;
- ssh_scp_free;
- ssh_scp_init;
- ssh_scp_new;
- ssh_scp_push_file;
- ssh_scp_write;
- sftp_extensions_get_count;
- sftp_extensions_get_data;
- sftp_extensions_get_name;
- ssh_message_channel_request_channel;
- ssh_message_channel_request_command;
- ssh_message_channel_request_env_name;
- ssh_message_channel_request_env_value;
- ssh_message_channel_request_open_destination;
- ssh_message_channel_request_open_destination_port;
- ssh_message_channel_request_open_originator;
- ssh_message_channel_request_open_originator_port;
- ssh_message_channel_request_pty_height;
- ssh_message_channel_request_pty_pxheight;
- ssh_message_channel_request_pty_pxwidth;
- ssh_message_channel_request_pty_term;
- ssh_message_channel_request_pty_width;
- ssh_message_channel_request_subsystem;
- ssh_set_message_callback;
-} SSH_0.3;