Skip to content

Commit 9b73701

Browse files
giordanopull[bot]
authored andcommitted
[Make.inc] Define new variable PATCHELF_SET_RPATH_ARG
1 parent cdab1c1 commit 9b73701

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

Make.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,10 @@ PATCHELF := patchelf
10181018
else
10191019
PATCHELF := $(build_depsbindir)/patchelf
10201020
endif
1021+
# In the standard build system we want to patch files with `--set-rpath`, but downstream
1022+
# packagers like Spack may want to use `--add-rpath` instead, leave them the possibility to
1023+
# choose the command.
1024+
PATCHELF_SET_RPATH_ARG := --set-rpath
10211025

10221026
ifeq ($(USE_SYSTEM_LIBWHICH), 1)
10231027
LIBWHICH := libwhich

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ ifneq ($(DARWIN_FRAMEWORK),1)
388388
endif
389389
else ifneq (,$(findstring $(OS),Linux FreeBSD))
390390
for j in $(JL_TARGETS) ; do \
391-
$(PATCHELF) --set-rpath '$$ORIGIN/$(private_libdir_rel):$$ORIGIN/$(libdir_rel)' $(DESTDIR)$(bindir)/$$j; \
391+
$(PATCHELF) $(PATCHELF_SET_RPATH_ARG) '$$ORIGIN/$(private_libdir_rel):$$ORIGIN/$(libdir_rel)' $(DESTDIR)$(bindir)/$$j; \
392392
done
393393
endif
394394

@@ -420,17 +420,17 @@ endif
420420
endif
421421
else ifneq (,$(findstring $(OS),Linux FreeBSD))
422422
ifeq ($(JULIA_BUILD_MODE),release)
423-
$(PATCHELF) --set-rpath '$$ORIGIN:$$ORIGIN/$(reverse_private_libdir_rel)' $(DESTDIR)$(private_libdir)/libjulia-internal.$(SHLIB_EXT)
424-
$(PATCHELF) --set-rpath '$$ORIGIN:$$ORIGIN/$(reverse_private_libdir_rel)' $(DESTDIR)$(private_libdir)/libjulia-codegen.$(SHLIB_EXT)
423+
$(PATCHELF) $(PATCHELF_SET_RPATH_ARG) '$$ORIGIN:$$ORIGIN/$(reverse_private_libdir_rel)' $(DESTDIR)$(private_libdir)/libjulia-internal.$(SHLIB_EXT)
424+
$(PATCHELF) $(PATCHELF_SET_RPATH_ARG) '$$ORIGIN:$$ORIGIN/$(reverse_private_libdir_rel)' $(DESTDIR)$(private_libdir)/libjulia-codegen.$(SHLIB_EXT)
425425
else ifeq ($(JULIA_BUILD_MODE),debug)
426-
$(PATCHELF) --set-rpath '$$ORIGIN:$$ORIGIN/$(reverse_private_libdir_rel)' $(DESTDIR)$(private_libdir)/libjulia-internal-debug.$(SHLIB_EXT)
427-
$(PATCHELF) --set-rpath '$$ORIGIN:$$ORIGIN/$(reverse_private_libdir_rel)' $(DESTDIR)$(private_libdir)/libjulia-codegen-debug.$(SHLIB_EXT)
426+
$(PATCHELF) $(PATCHELF_SET_RPATH_ARG) '$$ORIGIN:$$ORIGIN/$(reverse_private_libdir_rel)' $(DESTDIR)$(private_libdir)/libjulia-internal-debug.$(SHLIB_EXT)
427+
$(PATCHELF) $(PATCHELF_SET_RPATH_ARG) '$$ORIGIN:$$ORIGIN/$(reverse_private_libdir_rel)' $(DESTDIR)$(private_libdir)/libjulia-codegen-debug.$(SHLIB_EXT)
428428
endif
429429
endif
430430

431431
# Fix rpaths for dependencies. This should be fixed in BinaryBuilder later.
432432
ifeq ($(OS), Linux)
433-
-$(PATCHELF) --set-rpath '$$ORIGIN' $(DESTDIR)$(private_shlibdir)/libLLVM.$(SHLIB_EXT)
433+
-$(PATCHELF) $(PATCHELF_SET_RPATH_ARG) '$$ORIGIN' $(DESTDIR)$(private_shlibdir)/libLLVM.$(SHLIB_EXT)
434434
endif
435435

436436
ifneq ($(LOADER_BUILD_DEP_LIBS),$(LOADER_INSTALL_DEP_LIBS))
@@ -460,7 +460,7 @@ ifeq ($(OS),FreeBSD)
460460
# don't set libgfortran's RPATH, it won't be able to find its friends on systems
461461
# that don't have the exact GCC port installed used for the build.
462462
for lib in $(DESTDIR)$(private_libdir)/libgfortran*$(SHLIB_EXT)*; do \
463-
$(PATCHELF) --set-rpath '$$ORIGIN' $$lib; \
463+
$(PATCHELF) $(PATCHELF_SET_RPATH_ARG) '$$ORIGIN' $$lib; \
464464
done
465465
endif
466466

0 commit comments

Comments
 (0)