From c8c09b7dda6061bb11c6f893c0be04db83461765 Mon Sep 17 00:00:00 2001 From: DavHau Date: Wed, 20 May 2020 02:33:41 +0000 Subject: [PATCH] add autoPatchelfIgnoreMissingDeps to auto-patchelf.sh --- doc/stdenv/stdenv.xml | 3 +++ pkgs/build-support/setup-hooks/auto-patchelf.sh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/stdenv/stdenv.xml b/doc/stdenv/stdenv.xml index ee93f39318b..818e6c5da00 100644 --- a/doc/stdenv/stdenv.xml +++ b/doc/stdenv/stdenv.xml @@ -2018,6 +2018,9 @@ addEnvHooks "$hostOffset" myBashFunction In certain situations you may want to run the main command (autoPatchelf) of the setup hook on a file or a set of directories instead of unconditionally patching all outputs. This can be done by setting the dontAutoPatchelf environment variable to a non-empty value. + + By default autoPatchelf will fail as soon as any ELF file requires a dependency which cannot be resolved via the given build inputs. In some situations you might prefer to just leave missing dependencies unpatched and continue to patch the rest. This can be achieved by setting the autoPatchelfIgnoreMissingDeps environment variable to a non-empty value. + The autoPatchelf command also recognizes a --no-recurse command line flag, which prevents it from recursing into subdirectories. diff --git a/pkgs/build-support/setup-hooks/auto-patchelf.sh b/pkgs/build-support/setup-hooks/auto-patchelf.sh index 72970623ed7..4f7c0c14304 100644 --- a/pkgs/build-support/setup-hooks/auto-patchelf.sh +++ b/pkgs/build-support/setup-hooks/auto-patchelf.sh @@ -141,7 +141,7 @@ autoPatchelfFile() { # This makes sure the builder fails if we didn't find a dependency, because # the stdenv setup script is run with set -e. The actual error is emitted # earlier in the previous loop. - [ $depNotFound -eq 0 ] + [ $depNotFound -eq 0 -o -n "$autoPatchelfIgnoreMissingDeps" ] if [ -n "$rpath" ]; then echo "setting RPATH to: $rpath" >&2