makepkg: package debug source files with options 'debug' and '!strip'
When package software with debug symbols without stripping, we should still process the files with debugedit and include the needed source files in the package. Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
471a030466
commit
fcb1d4f87e
1 changed files with 27 additions and 10 deletions
|
@ -52,6 +52,20 @@ source_files() {
|
||||||
| sort -zu | tr '\0' '\n'
|
| sort -zu | tr '\0' '\n'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
package_source_files() {
|
||||||
|
local binary=$1
|
||||||
|
|
||||||
|
local file dest t
|
||||||
|
while IFS= read -r t; do
|
||||||
|
file="${srcdir}/${t}"
|
||||||
|
dest="${dbgsrc}/${t}"
|
||||||
|
mkdir -p "${dest%/*}"
|
||||||
|
if [[ -f "$file" ]]; then
|
||||||
|
cp -- "$file" "$dest"
|
||||||
|
fi
|
||||||
|
done < <(source_files "$binary")
|
||||||
|
}
|
||||||
|
|
||||||
strip_file() {
|
strip_file() {
|
||||||
local binary=$1; shift
|
local binary=$1; shift
|
||||||
|
|
||||||
|
@ -68,15 +82,7 @@ strip_file() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# copy source files to debug directory
|
# copy source files to debug directory
|
||||||
local file dest t
|
package_source_files "$binary"
|
||||||
while IFS= read -r t; do
|
|
||||||
file="${srcdir}/${t}"
|
|
||||||
dest="${dbgsrc}/${t}"
|
|
||||||
mkdir -p "${dest%/*}"
|
|
||||||
if [[ -f "$file" ]]; then
|
|
||||||
cp -- "$file" "$dest"
|
|
||||||
fi
|
|
||||||
done < <(source_files "$binary")
|
|
||||||
|
|
||||||
# copy debug symbols to debug directory
|
# copy debug symbols to debug directory
|
||||||
mkdir -p "$dbgdir/${binary%/*}"
|
mkdir -p "$dbgdir/${binary%/*}"
|
||||||
|
@ -139,7 +145,6 @@ tidy_strip() {
|
||||||
[[ -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
|
||||||
|
|
||||||
dbgdir="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@/usr/lib/debug"
|
dbgdir="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@/usr/lib/debug"
|
||||||
dbgsrcdir="${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
|
dbgsrcdir="${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
|
||||||
dbgsrc="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@$dbgsrcdir"
|
dbgsrc="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@$dbgsrcdir"
|
||||||
|
@ -172,5 +177,17 @@ tidy_strip() {
|
||||||
strip_file "$binary" ${strip_flags}
|
strip_file "$binary" ${strip_flags}
|
||||||
(( STRIPLTO )) && strip_lto "$binary"
|
(( STRIPLTO )) && strip_lto "$binary"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
elif check_option "debug" "y"; then
|
||||||
|
msg2 "$(gettext "Copying source files needed for debug symbols...")"
|
||||||
|
|
||||||
|
dbgsrcdir="${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
|
||||||
|
dbgsrc="$pkgdirbase/$pkgbase/$dbgsrcdir"
|
||||||
|
mkdir -p "$dbgsrc"
|
||||||
|
|
||||||
|
local binary
|
||||||
|
find . -type f -perm -u+w -print0 2>/dev/null | while IFS= read -rd '' binary ; do
|
||||||
|
package_source_files "$binary" 2>/dev/null
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue