[pacman-dev] [PATCH 2/3] makepkg: assign debugging symbol directory to a variable

Allan McRae allan at archlinux.org
Sat Sep 29 03:12:34 EDT 2012


Simplifies the stripping of files a lot.

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 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 bb2391f..d36995a 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- at 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- at DEBUGSUFFIX@/usr/lib/debug/$binary.debug" ]]; then
+		elif [[ -f "$dbgdir/$binary.debug" ]]; then
 			return
 		fi
 
-		mkdir -p "$pkgdir- at DEBUGSUFFIX@/usr/lib/debug/${binary%/*}"
-		objcopy --only-keep-debug "$binary" "$pkgdir- at DEBUGSUFFIX@/usr/lib/debug/$binary.debug"
-		objcopy --add-gnu-debuglink="$pkgdir- at 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- at DEBUGSUFFIX@/usr/lib/debug/${file}.debug" ]]; then
-				mkdir -p "$pkgdir- at DEBUGSUFFIX@/usr/lib/debug/${file%/*}"
-				ln "$pkgdir- at DEBUGSUFFIX@/usr/lib/debug/${binary}.debug" \
-						"$pkgdir- at 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- at 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- at 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- at 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- at DEBUGSUFFIX@/usr/lib/debug
+			dbgdir="$pkgdir- at DEBUGSUFFIX@/usr/lib/debug"
+			mkdir -p "$dbgdir"
 		fi
 
 		local binary strip_flags
-- 
1.7.12.1



More information about the pacman-dev mailing list