Commit cf86b458 authored by Natanael Copa's avatar Natanael Copa

abuild: cleanup default_dbg

Run the loop in a subshell via a pipe so we dont need a subshell for
each iteration.

Use `if ...; then` to make code slightly more readable.

Fix a whitespace before tab while at it.
parent acf1fa55
......@@ -1676,27 +1676,25 @@ doc() {
# predefined splitfunc dbg
default_dbg() {
local ddbg_binfiles f ddbg_srcdir ddbg_srcfile ddbg_dstdir ddbg_dstfile
local f
pkgdesc="$pkgdesc (debug symbols)"
ddbg_binfiles=$(scanelf -R "$pkgdir" | grep ET_DYN | sed "s:$pkgdir\/::g" | sed "s:ET_DYN ::g")
for f in $ddbg_binfiles; do
ddbg_srcdir=$(dirname "$pkgdir/$f")
ddbg_srcfile=$(basename "$pkgdir/$f")
ddbg_dstdir=$(dirname "$subpkgdir/usr/lib/debug/$f.debug")
ddbg_dstfile=$(basename "$subpkgdir/usr/lib/debug/$f.debug")
[ -d "$ddbg_dstdir" ] || mkdir -p "$ddbg_dstdir"
(
cd "$ddbg_srcdir"
XATTR=$(getfattr --match="" --dump "${ddbg_srcfile}")
${CROSS_COMPILE}objcopy --only-keep-debug "$ddbg_srcfile" "$ddbg_dstfile"
${CROSS_COMPILE}objcopy --add-gnu-debuglink="$ddbg_dstfile" "$ddbg_srcdir/$ddbg_srcfile"
mv "$ddbg_dstfile" "$ddbg_dstdir"
${CROSS_COMPILE}strip "$ddbg_srcfile"
[ -n "$XATTR" ] && { echo "$XATTR" | setfattr --restore=-; }
exit 0
)
scanelf -R "$pkgdir" | grep ET_DYN | sed "s:$pkgdir\/::g" | sed "s:ET_DYN ::g" | while read f; do
local ddbg_srcdir=$(dirname "$pkgdir/$f")
local ddbg_srcfile=$(basename "$pkgdir/$f")
local ddbg_dstdir=$(dirname "$subpkgdir/usr/lib/debug/$f.debug")
local ddbg_dstfile=$(basename "$subpkgdir/usr/lib/debug/$f.debug")
mkdir -p "$ddbg_dstdir"
cd "$ddbg_srcdir"
local xattr=$(getfattr --match="" --dump "${ddbg_srcfile}")
${CROSS_COMPILE}objcopy --only-keep-debug "$ddbg_srcfile" "$ddbg_dstfile"
${CROSS_COMPILE}objcopy --add-gnu-debuglink="$ddbg_dstfile" "$ddbg_srcdir/$ddbg_srcfile"
mv "$ddbg_dstfile" "$ddbg_dstdir"
${CROSS_COMPILE}strip "$ddbg_srcfile"
if [ -n "$xattr" ]; then
echo "$xattr" | setfattr --restore=-
fi
done
return 0
}
......@@ -1720,7 +1718,7 @@ default_dev() {
usr/share/qt*/mkspecs \
usr/lib/qt*/mkspecs \
usr/lib/cmake \
$(find . -name include -type d) \
$(find . -name include -type d) \
$([ -z "${subpackages##*$pkgname-static*}" ] && find $libdirs \
-name '*.a' 2>/dev/null) \
$(find $libdirs -name '*.[cho]' \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment