[folks/wip/nielsdg/meson-fixes: 1/2] meson: Check linker support for --version-script



commit 2742ff30e14b9b29fed234df60eb6ce101fdcc59
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Tue Dec 24 10:58:51 2019 +0100

    meson: Check linker support for --version-script
    
    There's a possibility that the linker doesn't support the
    `--version-script` option, so use `cc.get_supported_link_arguments()`.
    
    Also make sure to add the symbol map file to the `link_depends` options
    of the specific libraries.

 backends/dummy/lib/meson.build     | 8 +++++---
 backends/eds/lib/meson.build       | 8 +++++---
 backends/telepathy/lib/meson.build | 8 +++++---
 backends/tracker/lib/meson.build   | 8 +++++---
 4 files changed, 20 insertions(+), 12 deletions(-)
---
diff --git a/backends/dummy/lib/meson.build b/backends/dummy/lib/meson.build
index fa8ccc84..bf3ea211 100644
--- a/backends/dummy/lib/meson.build
+++ b/backends/dummy/lib/meson.build
@@ -27,9 +27,10 @@ dummy_backendlib_c_flags = [
   '-DG_LOG_DOMAIN="@0@"'.format(dummy_backend_name),
 ]
 
-dummy_backendlib_link_flags = [
-  '-Wl,--version-script,@0@/folks-@1@.map'.format(meson.current_source_dir(), dummy_backend_name),
-]
+dummy_backendlib_symbolmap = meson.current_source_dir() / 'folks-@0@.map'.format(dummy_backend_name)
+dummy_backendlib_link_flags = cc.get_supported_link_arguments(
+  '-Wl,--version-script,@0@'.format(dummy_backendlib_symbolmap),
+)
 
 dummy_backendlib = shared_library('folks-@0@'.format(dummy_backend_name),
   dummy_backendlib_sources,
@@ -37,6 +38,7 @@ dummy_backendlib = shared_library('folks-@0@'.format(dummy_backend_name),
   vala_args: dummy_backendlib_vala_flags,
   c_args: dummy_backendlib_c_flags,
   link_args: dummy_backendlib_link_flags,
+  link_depends: dummy_backendlib_symbolmap,
   version: folks_dummy_lib_version,
   vala_header: 'folks/folks-@0@.h'.format(dummy_backend_name),
   vala_gir: dummy_backendlib_gir_name + '.gir',
diff --git a/backends/eds/lib/meson.build b/backends/eds/lib/meson.build
index dbc75a6d..fd500475 100644
--- a/backends/eds/lib/meson.build
+++ b/backends/eds/lib/meson.build
@@ -40,9 +40,10 @@ eds_backendlib_c_flags = [
   '-DG_LOG_DOMAIN="@0@"'.format(eds_backend_name),
 ]
 
-eds_backendlib_link_flags = [
-  '-Wl,--version-script,@0@/folks-@1@.map'.format(meson.current_source_dir(), eds_backend_name),
-]
+eds_backendlib_symbolmap = meson.current_source_dir() / 'folks-@0@.map'.format(eds_backend_name)
+eds_backendlib_link_flags = cc.get_supported_link_arguments(
+  '-Wl,--version-script,@0@'.format(eds_backendlib_symbolmap),
+)
 
 eds_backendlib = shared_library('folks-@0@'.format(eds_backend_name),
   eds_backendlib_sources,
@@ -50,6 +51,7 @@ eds_backendlib = shared_library('folks-@0@'.format(eds_backend_name),
   vala_args: eds_backendlib_vala_flags,
   c_args: eds_backendlib_c_flags,
   link_args: eds_backendlib_link_flags,
+  link_depends: eds_backendlib_symbolmap,
   version: folks_eds_lib_version,
   vala_header: 'folks/folks-@0@.h'.format(eds_backend_name),
   vala_gir: eds_backendlib_gir_name + '.gir',
diff --git a/backends/telepathy/lib/meson.build b/backends/telepathy/lib/meson.build
index 2a191ca6..45044fe5 100644
--- a/backends/telepathy/lib/meson.build
+++ b/backends/telepathy/lib/meson.build
@@ -120,9 +120,10 @@ telepathy_backendlib_c_flags = [
   '-DG_LOG_DOMAIN="@0@"'.format(telepathy_backend_name),
 ]
 
-telepathy_backendlib_link_flags = [
-  '-Wl,--version-script,@0@/folks-@1@.map'.format(meson.current_source_dir(), telepathy_backend_name),
-]
+telepathy_backendlib_symbolmap = meson.current_source_dir() / 'folks-@0@.map'.format(telepathy_backend_name)
+telepathy_backendlib_link_flags = cc.get_supported_link_arguments(
+  '-Wl,--version-script,@0@'.format(telepathy_backendlib_symbolmap),
+)
 
 telepathy_backendlib = shared_library('folks-@0@'.format(telepathy_backend_name),
   telepathy_backendlib_sources,
@@ -130,6 +131,7 @@ telepathy_backendlib = shared_library('folks-@0@'.format(telepathy_backend_name)
   vala_args: telepathy_backendlib_vala_flags,
   c_args: telepathy_backendlib_c_flags,
   link_args: telepathy_backendlib_link_flags,
+  link_depends: telepathy_backendlib_symbolmap,
   version: folks_telepathy_lib_version,
   vala_header: 'folks/folks-@0@.h'.format(telepathy_backend_name),
   vala_gir: telepathy_backendlib_gir_name + '.gir',
diff --git a/backends/tracker/lib/meson.build b/backends/tracker/lib/meson.build
index 6ccd2616..c0b5f136 100644
--- a/backends/tracker/lib/meson.build
+++ b/backends/tracker/lib/meson.build
@@ -38,9 +38,10 @@ tracker_backendlib_c_flags = [
   '-DG_LOG_DOMAIN="@0@"'.format(tracker_backend_name),
 ]
 
-tracker_backendlib_link_flags = [
-  '-Wl,--version-script,@0@/folks-@1@.map'.format(meson.current_source_dir(), tracker_backend_name),
-]
+tracker_backendlib_symbolmap = meson.current_source_dir() / 'folks-@0@.map'.format(tracker_backend_name)
+tracker_backendlib_link_flags = cc.get_supported_link_arguments(
+  '-Wl,--version-script,@0@'.format(tracker_backendlib_symbolmap),
+)
 
 tracker_backendlib = shared_library('folks-@0@'.format(tracker_backend_name),
   tracker_backendlib_sources,
@@ -48,6 +49,7 @@ tracker_backendlib = shared_library('folks-@0@'.format(tracker_backend_name),
   vala_args: tracker_backendlib_vala_flags,
   c_args: tracker_backendlib_c_flags,
   link_args: tracker_backendlib_link_flags,
+  link_depends: tracker_backendlib_symbolmap,
   version: folks_tracker_lib_version,
   vala_header: 'folks/folks-@0@.h'.format(dummy_backend_name),
   vala_gir: tracker_backendlib_gir_name + '.gir',


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