From e273773c4e66c2e553e1cbf0c453fc225fe808e3 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 13 Sep 2017 06:04:38 +0200 Subject: pkgs/build-game: Add runtimeDependencies attribute This allows us to add libraries to the RPATH despite being required by the respective game. By default there is only PulseAudio at the moment. Signed-off-by: aszlig --- pkgs/games/build-support/setup-hooks/auto-patchelf.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'pkgs/games/build-support/setup-hooks') diff --git a/pkgs/games/build-support/setup-hooks/auto-patchelf.sh b/pkgs/games/build-support/setup-hooks/auto-patchelf.sh index b0982a45..33408533 100644 --- a/pkgs/games/build-support/setup-hooks/auto-patchelf.sh +++ b/pkgs/games/build-support/setup-hooks/auto-patchelf.sh @@ -51,7 +51,6 @@ checkElfDep() { populateCacheWithRecursiveDeps() { local so found foundso for so in "${cachedDependencies[@]}"; do - local IFS=$'\n' for found in $(getDepsFromSo "$so"); do local libdir="${found%/*}" local base="${found##*/}" @@ -91,21 +90,23 @@ findDependency() { } autoPatchelfFile() { - local toPatch="$1" - local dep + local dep rpath="" toPatch="$1" local interpreter="$(cat $NIX_CC/nix-support/dynamic-linker)" if isExecutable "$toPatch"; then patchelf --set-interpreter "$interpreter" "$toPatch" + if [ -n "$runtimeDependencies" ]; then + for dep in $runtimeDependencies; do + rpath="$rpath${rpath:+:}$dep/lib" + done + fi fi patchelf --remove-rpath "$toPatch" - local rpath="" local missing="$( ldd "$toPatch" | sed -n -e 's/^[\t ]*\([^ ]\+\) => not found.*/\1/p' )" - local IFS=$'\n' for dep in $missing; do echo -n "searching for dependency $dep..." >&2 if findDependency "$dep"; then @@ -125,11 +126,13 @@ autoPatchelfFile() { autoPatchelf() { echo "automatically fixing dependencies for ELF files" >&2 - local i IFS=$'\n' cachedDependencies+=( $(find "$out" \! -type d \( -name '*.so' -o -name '*.so.*' \)) ) - for i in $(findElfs "$prefix"); do autoPatchelfFile "$i"; done + local elffile + findElfs "$prefix" | while read -r elffile; do + autoPatchelfFile "$elffile" + done } postInstallHooks+=(autoPatchelf) -- cgit 1.4.1