[pacman-dev] [PATCH 1/3] makepkg: allow debug package suffix to be configurable
Signed-off-by: Allan McRae <allan@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-@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-@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-@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" # 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-@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" 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-@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-@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-@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-@DEBUGSUFFIX@/usr/lib/debug fi local binary strip_flags @@ -1876,7 +1876,7 @@ create_debug_package() { return fi - pkgdir="${pkgdir}-debug" + pkgdir="${pkgdir}-@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-@DEBUGSUFFIX@ unset groups optdepends provides conflicts replaces backup install changelog -- 1.7.12.1
Simplifies the stripping of files a lot. Signed-off-by: Allan McRae <allan@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-@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 -- 1.7.12.1
When using "makepkg -i", install the debugging symbol packages too if present. Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index d36995a..5822843 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -2000,6 +2000,10 @@ install_package() { fullver=$(get_full_version $pkg) pkgarch=$(get_pkg_arch $pkg) pkglist+=("$PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT}") + + if [[ -f "$PKGDEST/${pkg}-debug-${fullver}-${pkgarch}${PKGEXT}" ]]; then + pkglist+=("$PKGDEST/${pkg}-debug-${fullver}-${pkgarch}${PKGEXT}") + fi done if ! run_pacman -U ${pkglist[@]}; then -- 1.7.12.1
participants (1)
-
Allan McRae