From 23c760b499ff4505f1bf8072c918e01c863bff94 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 5 Sep 2013 08:40:59 +0000 Subject: abuild: add a cross_compiling helper function to detect if we cross compile --- abuild.in | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/abuild.in b/abuild.in index b70966d..db65835 100755 --- a/abuild.in +++ b/abuild.in @@ -104,6 +104,10 @@ set_xterm_title() { fi } +cross_compiling() { + test "$CBUILD" != "$CHOST" -a -n "$CBUILDROOT" +} + cleanup() { local i= set_xterm_title "" @@ -118,7 +122,7 @@ cleanup() { if [ -z "$install_after" ] && [ -n "$uninstall_after" ]; then msg "Uninstalling dependencies..." $SUDO_APK del --quiet $apk_opt_wait $uninstall_after - if [ "$CBUILD" != "$CHOST" -a -n "$CBUILDROOT" ]; then + if cross_compiling; then $SUDO_APK del --root "$CBUILDROOT" \ --quiet $apk_opt_wait \ $uninstall_after @@ -996,7 +1000,7 @@ trace_apk_deps() { # first check if its provided by same apkbuild grep -q -w "^$i" "$dir"/.provides-so 2>/dev/null && continue - if subpkg_provides "$i" || [ "$CBUILD" != "$CHOST" ] \ + if subpkg_provides "$i" || cross_compiling \ || $APK info --quiet --installed "so:$i"; then autodeps="$autodeps so:$i" else @@ -1531,7 +1535,7 @@ builddeps() { msg "Analyzing dependencies..." # add depends unless it is a subpackage or package itself - if [ "$CBUILD" != "$CHOST" -a -n "$CBUILDROOT" ] && [ -n "$makedepends_build" -o -n "$makedepends_host" ]; then + if cross_compiling && [ -n "$makedepends_build" -o -n "$makedepends_host" ]; then for i in $BUILD_BASE $makedepends_build; do [ "$pkgname" = "${i%%[<>=]*}" ] && continue subpackages_has ${i%%[<>=]*} || builddeps="$builddeps $i" @@ -1774,8 +1778,10 @@ deps() { undeps (){ $SUDO_APK del $apk_opt_wait .makedepends-$pkgname - [ "$CBUILD" != "$CHOST" -a -n "$CBUILDROOT" ] && - $SUDO_APK del --root "$CBUILDROOT" $apk_opt_wait .makedepends-$pkgname + if cross_compiling; then + $SUDO_APK del --root "$CBUILDROOT" $apk_opt_wait \ + .makedepends-$pkgname + fi } # compat -- cgit v1.2.3-60-g2f50