[libsoup] meson: Don't export the private symbols



commit c729abf55ebad9fca55afbfa4ba7d58b66b00865
Author: Tomas Popela <tpopela redhat com>
Date:   Mon Sep 3 14:11:56 2018 +0200

    meson: Don't export the private symbols
    
    By using the compiler's visibility mechanism.
    
    Closes: #10

 libsoup/meson.build |  4 ++--
 meson.build         | 17 +++++++++++++----
 2 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/libsoup/meson.build b/libsoup/meson.build
index 5483c803..892799bf 100644
--- a/libsoup/meson.build
+++ b/libsoup/meson.build
@@ -223,7 +223,7 @@ libsoup = shared_library('soup-@0@'.format(apiversion),
   soup_enums,
   version : libversion,
   soversion : soversion,
-  c_args : libsoup_c_args,
+  c_args : libsoup_c_args + hidden_visibility_flag,
   include_directories : configinc,
   install : true,
   dependencies : deps)
@@ -260,7 +260,7 @@ if enable_gnome
     soup_gnome_sources + soup_gnome_headers,
     version : libversion,
     soversion : soversion,
-    c_args : libsoup_c_args,
+    c_args : libsoup_c_args + hidden_visibility_flag,
     include_directories : configinc,
     install : true,
     dependencies : deps + [libsoup_dep])
diff --git a/meson.build b/meson.build
index b7fd1532..c85b53bb 100644
--- a/meson.build
+++ b/meson.build
@@ -76,10 +76,19 @@ endif
 cdata = configuration_data()
 
 platform_deps = []
-if host_machine.system() == 'windows'
-  platform_deps = [cc.find_library('ws2_32')]
-  cdata.set('_SOUP_EXTERN', '__declspec(dllexport)')
-  cdata.set('DLL_EXPORT', 1)
+hidden_visibility_flag = []
+if get_option('default_library') != 'static'
+  if host_machine.system() == 'windows'
+    platform_deps = [cc.find_library('ws2_32')]
+    cdata.set('DLL_EXPORT', true)
+    cdata.set('_SOUP_EXTERN', '__declspec(dllexport) extern')
+    if cc.get_id() != 'msvc'
+      hidden_visibility_flag += ['-fvisibility=hidden']
+    endif
+  else
+    cdata.set('_SOUP_EXTERN', '__attribute__((visibility("default"))) extern')
+    hidden_visibility_flag += ['-fvisibility=hidden']
+  endif
 endif
 
 libpsl_required_version = '>= 0.20'


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]