[pacman-dev] [PATCH 1/3] makepkg: allow debug package suffix to be configurable

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


Signed-off-by: Allan McRae <allan at archlinux.org>
---
 configure.ac          |  8 ++++++++
 scripts/Makefile.am   |  1 +
 scripts/makepkg.sh.in | 30 +++++++++++++++---------------
 3 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/configure.ac b/configure.ac
index 036dda2..48aa4c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -97,6 +97,11 @@ AC_ARG_WITH(buildscript,
 	AS_HELP_STRING([--with-buildscript=name], [set the build script name used by makepkg]),
 	[BUILDSCRIPT=$withval], [BUILDSCRIPT=PKGBUILD])
 
+# Help line for debug package suffix
+AC_ARG_WITH(debug-suffix,
+	AS_HELP_STRING([--with-debux-suffix=name], [set the suffix for split debugging symbol packages used by makepkg]),
+	[DEBUGSUFFIX=$withval], [DEBUGSUFFIX=debug])
+
 # Help line for changing shell used to run install scriptlets
 AC_ARG_WITH(scriptlet-shell,
 	AS_HELP_STRING([--with-scriptlet-shell=shell],
@@ -425,6 +430,9 @@ AC_DEFINE_UNQUOTED([SRCEXT], "$SRCEXT", [The file extension used by pacman sourc
 # Set makepkg build script name
 AC_SUBST(BUILDSCRIPT)
 AC_DEFINE_UNQUOTED([BUILDSCRIPT], "$BUILDSCRIPT", [The build script name used by makepkg])
+# Set makepkg split debugging symbol package suffix
+AC_SUBST(DEBUGSUFFIX)
+AC_DEFINE_UNQUOTED([DEBUGSUFFIX], "$DEBUGSUFFIX", [The suffix for debugging symbol packages used by makepkg])
 # Set shell used by install scriptlets
 AC_SUBST(SCRIPTLET_SHELL)
 AC_DEFINE_UNQUOTED([SCRIPTLET_SHELL], "$SCRIPTLET_SHELL", [The shell used to run install scriptlets])
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 29c81aa..2bd6411 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -53,6 +53,7 @@ edit = sed \
 	-e 's|@PACKAGE_BUGREPORT[@]|$(PACKAGE_BUGREPORT)|g' \
 	-e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
 	-e 's|@BUILDSCRIPT[@]|$(BUILDSCRIPT)|g' \
+	-e 's|@DEBUGSUFFIX[@]|$(DEBUGSUFFIX)|g' \
 	-e "s|@INODECMD[@]|$(INODECMD)|g" \
 	-e 's|@SIZECMD[@]|$(SIZECMD)|g' \
 	-e 's|@SEDINPLACE[@]|$(SEDINPLACE)|g' \
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 337ada9..bb2391f 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1438,38 +1438,38 @@ strip_file() {
 
 		# has this file already been stripped
 		if [[ -n "$bid" ]]; then
-			if [[ -f "$pkgdir-debug"/usr/lib/debug/.build_id/${bid:0:2}/${bid:2}.debug ]]; then
+			if [[ -f "$pkgdir- at DEBUGSUFFIX@"/usr/lib/debug/.build_id/${bid:0:2}/${bid:2}.debug ]]; then
 				return
 			fi
-		elif [[ -f "$pkgdir-debug/usr/lib/debug/$binary.debug" ]]; then
+		elif [[ -f "$pkgdir- at DEBUGSUFFIX@/usr/lib/debug/$binary.debug" ]]; then
 			return
 		fi
 
-		mkdir -p "$pkgdir-debug/usr/lib/debug/${binary%/*}"
-		objcopy --only-keep-debug "$binary" "$pkgdir-debug/usr/lib/debug/$binary.debug"
-		objcopy --add-gnu-debuglink="$pkgdir-debug/usr/lib/debug/${binary#/}.debug" "$binary"
+		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"
 
 		# create any needed hardlinks
 		while read -d '' file ; do
 			if [[ "${binary}" -ef "${file}" &&
-					! -f "$pkgdir-debug/usr/lib/debug/${file}.debug" ]]; then
-				mkdir -p "$pkgdir-debug/usr/lib/debug/${file%/*}"
-				ln "$pkgdir-debug/usr/lib/debug/${binary}.debug" \
-						"$pkgdir-debug/usr/lib/debug/${file}.debug"
+					! -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"
 			fi
 		done < <(find . -type f -perm -u+w -print0 2>/dev/null)
 
 		if [[ -n "$bid" ]]; then
 			local target
-			mkdir -p "$pkgdir-debug/usr/lib/debug/.build_id/${bid:0:2}"
+			mkdir -p "$pkgdir- at DEBUGSUFFIX@/usr/lib/debug/.build_id/${bid:0:2}"
 
 			target="../../../../../${binary#./}"
 			target="${target/..\/..\/usr\/lib\/}"
 			target="${target/..\/usr\/}"
-			ln -s "$target" "$pkgdir-debug/usr/lib/debug/.build_id/${bid:0:2}/${bid:2}"
+			ln -s "$target" "$pkgdir- at DEBUGSUFFIX@/usr/lib/debug/.build_id/${bid:0:2}/${bid:2}"
 
 			target="../../${binary#./}.debug"
-			ln -s "$target" "$pkgdir-debug/usr/lib/debug/.build_id/${bid:0:2}/${bid:2}.debug"
+			ln -s "$target" "$pkgdir- at DEBUGSUFFIX@/usr/lib/debug/.build_id/${bid:0:2}/${bid:2}.debug"
 		fi
 	fi
 
@@ -1532,7 +1532,7 @@ tidy_install() {
 		[[ -z ${STRIP_STATIC+x} ]] && STRIP_STATIC="-S"
 
 		if check_option "debug" "y"; then
-			mkdir -p $pkgdir-debug/usr/lib/debug
+			mkdir -p $pkgdir- at DEBUGSUFFIX@/usr/lib/debug
 		fi
 
 		local binary strip_flags
@@ -1876,7 +1876,7 @@ create_debug_package() {
 		return
 	fi
 
-	pkgdir="${pkgdir}-debug"
+	pkgdir="${pkgdir}- at DEBUGSUFFIX@"
 
 	# check if we have any debug symbols to package
 	if dir_is_empty "$pkgdir/usr/lib/debug"; then
@@ -1885,7 +1885,7 @@ create_debug_package() {
 
 	depends=("$pkgname=$(get_full_version)")
 	pkgdesc="Detached debugging symbols for $pkgname"
-	pkgname=$pkgname-debug
+	pkgname=$pkgname- at DEBUGSUFFIX@
 
 	unset groups optdepends provides conflicts replaces backup install changelog
 
-- 
1.7.12.1



More information about the pacman-dev mailing list