[gexiv2] Add version script to limit exported functions



commit 3c801e70a9ea7271a76a58ce15867923143864a2
Author: Jens Georg <mail jensge org>
Date:   Sat Jun 10 12:06:26 2017 +0200

    Add version script to limit exported functions

 Makefile.am        |    2 ++
 gexiv2/gexiv2.map  |    6 ++++++
 gexiv2/meson.build |    5 +++++
 3 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index efb3161..f11433a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -37,6 +37,7 @@ EXTRA_DIST = \
        meson.build \
        gexiv2/meson.build \
        gexiv2/gexiv2-version.h.meson \
+       gexiv2/gexiv2.map \
        vapi/meson.build \
        test/meson.build \
        meson_options.txt
@@ -144,6 +145,7 @@ lib@PACKAGE_NAME@_la_CPPFLAGS = $(EXIV2_CFLAGS) $(GLIB_CFLAGS)
 
 lib@PACKAGE_NAME@_la_LDFLAGS  = \
        $(no_undefined) -export-dynamic -version-info $(GEXIV2_VERSION_INFO) \
+       -Wl,--version-script=$(srcdir)/gexiv2/gexiv2.map \
        $(WARN_LDFLAGS)
 
 clean-local:
diff --git a/gexiv2/gexiv2.map b/gexiv2/gexiv2.map
new file mode 100644
index 0000000..98159ea
--- /dev/null
+++ b/gexiv2/gexiv2.map
@@ -0,0 +1,6 @@
+{
+  global:
+    gexiv2_*;
+  local:
+    *;
+};
diff --git a/gexiv2/meson.build b/gexiv2/meson.build
index 67f4381..51666fc 100644
--- a/gexiv2/meson.build
+++ b/gexiv2/meson.build
@@ -33,6 +33,10 @@ enum_sources = gnome.mkenums('gexiv2-enums',
 
 install_headers(gexiv2_headers, subdir : 'gexiv2')
 
+# Static map file
+mapfile = 'gexiv2.map'
+vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile)
+
 gexiv2 = library('gexiv2',
                  ['gexiv2-metadata.cpp',
                   'gexiv2-metadata-exif.cpp',
@@ -52,6 +56,7 @@ gexiv2 = library('gexiv2',
                  gexiv2_headers +
                  [version_header] +
                  enum_sources,
+                 link_args : vflag,
                  include_directories : include_directories('..'),
                  version : '2',
                  soversion: '2.0.0',


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