[librest/wip/teuf/gtask: 32/37] version script
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librest/wip/teuf/gtask: 32/37] version script
- Date: Thu, 16 Jun 2016 16:44:49 +0000 (UTC)
commit 2825d489815c44a3a900074cf37f454944360b70
Author: Christophe Fergeau <cfergeau redhat com>
Date: Wed Jun 15 17:54:13 2016 +0200
version script
build/ld-version.m4 | 34 ++++++++++++++++++++++++++++++++++
configure.ac | 2 ++
rest/Makefile.am | 26 +++++++++++++++++++++++++-
3 files changed, 61 insertions(+), 1 deletions(-)
---
diff --git a/build/ld-version.m4 b/build/ld-version.m4
new file mode 100644
index 0000000..589fb71
--- /dev/null
+++ b/build/ld-version.m4
@@ -0,0 +1,34 @@
+dnl Check whether the linker supports --version-script.
+dnl
+dnl Probes whether the linker supports --version-script with a simple version
+dnl script that only defines a single version. Sets the Automake conditional
+dnl HAVE_LD_VERSION_SCRIPT based on whether it is supported.
+dnl
+dnl Written by Russ Allbery <rra stanford edu>
+dnl Based on the gnulib ld-version-script macro from Simon Josefsson
+dnl Copyright 2010 Board of Trustees, Leland Stanford Jr. University
+dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+dnl
+dnl This file is free software; the Free Software Foundation gives unlimited
+dnl permission to copy and/or distribute it, with or without modifications, as
+dnl long as this notice is preserved.
+
+AC_DEFUN([RRA_LD_VERSION_SCRIPT],
+[AC_CACHE_CHECK([if -Wl,--version-script works], [rra_cv_ld_version_script],
+ [save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
+ cat > conftest.map <<EOF
+VERSION_1 {
+ global:
+ sym;
+
+ local:
+ *;
+};
+EOF
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
+ [rra_cv_ld_version_script=yes], [rra_cv_ld_version_script=no])
+ rm -f conftest.map
+ LDFLAGS="$save_LDFLAGS"])
+ AM_CONDITIONAL([HAVE_LD_VERSION_SCRIPT],
+ [test x"$rra_cv_ld_version_script" = xyes])])
diff --git a/configure.ac b/configure.ac
index 4d92dfc..4f9d751 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,6 +40,8 @@ AM_PROG_CC_C_O
LT_PREREQ([2.2.6])
LT_INIT([disable-static])
+RRA_LD_VERSION_SCRIPT
+
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.38)
PKG_CHECK_MODULES(SOUP, libsoup-2.4)
PKG_CHECK_MODULES(XML, libxml-2.0)
diff --git a/rest/Makefile.am b/rest/Makefile.am
index 4df6ed4..d2eeca8 100644
--- a/rest/Makefile.am
+++ b/rest/Makefile.am
@@ -43,12 +43,20 @@ lib_headers = \
EXTRA_DIST = \
rest-marshal.txt
+if HAVE_LD_VERSION_SCRIPT
+LIBREST_SYMBOLS_LDFLAGS = -Wl,--version-script=${srcdir}/librest-map-file
+LIBREST_SYMBOLS_FILE = librest-map-file
+else
+LIBREST_SYMBOLS_LDFLAGS = -export-symbols ${srcdir}/librest-sym-file
+LIBREST_SYMBOLS_FILE = librest-sym-file
+endif
+
lib_LTLIBRARIES = librest- API_VERSION@.la
librest_ API_VERSION@_la_CFLAGS = $(GLIB_CFLAGS) $(GTHREAD_CFLAGS) \
$(SOUP_CFLAGS) $(SOUP_GNOME_CFLAGS) \
$(XML_CFLAGS) $(GCOV_CFLAGS) \
-I$(top_srcdir) -Wall -DG_LOG_DOMAIN=\"Rest\"
-librest_ API_VERSION@_la_LDFLAGS = -no-undefined
+librest_ API_VERSION@_la_LDFLAGS = -no-undefined $(LIBREST_SYMBOLS_LDFLAGS)
librest_ API_VERSION@_la_LIBADD = $(GLIB_LIBS) $(GTHREAD_LIBS) \
$(SOUP_LIBS) $(SOUP_GNOME_LIBS) $(XML_LIBS) \
$(GCOV_LDFLAGS)
@@ -56,6 +64,7 @@ librest_ API_VERSION@_la_SOURCES = $(lib_sources) $(lib_headers)
nodist_librest_ API_VERSION@_la_SOURCES = $(nodist_lib_sources)
librest_ API_VERSION@_la_HEADERS = $(lib_headers)
librest_ API_VERSION@_ladir = $(includedir)/rest- API_VERSION@/rest
+librest_ API_VERSION@_la_DEPENDENCIES = $(LIBREST_SYMBOLS_FILE)
rest-enum-types.h: stamp-rest-enum-types.h
@true
@@ -137,3 +146,18 @@ CLEANFILES += $(dist_gir_DATA) \
$(NULL)
endif # HAVE_INTROSPECTION
+
+# regeneration of symbol files
+update-map-file: $(lib_headers)
+ ( echo "LIBREST_1 {" ; \
+ echo "global:" ; \
+ ctags -f - -I G_GNUC_CONST --c-kinds=p $^ | awk '/^(rest_|oauth2_|oauth_)/ { print $$1 ";" }' |
sort ; \
+ echo "local:" ; \
+ echo "*;" ; \
+ echo "};" ) > $(srcdir)/librest-map-file
+
+update-sym-file: $(lib_headers)
+ ( ctags -f - -I G_GNUC_CONST --c-kinds=p $^ | awk '/^(rest_|oauth2_|oauth_)/ { print $$1 }' | sort ; \
+ ) > $(srcdir)/librest-sym-file
+
+update-symbol-files: update-map-file update-sym-file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]