]> git.ipfire.org Git - thirdparty/libbsd.git/commitdiff
build: Use an export symbols file if there is no version script support
authorGuillem Jover <guillem@hadrons.org>
Mon, 10 Apr 2023 22:24:13 +0000 (00:24 +0200)
committerGuillem Jover <guillem@hadrons.org>
Mon, 17 Apr 2023 02:12:42 +0000 (04:12 +0200)
We generate the symbol list from the version script to avoid repeating
ourselves and potentially getting the lists out-of-sync.

src/Makefile.am

index b892ab8db0a4bfcaed850bbf89f9e288e1dda47e..bc1add60a4b8943cf3678f3903249ddf48374b87 100644 (file)
@@ -66,6 +66,13 @@ if HAVE_LINKER_VERSION_SCRIPT
 libbsd_la_LDFLAGS += \
        -Wl,--version-script=$(srcdir)/libbsd.map \
        # EOL
+else
+libbsd_la_LDFLAGS += \
+       -export-symbols libbsd.sym \
+       # EOL
+EXTRA_libbsd_la_DEPENDENCIES += \
+       libbsd.sym \
+       # EOL
 endif
 libbsd_la_SOURCES = \
        arc4random.c \
@@ -136,10 +143,19 @@ CLEANFILES += \
        # EOL
 endif
 
+DISTCLEANFILES = \
+       libbsd.sym \
+       # EOL
+
 libbsd_ctor_a_SOURCES = \
        setproctitle_ctor.c \
        # EOL
 
+# Generate a simple libtool symbol export list to be used as a fallback if
+# there is no version script support.
+libbsd.sym: libbsd.map
+       $(AM_V_GEN) $(SED) -ne 's/^[[:space:]]\{1,\}\([A-Za-z0-9_]\{1,\}\);/\1/p' libbsd.map > $@
+
 if NEED_TRANSPARENT_LIBMD
 TRANSPARENT_LIBMD_DEPENDS = format.ld