1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-23 00:08: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 # has this file already been stripped
if [[ -n "$bid" ]]; then 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 return
fi fi
elif [[ -f "$pkgdir-@DEBUGSUFFIX@/usr/lib/debug/$binary.debug" ]]; then elif [[ -f "$dbgdir/$binary.debug" ]]; then
return return
fi fi
mkdir -p "$pkgdir-@DEBUGSUFFIX@/usr/lib/debug/${binary%/*}" mkdir -p "$dbgdir/${binary%/*}"
objcopy --only-keep-debug "$binary" "$pkgdir-@DEBUGSUFFIX@/usr/lib/debug/$binary.debug" objcopy --only-keep-debug "$binary" "$dbgdir/$binary.debug"
objcopy --add-gnu-debuglink="$pkgdir-@DEBUGSUFFIX@/usr/lib/debug/${binary#/}.debug" "$binary" objcopy --add-gnu-debuglink="$dbgdir/${binary#/}.debug" "$binary"
# create any needed hardlinks # create any needed hardlinks
while read -d '' file ; do while read -d '' file ; do
if [[ "${binary}" -ef "${file}" && if [[ "${binary}" -ef "${file}" && ! -f "$dbgdir/${file}.debug" ]]; then
! -f "$pkgdir-@DEBUGSUFFIX@/usr/lib/debug/${file}.debug" ]]; then mkdir -p "$dbgdir/${file%/*}"
mkdir -p "$pkgdir-@DEBUGSUFFIX@/usr/lib/debug/${file%/*}" ln "$dbgdir/${binary}.debug" "$dbgdir/${file}.debug"
ln "$pkgdir-@DEBUGSUFFIX@/usr/lib/debug/${binary}.debug" \
"$pkgdir-@DEBUGSUFFIX@/usr/lib/debug/${file}.debug"
fi fi
done < <(find . -type f -perm -u+w -print0 2>/dev/null) done < <(find . -type f -perm -u+w -print0 2>/dev/null)
if [[ -n "$bid" ]]; then if [[ -n "$bid" ]]; then
local target 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="../../../../../${binary#./}"
target="${target/..\/..\/usr\/lib\/}" target="${target/..\/..\/usr\/lib\/}"
target="${target/..\/usr\/}" 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" 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
fi fi
@ -1532,7 +1530,8 @@ tidy_install() {
[[ -z ${STRIP_STATIC+x} ]] && STRIP_STATIC="-S" [[ -z ${STRIP_STATIC+x} ]] && STRIP_STATIC="-S"
if check_option "debug" "y"; then if check_option "debug" "y"; then
mkdir -p $pkgdir-@DEBUGSUFFIX@/usr/lib/debug dbgdir="$pkgdir-@DEBUGSUFFIX@/usr/lib/debug"
mkdir -p "$dbgdir"
fi fi
local binary strip_flags local binary strip_flags