From f459607da762d2b574583939ff2bb834d66a47f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Mon, 25 Jul 2016 05:50:20 +0000 Subject: abuild: use proper strip for each subpkg according to it's arch --- abuild.in | 23 ++++++++++++----------- functions.sh.in | 1 + 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/abuild.in b/abuild.in index 5cd1adc..6fcdb4c 100644 --- a/abuild.in +++ b/abuild.in @@ -132,13 +132,6 @@ default_sanitycheck() { esac 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 local n=${i%.*} local suff=${i##*.} @@ -1502,10 +1495,10 @@ default_dbg() { mkdir -p $dstdir fi cd $srcdir - objcopy --only-keep-debug $srcfile $dstfile - objcopy --add-gnu-debuglink=$dstfile $srcdir/$srcfile + ${CROSS_COMPILE}objcopy --only-keep-debug $srcfile $dstfile + ${CROSS_COMPILE}objcopy --add-gnu-debuglink=$dstfile $srcdir/$srcfile mv $dstfile $dstdir - strip $srcfile + ${CROSS_COMPILE}strip $srcfile done return 0 } @@ -1934,12 +1927,20 @@ stripbin() { return 0 fi 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" scanelf --recursive --nobanner --etype "ET_DYN,ET_EXEC" . \ | sed -e 's:^ET_DYN ::' -e 's:^ET_EXEC ::' \ | while read filename; do XATTR=$(getfattr --match="" --dump "${filename}") - ${CROSS_COMPILE}strip "${filename}" + "${stripcmd}" "${filename}" [ -n "$XATTR" ] && (echo "$XATTR" | setfattr --restore=-) done } diff --git a/functions.sh.in b/functions.sh.in index 6a24d21..dd57319 100644 --- a/functions.sh.in +++ b/functions.sh.in @@ -106,6 +106,7 @@ readconfig() { [ -z "$CARCH" ] && CARCH="$(hostspec_to_arch $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_LIBC" ] && CTARGET_LIBC="$(hostspec_to_libc $CTARGET)" -- cgit v1.2.3