summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2013-09-05 08:40:59 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2013-09-06 11:04:14 +0000
commit23c760b499ff4505f1bf8072c918e01c863bff94 (patch)
treeb92954904cf0e5c04ad1f83ef9cb6b2e981c80f4
parent7bda0ceadb8435982e2402bae05eb77fb167570e (diff)
downloadabuild-23c760b499ff4505f1bf8072c918e01c863bff94.tar.gz
abuild-23c760b499ff4505f1bf8072c918e01c863bff94.tar.bz2
abuild-23c760b499ff4505f1bf8072c918e01c863bff94.tar.xz
abuild-23c760b499ff4505f1bf8072c918e01c863bff94.zip
abuild: add a cross_compiling helper function
to detect if we cross compile
-rwxr-xr-xabuild.in16
1 files 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