]> granicus.if.org Git - postgresql/commitdiff
Move port-specific parts of with_temp_install to port makefile.
authorAndrew Gierth <rhodiumtoad@postgresql.org>
Mon, 4 Feb 2019 18:47:33 +0000 (18:47 +0000)
committerAndrew Gierth <rhodiumtoad@postgresql.org>
Mon, 4 Feb 2019 18:59:44 +0000 (18:59 +0000)
Rather than define ld_library_path_ver with a big nested $(if), just
put the overriding values in the makefiles for the relevant ports.

Also add a variable for port makefiles to append their own stuff to
with_temp_install, and use it to set LD_LIBRARY_PATH_RPATH=1 on
FreeBSD which is needed to make LD_LIBRARY_PATH override DT_RPATH
if DT_RUNPATH is not set (which seems to depend in unpredictable ways
on the choice of compiler, at least on my system).

Backpatch for the benefit of anyone doing regression tests on FreeBSD.
(For other platforms there should be no functional change.)

src/Makefile.global.in
src/makefiles/Makefile.aix
src/makefiles/Makefile.darwin
src/makefiles/Makefile.freebsd
src/makefiles/Makefile.hpux

index 3a41b798c682caed39af1d6764f1930342ae1199..d4a42ef478c696bb1bbe81566a1b5b394933ddb3 100644 (file)
@@ -356,13 +356,16 @@ $(1)="$(if $($(1)),$(2):$$$(1),$(2))"
 endef
 
 # platform-specific environment variable to set shared library path
-define ld_library_path_var
-$(if $(filter $(PORTNAME),darwin),DYLD_LIBRARY_PATH,$(if $(filter $(PORTNAME),aix),LIBPATH,LD_LIBRARY_PATH))
-endef
-
-define with_temp_install
-PATH="$(abs_top_builddir)/tmp_install$(bindir):$$PATH" $(call add_to_path,$(ld_library_path_var),$(abs_top_builddir)/tmp_install$(libdir))
-endef
+# individual ports can override this later, this is the default name
+ld_library_path_var = LD_LIBRARY_PATH
+
+# with_temp_install_extra is for individual ports to define if they
+# need something more here. If not defined then the expansion does
+# nothing.
+with_temp_install = \
+       PATH="$(abs_top_builddir)/tmp_install$(bindir):$$PATH" \
+       $(call add_to_path,$(strip $(ld_library_path_var)),$(abs_top_builddir)/tmp_install$(libdir)) \
+       $(with_temp_install_extra)
 
 ifeq ($(enable_tap_tests),yes)
 
index e5ad89d147007d4f6811e2c7f86e1a61be7dae62..00b5ea115db043054cc9eb4f4232afd53159c03e 100644 (file)
@@ -23,6 +23,9 @@ else
        LDFLAGS_SL += -Wl,-bnoentry -Wl,-H512 -Wl,-bM:SRE
 endif
 
+# env var name to use in place of LD_LIBRARY_PATH
+ld_library_path_var = LIBPATH
+
 
 POSTGRES_IMP= postgres.imp
 
index 7a8ba3e52748320c396972112d51fb3f8a965a09..892c2cb2d7a5cb563f47e7716e9ab6a104569dd1 100644 (file)
@@ -2,6 +2,9 @@ AROPT = crs
 
 DLSUFFIX = .so
 
+# env var name to use in place of LD_LIBRARY_PATH
+ld_library_path_var = DYLD_LIBRARY_PATH
+
 ifdef PGXS
   BE_DLLLIBS = -bundle_loader $(bindir)/postgres
 else
index 5a98e5a2b0bb0962f3bd38b07c22fa503d5fc9fc..5008c96b3f5a5e96465f6fb81e09606b1f9f7937 100644 (file)
@@ -9,6 +9,14 @@ DLSUFFIX = .so
 
 CFLAGS_SL = -fPIC -DPIC
 
+# extra stuff for $(with_temp_install)
+# we need this to get LD_LIBRARY_PATH searched ahead of the compiled-in
+# rpath, if no DT_RUNPATH is present in the executable. The conditions
+# under which DT_RUNPATH are added seem unpredictable, so be safe.
+
+define with_temp_install_extra
+LD_LIBRARY_PATH_RPATH=1
+endef
 
 # Rule for building a shared library from a single .o file
 %.so: %.o
index 97bd0ba6d9e27e2c9694a0d587bfbc36b8b4b052..84a1cc35425ed197a3ee44f7f167aa69575e0f06 100644 (file)
@@ -36,6 +36,9 @@ else
    CFLAGS_SL = +Z
 endif
 
+# env var name to use in place of LD_LIBRARY_PATH
+ld_library_path_var = SHLIB_PATH
+
 # Rule for building a shared library from a single .o file
 %$(DLSUFFIX): %.o
 ifeq ($(GCC), yes)