From a04535b0964d2bd40d08e4b3d16ff27b6ee7262c Mon Sep 17 00:00:00 2001
From: Alex Samorukov <samm@os2.kiev.ua>
Date: Thu, 31 Oct 2019 08:14:49 +0100
Subject: [PATCH] Fix darwin/clang map
babl/meson.build | 17 ++++++++++++++---
babl/test-clang.map | 1 +
babl/test-gnu.map | 6 ++++++
gen_babl_map.py | 6 ++++++
4 files changed, 27 insertions(+), 3 deletions(-)
create mode 100644 babl/test-clang.map
create mode 100644 babl/test-gnu.map
diff --git a/babl/meson.build b/babl/meson.build
index b551c9a8d..16e1c569f 100644
@@ -4,6 +4,12 @@ subdir('base')
python = import('python').find_installation()
version_script = 'babl.map'
+version_script_clang = 'babl.map.clang'
+babl_gnu_sym_path = join_paths(meson.current_source_dir(), 'test-gnu.map')
+babl_clang_sym_path = join_paths(meson.current_source_dir(), 'test-clang.map')
export_symbols = join_paths(meson.source_root(), 'export-symbols')
version_script_target = custom_target(version_script,
input : [ export_symbols, ] ,
@@ -24,9 +30,14 @@ babl_c_args = [
- '-Wl,--version-script,' + version_script,
+if cc.links('', name: '-Wl,--version-script', args: ['-shared', '-Wl,--version-script=' + babl_gnu_sym_path])
+ babl_link_args = ['-Wl,--version-script,' + version_script]
+elif host_machine.system() == 'darwin' and cc.has_multi_link_arguments('-Wl,-exported_symbols_list', babl_clang_sym_path)
+ babl_link_args = ['-Wl,-exported_symbols_list',version_script_clang]
+ error('Linker doesn\'t support --version-script or -exported_symbols_list')
babl_link_args += '-Wl,--no-undefined'
diff --git a/babl/test-clang.map b/babl/test-clang.map
index 000000000..2ad252630
diff --git a/babl/test-gnu.map b/babl/test-gnu.map
index 000000000..c27b37d66