[devhelp] meson: export only public libdevhelp symbols



commit 19a4b983f582cd6f0a872161095ff941a17ecfd5
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Mar 11 15:28:07 2018 +0100

    meson: export only public libdevhelp symbols

 devhelp/meson.build |   16 ++++++++++++++--
 devhelp/symbol.map  |    6 ++++++
 2 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/devhelp/meson.build b/devhelp/meson.build
index 3451e72..6577530 100644
--- a/devhelp/meson.build
+++ b/devhelp/meson.build
@@ -71,11 +71,23 @@ LIBDEVHELP_STATIC_DEP = declare_dependency(
         dependencies : DEVHELP_DEPS
 )
 
+symbol_map = join_paths(meson.current_source_dir(), 'symbol.map')
+
+ldflag = '-Wl,--version-script'
+c_compiler = meson.get_compiler('c')
+
+ldflags = []
+if c_compiler.has_argument(ldflag)
+        ldflags += '@0@,@1@'.format(ldflag, symbol_map)
+endif
+
 shared_library(
         'devhelp-@0@'.format(DEVHELP_API_VERSION),
         link_with : libdevhelp_static,
-        install : true,
-        version : LIBDEVHELP_LT_VERSION
+        link_args : ldflags,
+        link_depends : symbol_map,
+        version : LIBDEVHELP_LT_VERSION,
+        install : true
 )
 
 install_headers(
diff --git a/devhelp/symbol.map b/devhelp/symbol.map
new file mode 100644
index 0000000..0ac448d
--- /dev/null
+++ b/devhelp/symbol.map
@@ -0,0 +1,6 @@
+{
+global:
+  dh_*;
+local:
+  *;
+};


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