From b8a21aa918e97bc9bc050afdfd28a81da3f1bd9a Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 21 Sep 2017 01:33:00 -0400 Subject: [PATCH] misc setup-hooks: Use env vars to refer to binutils programs This is more robust for cross-compilation --- pkgs/build-support/setup-hooks/separate-debug-info.sh | 6 +++--- pkgs/build-support/setup-hooks/strip.sh | 2 +- pkgs/build-support/setup-hooks/win-dll-link.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/build-support/setup-hooks/separate-debug-info.sh b/pkgs/build-support/setup-hooks/separate-debug-info.sh index c90d2cd52013..19dbb10d18e7 100644 --- a/pkgs/build-support/setup-hooks/separate-debug-info.sh +++ b/pkgs/build-support/setup-hooks/separate-debug-info.sh @@ -19,7 +19,7 @@ _separateDebugInfo() { if ! isELF "$i"; then continue; fi # Extract the Build ID. FIXME: there's probably a cleaner way. - local id="$(readelf -n "$i" | sed 's/.*Build ID: \([0-9a-f]*\).*/\1/; t; d')" + local id="$($READELF -n "$i" | sed 's/.*Build ID: \([0-9a-f]*\).*/\1/; t; d')" if [ "${#id}" != 40 ]; then echo "could not find build ID of $i, skipping" >&2 continue @@ -28,8 +28,8 @@ _separateDebugInfo() { # Extract the debug info. header "separating debug info from $i (build ID $id)" mkdir -p "$dst/${id:0:2}" - objcopy --only-keep-debug "$i" "$dst/${id:0:2}/${id:2}.debug" - strip --strip-debug "$i" + $OBJCOPY --only-keep-debug "$i" "$dst/${id:0:2}/${id:2}.debug" + $STRIP --strip-debug "$i" # Also a create a symlink .debug. ln -sfn ".build-id/${id:0:2}/${id:2}.debug" "$dst/../$(basename "$i")" diff --git a/pkgs/build-support/setup-hooks/strip.sh b/pkgs/build-support/setup-hooks/strip.sh index 0bf37e10d870..a33968ca18de 100644 --- a/pkgs/build-support/setup-hooks/strip.sh +++ b/pkgs/build-support/setup-hooks/strip.sh @@ -30,7 +30,7 @@ stripDirs() { if [ -n "${dirs}" ]; then header "stripping (with flags $stripFlags) in$dirs" - find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} strip $commonStripFlags $stripFlags 2>/dev/null || true + find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} $STRIP $commonStripFlags $stripFlags 2>/dev/null || true stopNest fi } diff --git a/pkgs/build-support/setup-hooks/win-dll-link.sh b/pkgs/build-support/setup-hooks/win-dll-link.sh index 9658b9f82595..6130f32bef86 100644 --- a/pkgs/build-support/setup-hooks/win-dll-link.sh +++ b/pkgs/build-support/setup-hooks/win-dll-link.sh @@ -25,7 +25,7 @@ _linkDLLs() { linkCount=0 # Iterate over any DLL that we depend on. local dll - for dll in $(objdump -p *.{exe,dll} | sed -n 's/.*DLL Name: \(.*\)/\1/p' | sort -u); do + for dll in $($OBJDUMP -p *.{exe,dll} | sed -n 's/.*DLL Name: \(.*\)/\1/p' | sort -u); do if [ -e "./$dll" ]; then continue; fi # Locate the DLL - it should be an *executable* file on $DLLPATH. local dllPath="$(PATH="$DLLPATH" type -P "$dll")"