aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gierth <rhodiumtoad@postgresql.org>2019-02-04 18:47:33 +0000
committerAndrew Gierth <rhodiumtoad@postgresql.org>2019-02-04 18:54:56 +0000
commit54f5f887fd7df0ba9e286ce7bc4d1b1197afcbf3 (patch)
tree5a36570e430e3916fca1550357c12189197fe799
parent08ecdfe7e5e0a31efbe1d58fefbe085b53bc79ca (diff)
downloadpostgresql-54f5f887fd7df0ba9e286ce7bc4d1b1197afcbf3.tar.gz
postgresql-54f5f887fd7df0ba9e286ce7bc4d1b1197afcbf3.zip
Move port-specific parts of with_temp_install to port makefile.
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.)
-rw-r--r--src/Makefile.global.in17
-rw-r--r--src/makefiles/Makefile.aix3
-rw-r--r--src/makefiles/Makefile.darwin3
-rw-r--r--src/makefiles/Makefile.freebsd8
-rw-r--r--src/makefiles/Makefile.hpux3
5 files changed, 27 insertions, 7 deletions
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 68528530417..a84b2f96eb6 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -413,13 +413,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,$(if $(filter $(PORTNAME),hpux),SHLIB_PATH,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)
diff --git a/src/makefiles/Makefile.aix b/src/makefiles/Makefile.aix
index 0f6c0289384..ba3695dd570 100644
--- a/src/makefiles/Makefile.aix
+++ b/src/makefiles/Makefile.aix
@@ -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
diff --git a/src/makefiles/Makefile.darwin b/src/makefiles/Makefile.darwin
index e2b1d44959f..b17598f0586 100644
--- a/src/makefiles/Makefile.darwin
+++ b/src/makefiles/Makefile.darwin
@@ -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
diff --git a/src/makefiles/Makefile.freebsd b/src/makefiles/Makefile.freebsd
index ce03c8dcd26..98a6f50615e 100644
--- a/src/makefiles/Makefile.freebsd
+++ b/src/makefiles/Makefile.freebsd
@@ -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
diff --git a/src/makefiles/Makefile.hpux b/src/makefiles/Makefile.hpux
index 30dd3eb77e6..c871fb0c7ef 100644
--- a/src/makefiles/Makefile.hpux
+++ b/src/makefiles/Makefile.hpux
@@ -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)