[amtk] meson: Check if compiler supports version script linker option



commit eed214d83df7fb67e36bf6024fb5ba39bd35e4ce
Author: Biswapriyo Nath <nathbappai gmail com>
Date:   Tue May 3 13:58:54 2022 +0530

    meson: Check if compiler supports version script linker option
    
    This fixes the following build error with clang toolchain in mingw.
    lld: error: unknown argument: --version-script
    
    Tested on Linux: the output of `nm -D libamtk-5.so` is identical
    before/after this commit, so all is good.
    
    https://gitlab.gnome.org/swilmet/amtk/-/merge_requests/1

 amtk/meson.build | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/amtk/meson.build b/amtk/meson.build
index 064d7b6..5031ffa 100644
--- a/amtk/meson.build
+++ b/amtk/meson.build
@@ -62,20 +62,16 @@ AMTK_STATIC_DEP = declare_dependency(
   dependencies: AMTK_DEPS
 )
 
-amtk_lib_link_args = []
-amtk_lib_link_depends = []
-
-if meson.get_compiler('c').get_argument_syntax() != 'msvc'
-  symbol_map = meson.current_source_dir() / 'symbol.map'
-  amtk_lib_link_args = '-Wl,--version-script,' + symbol_map
-  amtk_lib_link_depends = symbol_map
-endif
+symbol_map = 'symbol.map'
+amtk_lib_link_args = c_compiler.get_supported_link_arguments([
+  '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), symbol_map),
+])
 
 amtk_lib = library(
   'amtk-@0@'.format(AMTK_API_VERSION),
   dependencies: AMTK_DEPS,
   link_args: amtk_lib_link_args,
-  link_depends: amtk_lib_link_depends,
+  link_depends: symbol_map,
   # link_whole is not supported with MSVC, so we use extract_all_objects().
   objects: amtk_static_lib.extract_all_objects(),
   version: AMTK_LT_VERSION,


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