Commit 54f5f887 authored by Andrew Gierth's avatar Andrew Gierth

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.)
parent 08ecdfe7
...@@ -413,13 +413,16 @@ $(1)="$(if $($(1)),$(2):$$$(1),$(2))" ...@@ -413,13 +413,16 @@ $(1)="$(if $($(1)),$(2):$$$(1),$(2))"
endef endef
# platform-specific environment variable to set shared library path # platform-specific environment variable to set shared library path
define ld_library_path_var # individual ports can override this later, this is the default name
$(if $(filter $(PORTNAME),darwin),DYLD_LIBRARY_PATH,$(if $(filter $(PORTNAME),aix),LIBPATH,$(if $(filter $(PORTNAME),hpux),SHLIB_PATH,LD_LIBRARY_PATH))) ld_library_path_var = LD_LIBRARY_PATH
endef
# with_temp_install_extra is for individual ports to define if they
define with_temp_install # need something more here. If not defined then the expansion does
PATH="$(abs_top_builddir)/tmp_install$(bindir):$$PATH" $(call add_to_path,$(ld_library_path_var),$(abs_top_builddir)/tmp_install$(libdir)) # nothing.
endef 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) ifeq ($(enable_tap_tests),yes)
......
...@@ -23,6 +23,9 @@ else ...@@ -23,6 +23,9 @@ else
LDFLAGS_SL += -Wl,-bnoentry -Wl,-H512 -Wl,-bM:SRE LDFLAGS_SL += -Wl,-bnoentry -Wl,-H512 -Wl,-bM:SRE
endif endif
# env var name to use in place of LD_LIBRARY_PATH
ld_library_path_var = LIBPATH
POSTGRES_IMP= postgres.imp POSTGRES_IMP= postgres.imp
......
...@@ -2,6 +2,9 @@ AROPT = crs ...@@ -2,6 +2,9 @@ AROPT = crs
DLSUFFIX = .so DLSUFFIX = .so
# env var name to use in place of LD_LIBRARY_PATH
ld_library_path_var = DYLD_LIBRARY_PATH
ifdef PGXS ifdef PGXS
BE_DLLLIBS = -bundle_loader $(bindir)/postgres BE_DLLLIBS = -bundle_loader $(bindir)/postgres
else else
......
...@@ -9,6 +9,14 @@ DLSUFFIX = .so ...@@ -9,6 +9,14 @@ DLSUFFIX = .so
CFLAGS_SL = -fPIC -DPIC 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 # Rule for building a shared library from a single .o file
%.so: %.o %.so: %.o
......
...@@ -36,6 +36,9 @@ else ...@@ -36,6 +36,9 @@ else
CFLAGS_SL = +Z CFLAGS_SL = +Z
endif 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 # Rule for building a shared library from a single .o file
%$(DLSUFFIX): %.o %$(DLSUFFIX): %.o
ifeq ($(GCC), yes) ifeq ($(GCC), yes)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment