From 3eab661e77f6c39891e02d46ff826f8ada2ba674 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 26 Oct 2021 18:28:10 +0300 Subject: Auto-generate .map and .def files --- libpq/libpq/buildfile | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'libpq/libpq/buildfile') diff --git a/libpq/libpq/buildfile b/libpq/libpq/buildfile index e6608b2..28cd073 100644 --- a/libpq/libpq/buildfile +++ b/libpq/libpq/buildfile @@ -1,6 +1,9 @@ # file : libpq/buildfile # license : PostgreSQL License; see accompanying COPYRIGHT file +define map: file +map{*}: extension = map + # Note that libz is only used in the backend server. # import imp_libs = libssl%lib{ssl} @@ -8,10 +11,6 @@ import imp_libs += libcrypto%lib{crypto} # Exclude source code of unused features (authentication methods, etc). # -# @@ When it becomes possible (probably with ad hoc rules), generate -# libpqdll.map and libpqdll.def on the fly from pq/exports.txt applying -# regex replace to its lines and adding prologue/epilogue. -# lib{pq}: {h }{* -version} \ {h }{ version} \ pq/{h c}{* -fe-gssapi-common \ @@ -51,8 +50,25 @@ lib{pq}: port/c{strlcpy}: include = (!$bsd && !$macos) lib{pq}: pq/{h c}{*win32* } \ port/{h c}{*win32* +getaddrinfo +inet_aton}: include = $windows -libs{pq}: file{libpqdll.map}: include = ($linux || $bsd ? adhoc : false) -libs{pq}: def{libpqdll}: include = $windows +libs{pq}: map{libpqdll}: include = ($linux || $bsd ? adhoc : false) +libs{pq}: def{libpqdll}: include = $windows + +map{libpqdll}: pq/file{exports.txt} +{{ + diag gen $> + f = $path($>) + echo '{ global:' >$f + sed -n -e 's/^\s*([^#]\S*)\s+\d+\s*$/\1;/p' $path($<) >>$f + echo ' local: *; };' >>$f +}} + +def{libpqdll}: pq/file{exports.txt} +{{ + diag gen $> + f = $path($>) + echo 'EXPORTS' >$f + sed -n -e 's/^\s*([^#]\S*)\s+(\d+)\s*$/ \1 @ \2/p' $path($<) >>$f +}} # The version file is an internal one (it is only included from pg_config.h) # so we don't distribute nor install it (see below). @@ -216,7 +232,7 @@ switch $tclass, $tsys # c.loptions += -Wl,--no-undefined - c.loptions += "-Wl,--version-script=$src_base/libpqdll.map" + c.loptions += "-Wl,--version-script=$out_base/libpqdll.map" c.libs += -lpthread } -- cgit v1.1