1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

makepkg: assign debugging symbol directory to a variable

Simplifies the stripping of files a lot.

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2012-09-29 16:44:36 +10:00
parent 13667fd4b1
commit dbbe3e7cb4

View File

@ -1438,38 +1438,36 @@ strip_file() {
# has this file already been stripped
if [[ -n "$bid" ]]; then
if [[ -f "$pkgdir-@DEBUGSUFFIX@"/usr/lib/debug/.build_id/${bid:0:2}/${bid:2}.debug ]]; then
if [[ -f "$dbgdir/.build_id/${bid:0:2}/${bid:2}.debug" ]]; then
return
fi
elif [[ -f "$pkgdir-@DEBUGSUFFIX@/usr/lib/debug/$binary.debug" ]]; then
elif [[ -f "$dbgdir/$binary.debug" ]]; then
return
fi
mkdir -p "$pkgdir-@DEBUGSUFFIX@/usr/lib/debug/${binary%/*}"
objcopy --only-keep-debug "$binary" "$pkgdir-@DEBUGSUFFIX@/usr/lib/debug/$binary.debug"
objcopy --add-gnu-debuglink="$pkgdir-@DEBUGSUFFIX@/usr/lib/debug/${binary#/}.debug" "$binary"
mkdir -p "$dbgdir/${binary%/*}"
objcopy --only-keep-debug "$binary" "$dbgdir/$binary.debug"
objcopy --add-gnu-debuglink="$dbgdir/${binary#/}.debug" "$binary"
# create any needed hardlinks
while read -d '' file ; do
if [[ "${binary}" -ef "${file}" &&
! -f "$pkgdir-@DEBUGSUFFIX@/usr/lib/debug/${file}.debug" ]]; then
mkdir -p "$pkgdir-@DEBUGSUFFIX@/usr/lib/debug/${file%/*}"
ln "$pkgdir-@DEBUGSUFFIX@/usr/lib/debug/${binary}.debug" \
"$pkgdir-@DEBUGSUFFIX@/usr/lib/debug/${file}.debug"
if [[ "${binary}" -ef "${file}" && ! -f "$dbgdir/${file}.debug" ]]; then
mkdir -p "$dbgdir/${file%/*}"
ln "$dbgdir/${binary}.debug" "$dbgdir/${file}.debug"
fi
done < <(find . -type f -perm -u+w -print0 2>/dev/null)
if [[ -n "$bid" ]]; then
local target
mkdir -p "$pkgdir-@DEBUGSUFFIX@/usr/lib/debug/.build_id/${bid:0:2}"
mkdir -p "$dbgdir/.build_id/${bid:0:2}"
target="../../../../../${binary#./}"
target="${target/..\/..\/usr\/lib\/}"
target="${target/..\/usr\/}"
ln -s "$target" "$pkgdir-@DEBUGSUFFIX@/usr/lib/debug/.build_id/${bid:0:2}/${bid:2}"
ln -s "$target" "$dbgdir/.build_id/${bid:0:2}/${bid:2}"
target="../../${binary#./}.debug"
ln -s "$target" "$pkgdir-@DEBUGSUFFIX@/usr/lib/debug/.build_id/${bid:0:2}/${bid:2}.debug"
ln -s "$target" "$dbgdir/.build_id/${bid:0:2}/${bid:2}.debug"
fi
fi
@ -1532,7 +1530,8 @@ tidy_install() {
[[ -z ${STRIP_STATIC+x} ]] && STRIP_STATIC="-S"
if check_option "debug" "y"; then
mkdir -p $pkgdir-@DEBUGSUFFIX@/usr/lib/debug
dbgdir="$pkgdir-@DEBUGSUFFIX@/usr/lib/debug"
mkdir -p "$dbgdir"
fi
local binary strip_flags