From dbbe3e7cb4ad2ebc45d12acf4427635142165e6e Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sat, 29 Sep 2012 16:44:36 +1000 Subject: makepkg: assign debugging symbol directory to a variable Simplifies the stripping of files a lot. Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 915ee897..9c98d7eb 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -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 -- cgit v1.2.3-70-g09d2