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() { ...@@ -1676,27 +1676,25 @@ doc() {
# predefined splitfunc dbg # predefined splitfunc dbg
default_dbg() { default_dbg() {
local ddbg_binfiles f ddbg_srcdir ddbg_srcfile ddbg_dstdir ddbg_dstfile local f
pkgdesc="$pkgdesc (debug symbols)" pkgdesc="$pkgdesc (debug symbols)"
ddbg_binfiles=$(scanelf -R "$pkgdir" | grep ET_DYN | sed "s:$pkgdir\/::g" | sed "s:ET_DYN ::g") scanelf -R "$pkgdir" | grep ET_DYN | sed "s:$pkgdir\/::g" | sed "s:ET_DYN ::g" | while read f; do
for f in $ddbg_binfiles; do local ddbg_srcdir=$(dirname "$pkgdir/$f")
ddbg_srcdir=$(dirname "$pkgdir/$f") local ddbg_srcfile=$(basename "$pkgdir/$f")
ddbg_srcfile=$(basename "$pkgdir/$f") local ddbg_dstdir=$(dirname "$subpkgdir/usr/lib/debug/$f.debug")
ddbg_dstdir=$(dirname "$subpkgdir/usr/lib/debug/$f.debug") local ddbg_dstfile=$(basename "$subpkgdir/usr/lib/debug/$f.debug")
ddbg_dstfile=$(basename "$subpkgdir/usr/lib/debug/$f.debug") mkdir -p "$ddbg_dstdir"
[ -d "$ddbg_dstdir" ] || mkdir -p "$ddbg_dstdir"
cd "$ddbg_srcdir"
( local xattr=$(getfattr --match="" --dump "${ddbg_srcfile}")
cd "$ddbg_srcdir" ${CROSS_COMPILE}objcopy --only-keep-debug "$ddbg_srcfile" "$ddbg_dstfile"
XATTR=$(getfattr --match="" --dump "${ddbg_srcfile}") ${CROSS_COMPILE}objcopy --add-gnu-debuglink="$ddbg_dstfile" "$ddbg_srcdir/$ddbg_srcfile"
${CROSS_COMPILE}objcopy --only-keep-debug "$ddbg_srcfile" "$ddbg_dstfile" mv "$ddbg_dstfile" "$ddbg_dstdir"
${CROSS_COMPILE}objcopy --add-gnu-debuglink="$ddbg_dstfile" "$ddbg_srcdir/$ddbg_srcfile" ${CROSS_COMPILE}strip "$ddbg_srcfile"
mv "$ddbg_dstfile" "$ddbg_dstdir" if [ -n "$xattr" ]; then
${CROSS_COMPILE}strip "$ddbg_srcfile" echo "$xattr" | setfattr --restore=-
[ -n "$XATTR" ] && { echo "$XATTR" | setfattr --restore=-; } fi
exit 0
)
done done
return 0 return 0
} }
...@@ -1720,7 +1718,7 @@ default_dev() { ...@@ -1720,7 +1718,7 @@ default_dev() {
usr/share/qt*/mkspecs \ usr/share/qt*/mkspecs \
usr/lib/qt*/mkspecs \ usr/lib/qt*/mkspecs \
usr/lib/cmake \ usr/lib/cmake \
$(find . -name include -type d) \ $(find . -name include -type d) \
$([ -z "${subpackages##*$pkgname-static*}" ] && find $libdirs \ $([ -z "${subpackages##*$pkgname-static*}" ] && find $libdirs \
-name '*.a' 2>/dev/null) \ -name '*.a' 2>/dev/null) \
$(find $libdirs -name '*.[cho]' \ $(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