As it is a good practice to keep only the public API symbols in a library,
because it reduce risk of name conflicts and the probability to mis-use an
internal function which would be a problem for evolution;

because there is a script that can generate that list of symbol, without
the burden of creating a file prone to errors and annoying to maintain;

this patch adds the necessary stuff to get the version-script generated
automatically and makes it used by LD.

Reset the version's AGE to 0 because interfaces have been removed (no user
interface, but internal symbol are removed); did not increment CURRENT
because it has already been done for the next release.

Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>
---
 .gitignore        |  2 ++
 WINGs/Makefile.am | 22 ++++++++++++++++++++++
 configure.ac      |  2 +-
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 384ef46..0d943a4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -85,6 +85,8 @@ WINGs/WINGs.pc
 WINGs/WUtil.pc
 
 wrlib/libwraster.map
+WINGs/libWUtil.map
+WINGs/libWINGs.map
 
 WindowMaker/Defaults/WMRootMenu
 WindowMaker/Defaults/WMState
diff --git a/WINGs/Makefile.am b/WINGs/Makefile.am
index 017f1d7..a88d040 100644
--- a/WINGs/Makefile.am
+++ b/WINGs/Makefile.am
@@ -100,6 +100,28 @@ pkgconfig_DATA = WINGs.pc WUtil.pc
 
 DISTCLEANFILES = $(pkgconfig_DATA) get-wings-flags get-wutil-flags
 
+
+if HAVE_LD_VERSION_SCRIPT
+# We make sure that only the symbols that are present in the public API are
+# visible in the compiled library
+libWUtil_la_LDFLAGS += -Wl,--version-script=libWUtil.map
+libWINGs_la_LDFLAGS += -Wl,--version-script=libWINGs.map
+
+EXTRA_libWUtil_la_DEPENDENCIES = libWUtil.map
+EXTRA_libWINGs_la_DEPENDENCIES = libWINGs.map
+
+CLEANFILES = libWUtil.map libWINGs.map
+
+libWUtil.map: $(srcdir)/WINGs/WUtil.h $(srcdir)/WINGs/WINGsP.h 
$(top_srcdir)/script/generate-mapfile-from-header.sh
+       $(AM_V_GEN)$(top_srcdir)/script/generate-mapfile-from-header.sh \
+               -n WUtil -v $(WUTIL_VERSION) $(srcdir)/WINGs/WUtil.h 
$(srcdir)/WINGs/WINGsP.h > libWUtil.map
+
+libWINGs.map: $(srcdir)/WINGs/WINGs.h $(srcdir)/WINGs/WINGsP.h 
$(top_srcdir)/script/generate-mapfile-from-header.sh
+       $(AM_V_GEN)$(top_srcdir)/script/generate-mapfile-from-header.sh \
+               -n WINGs -v $(WINGS_VERSION) $(srcdir)/WINGs/WINGs.h 
$(srcdir)/WINGs/WINGsP.h > libWINGs.map
+endif
+
+
 WINGs.pc: Makefile
        @echo "Generating $@"
        @echo 'Name: WINGs' > $@
diff --git a/configure.ac b/configure.ac
index 1cb4c4c..29f46d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,7 +76,7 @@ dnl
 dnl libWINGs
 WINGS_CURRENT=4
 WINGS_REVISION=0
-WINGS_AGE=1
+WINGS_AGE=0
 WINGS_VERSION=$WINGS_CURRENT:$WINGS_REVISION:$WINGS_AGE
 AC_SUBST(WINGS_VERSION)
 dnl
-- 
2.1.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to