diff options
Diffstat (limited to 'libpq/libpq/buildfile')
-rw-r--r-- | libpq/libpq/buildfile | 99 |
1 files changed, 68 insertions, 31 deletions
diff --git a/libpq/libpq/buildfile b/libpq/libpq/buildfile index bf7f844..94fa06b 100644 --- a/libpq/libpq/buildfile +++ b/libpq/libpq/buildfile @@ -1,25 +1,30 @@ # file : libpq/buildfile -# license : PostgreSQL Licene; see accompanying COPYRIGHT file +# 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} 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 -fe-secure-gssapi -*win32*} \ - mb/{ c}{* } \ - port/{h c}{* -strlcpy -getaddrinfo -inet_aton -*win32*} \ - common/{ c}{* } \ - include/{h }{** } \ - {def }{libpqdll } \ - pq/{file}{pg_service.conf.sample } \ - $imp_libs +lib{pq}: {h }{* -version} \ + {h }{ version} \ + pq/{h c}{* -fe-gssapi-common \ + -fe-secure-gssapi \ + -*win32*} \ + port/{h c}{* -explicit_bzero \ + -getaddrinfo \ + -gettimeofday \ + -inet_aton \ + -strlcpy \ + -*win32*} \ + common/{h c}{* } \ + include/{h }{** } \ + pq/{file}{pg_service.conf.sample} tclass = $c.target.class tsys = $c.target.system @@ -29,12 +34,49 @@ bsd = ($tclass == 'bsd') macos = ($tclass == 'macos') windows = ($tclass == 'windows') -lib{pq}: file{libpqdll.map}: include = ($linux || $bsd ? adhoc : false) -lib{pq}: port/c{strlcpy}: include = (!$bsd && !$macos) +# Note that upstream also uses native explicit_bzero() on Linux for glibc +# versions equal or greater than 2.25. It's, however, not easy to check the +# glibc's version in the buildfile, so we always fallback to the custom +# explicit_bzero() implementation on Linux. +# +# Also note that linking the native explicit_bzero() would prevent us running +# against older glibc versions. +# +lib{pq}: port/c{explicit_bzero}: include = (!$bsd) +lib{pq}: port/c{gettimeofday}: include = ($tsys == 'win32-msvc') + +# Note that we never compile port/strlcpy.c directly but rather conditionally +# include it from our strlcpy.c if HAVE_DECL_STRLCAT is 0 (see +# libpq/pg_config.h for the macro definition). +# +lib{pq}: port/c{strlcpy}: include = adhoc +lib{pq}: c{strlcpy}: include = (!$bsd && !$macos) lib{pq}: pq/{h c}{*win32* } \ port/{h c}{*win32* +getaddrinfo +inet_aton}: include = $windows +lib{pq}: $imp_libs + +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). # @@ -48,14 +90,7 @@ h{version}: in{version} $src_root/manifest # c.poptions += -DFRONTEND -DUNSAFE_STAT_OK -DSO_MAJOR_VERSION=$abi_major -if! $windows - # Note that the upstream package uses the -pthread compiler/linker option. - # The option is unsupported by build2 so we pass -D_REENTRANT and -lpthread - # preprocessor/linker options instead. We also omit -D_THREAD_SAFE (synonym - # for -D_REENTRANT) and Solaris-specific -D_POSIX_PTHREAD_SEMANTICS. - # - c.poptions += -D_REENTRANT -else +if $windows # Note that the upstream package defines the WIN32 macro for VC only, # relying on the fact that MinGW GCC defines it by default. However, the # macro disappears from the default ones if to compile with -std=c9x (as we @@ -80,7 +115,7 @@ switch $tclass, $tsys case 'windows', 'mingw32' { - c.poptions += -DBUILDING_DLL -DEXEC_BACKEND + c.poptions += -DBUILDING_DLL c.poptions =+ "-I$src_base/include/port/win32" } case 'windows' @@ -88,7 +123,7 @@ switch $tclass, $tsys # Probably some of the *WIN* macro definitions are not really required, # but let's keep all of them for good measure. # - c.poptions += -DEXEC_BACKEND -D_WINDLL -D__WINDOWS__ -D__WIN32__ -D_MBCS \ + c.poptions += -D_WINDLL -D__WINDOWS__ -D__WIN32__ -D_MBCS \ -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE c.poptions =+ "-I$src_base/include/port/win32_msvc" \ @@ -156,7 +191,9 @@ switch $c.class # way that works across compilers/version (some -Wno-* options are only # recognized in newer versions). # - c.coptions += -Wno-all -Wno-extra + # @@ TMP: try to re-enable on next release. + # + c.coptions += -Wno-all -Wno-extra -Wno-deprecated-declarations } case 'msvc' { @@ -197,13 +234,13 @@ 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 + c.libs += -pthread } default - c.libs += -lpthread + c.libs += -pthread } # Export options. |