[babl] meson: Generate babl.map based on export_symbols file



commit 5cb0da488e23343b24ca582ab6279ec291075194
Author: Jan Vesely <jano vesely gmail com>
Date:   Fri Jul 20 01:55:54 2018 -0400

    meson: Generate babl.map based on export_symbols file
    
    Fixing issue #20
    
    Signed-off-by: Jan Vesely <jano vesely gmail com>

 babl.map         | 75 --------------------------------------------------------
 babl/meson.build | 16 ++++++++++++
 gen_babl_map.py  | 11 +++++++++
 meson.build      |  1 -
 4 files changed, 27 insertions(+), 76 deletions(-)
---
diff --git a/babl/meson.build b/babl/meson.build
index 29ac00b..77e69a5 100644
--- a/babl/meson.build
+++ b/babl/meson.build
@@ -1,6 +1,21 @@
 bablInclude = include_directories('.')
 subdir('base')
 
+version_script = 'babl.map'
+export_symbols = join_paths(meson.source_root(), 'export-symbols')
+version_script_target = custom_target(version_script,
+  input : [ export_symbols, ] ,
+  output: [ version_script ] ,
+  command: [
+  'python',
+  join_paths(meson.source_root(), 'gen_babl_map.py'),
+  export_symbols,
+  version_script,
+  ],
+  capture: true,
+)
+
+
 # Linker arguments
 babl_link_args = [
   '-Wl,--version-script,' + version_script,
@@ -116,6 +131,7 @@ babl = library(
   link_whole: [ babl_base, ],
   link_args: [ babl_link_args, ],
   dependencies: [ math, thread, dl, ],
+  link_depends: [ version_script_target, ],
   version: so_version,
   install: true,
 )
diff --git a/gen_babl_map.py b/gen_babl_map.py
new file mode 100644
index 0000000..644ea61
--- /dev/null
+++ b/gen_babl_map.py
@@ -0,0 +1,11 @@
+import sys
+
+export_symbols=sys.argv[1]
+version_file=sys.argv[2]
+
+with open(export_symbols, 'r') as syms, \
+     open(version_file, 'w') as version:
+     version.write("V0_1_0 {\n    global:\n")
+     for sym in syms:
+        version.write("        {};\n".format(sym.strip()))
+     version.write("    local:\n        *;\n};\n")
diff --git a/meson.build b/meson.build
index 956da08..31540d0 100644
--- a/meson.build
+++ b/meson.build
@@ -325,7 +325,6 @@ configure_file(
 # Subdirs
 
 rootInclude = include_directories('.')
-version_script = join_paths(meson.current_source_dir(), 'babl.map')
 
 subdir('babl')
 subdir('extensions')


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