abuild: use proper strip for each subpkg according to it's arch

This commit is contained in:
Timo Teräs 2016-07-25 05:50:20 +00:00
parent b217bbb2ea
commit f459607da7
2 changed files with 13 additions and 11 deletions

View File

@ -132,13 +132,6 @@ default_sanitycheck() {
esac esac
done done
# check if CARCH, CBUILD, CHOST and CTARGET is set
[ -z "$CHOST" ] && die "Please set CHOST in /etc/abuild.conf"
if [ -z "$CARCH" ]; then
die "Please fix CHOST, or set CARCH in abuild.conf"
fi
for i in $install; do for i in $install; do
local n=${i%.*} local n=${i%.*}
local suff=${i##*.} local suff=${i##*.}
@ -1502,10 +1495,10 @@ default_dbg() {
mkdir -p $dstdir mkdir -p $dstdir
fi fi
cd $srcdir cd $srcdir
objcopy --only-keep-debug $srcfile $dstfile ${CROSS_COMPILE}objcopy --only-keep-debug $srcfile $dstfile
objcopy --add-gnu-debuglink=$dstfile $srcdir/$srcfile ${CROSS_COMPILE}objcopy --add-gnu-debuglink=$dstfile $srcdir/$srcfile
mv $dstfile $dstdir mv $dstfile $dstdir
strip $srcfile ${CROSS_COMPILE}strip $srcfile
done done
return 0 return 0
} }
@ -1934,12 +1927,20 @@ stripbin() {
return 0 return 0
fi fi
cd "${subpkgdir:-$pkgdir}" || return 1 cd "${subpkgdir:-$pkgdir}" || return 1
local stripcmd=strip
case "${subpkgarch:-$pkgarch}" in
$CBUILD_ARCH) stripcmd="strip" ;;
$CARCH) stripcmd="${CHOST}-strip" ;;
$CTARGET_ARCH) stripcmd="${CTARGET}-strip" ;;
esac
msg "Stripping binaries" msg "Stripping binaries"
scanelf --recursive --nobanner --etype "ET_DYN,ET_EXEC" . \ scanelf --recursive --nobanner --etype "ET_DYN,ET_EXEC" . \
| sed -e 's:^ET_DYN ::' -e 's:^ET_EXEC ::' \ | sed -e 's:^ET_DYN ::' -e 's:^ET_EXEC ::' \
| while read filename; do | while read filename; do
XATTR=$(getfattr --match="" --dump "${filename}") XATTR=$(getfattr --match="" --dump "${filename}")
${CROSS_COMPILE}strip "${filename}" "${stripcmd}" "${filename}"
[ -n "$XATTR" ] && (echo "$XATTR" | setfattr --restore=-) [ -n "$XATTR" ] && (echo "$XATTR" | setfattr --restore=-)
done done
} }

View File

@ -106,6 +106,7 @@ readconfig() {
[ -z "$CARCH" ] && CARCH="$(hostspec_to_arch $CHOST)" [ -z "$CARCH" ] && CARCH="$(hostspec_to_arch $CHOST)"
[ -z "$CLIBC" ] && CLIBC="$(hostspec_to_libc $CHOST)" [ -z "$CLIBC" ] && CLIBC="$(hostspec_to_libc $CHOST)"
[ -z "$CBUILD_ARCH" ] && CBUILD_ARCH="$(hostspec_to_arch $CBUILD)"
[ -z "$CTARGET_ARCH" ] && CTARGET_ARCH="$(hostspec_to_arch $CTARGET)" [ -z "$CTARGET_ARCH" ] && CTARGET_ARCH="$(hostspec_to_arch $CTARGET)"
[ -z "$CTARGET_LIBC" ] && CTARGET_LIBC="$(hostspec_to_libc $CTARGET)" [ -z "$CTARGET_LIBC" ] && CTARGET_LIBC="$(hostspec_to_libc $CTARGET)"