misc setup-hooks: Use env vars to refer to binutils programs
This is more robust for cross-compilation
This commit is contained in:
parent
91ca46f693
commit
b8a21aa918
@ -19,7 +19,7 @@ _separateDebugInfo() {
|
|||||||
if ! isELF "$i"; then continue; fi
|
if ! isELF "$i"; then continue; fi
|
||||||
|
|
||||||
# Extract the Build ID. FIXME: there's probably a cleaner way.
|
# 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
|
if [ "${#id}" != 40 ]; then
|
||||||
echo "could not find build ID of $i, skipping" >&2
|
echo "could not find build ID of $i, skipping" >&2
|
||||||
continue
|
continue
|
||||||
@ -28,8 +28,8 @@ _separateDebugInfo() {
|
|||||||
# Extract the debug info.
|
# Extract the debug info.
|
||||||
header "separating debug info from $i (build ID $id)"
|
header "separating debug info from $i (build ID $id)"
|
||||||
mkdir -p "$dst/${id:0:2}"
|
mkdir -p "$dst/${id:0:2}"
|
||||||
objcopy --only-keep-debug "$i" "$dst/${id:0:2}/${id:2}.debug"
|
$OBJCOPY --only-keep-debug "$i" "$dst/${id:0:2}/${id:2}.debug"
|
||||||
strip --strip-debug "$i"
|
$STRIP --strip-debug "$i"
|
||||||
|
|
||||||
# Also a create a symlink <original-name>.debug.
|
# Also a create a symlink <original-name>.debug.
|
||||||
ln -sfn ".build-id/${id:0:2}/${id:2}.debug" "$dst/../$(basename "$i")"
|
ln -sfn ".build-id/${id:0:2}/${id:2}.debug" "$dst/../$(basename "$i")"
|
||||||
|
@ -30,7 +30,7 @@ stripDirs() {
|
|||||||
|
|
||||||
if [ -n "${dirs}" ]; then
|
if [ -n "${dirs}" ]; then
|
||||||
header "stripping (with flags $stripFlags) in$dirs"
|
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
|
stopNest
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ _linkDLLs() {
|
|||||||
linkCount=0
|
linkCount=0
|
||||||
# Iterate over any DLL that we depend on.
|
# Iterate over any DLL that we depend on.
|
||||||
local dll
|
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
|
if [ -e "./$dll" ]; then continue; fi
|
||||||
# Locate the DLL - it should be an *executable* file on $DLLPATH.
|
# Locate the DLL - it should be an *executable* file on $DLLPATH.
|
||||||
local dllPath="$(PATH="$DLLPATH" type -P "$dll")"
|
local dllPath="$(PATH="$DLLPATH" type -P "$dll")"
|
||||||
|
Loading…
Reference in New Issue
Block a user