Commit 23c760b4 authored by Natanael Copa's avatar Natanael Copa
Browse files

abuild: add a cross_compiling helper function

to detect if we cross compile
parent 7bda0cea
...@@ -104,6 +104,10 @@ set_xterm_title() { ...@@ -104,6 +104,10 @@ set_xterm_title() {
fi fi
} }
cross_compiling() {
test "$CBUILD" != "$CHOST" -a -n "$CBUILDROOT"
}
cleanup() { cleanup() {
local i= local i=
set_xterm_title "" set_xterm_title ""
...@@ -118,7 +122,7 @@ cleanup() { ...@@ -118,7 +122,7 @@ cleanup() {
if [ -z "$install_after" ] && [ -n "$uninstall_after" ]; then if [ -z "$install_after" ] && [ -n "$uninstall_after" ]; then
msg "Uninstalling dependencies..." msg "Uninstalling dependencies..."
$SUDO_APK del --quiet $apk_opt_wait $uninstall_after $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" \ $SUDO_APK del --root "$CBUILDROOT" \
--quiet $apk_opt_wait \ --quiet $apk_opt_wait \
$uninstall_after $uninstall_after
...@@ -996,7 +1000,7 @@ trace_apk_deps() { ...@@ -996,7 +1000,7 @@ trace_apk_deps() {
# first check if its provided by same apkbuild # first check if its provided by same apkbuild
grep -q -w "^$i" "$dir"/.provides-so 2>/dev/null && continue 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 || $APK info --quiet --installed "so:$i"; then
autodeps="$autodeps so:$i" autodeps="$autodeps so:$i"
else else
...@@ -1531,7 +1535,7 @@ builddeps() { ...@@ -1531,7 +1535,7 @@ builddeps() {
msg "Analyzing dependencies..." msg "Analyzing dependencies..."
# add depends unless it is a subpackage or package itself # 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 for i in $BUILD_BASE $makedepends_build; do
[ "$pkgname" = "${i%%[<>=]*}" ] && continue [ "$pkgname" = "${i%%[<>=]*}" ] && continue
subpackages_has ${i%%[<>=]*} || builddeps="$builddeps $i" subpackages_has ${i%%[<>=]*} || builddeps="$builddeps $i"
...@@ -1774,8 +1778,10 @@ deps() { ...@@ -1774,8 +1778,10 @@ deps() {
undeps (){ undeps (){
$SUDO_APK del $apk_opt_wait .makedepends-$pkgname $SUDO_APK del $apk_opt_wait .makedepends-$pkgname
[ "$CBUILD" != "$CHOST" -a -n "$CBUILDROOT" ] && if cross_compiling; then
$SUDO_APK del --root "$CBUILDROOT" $apk_opt_wait .makedepends-$pkgname $SUDO_APK del --root "$CBUILDROOT" $apk_opt_wait \
.makedepends-$pkgname
fi
} }
# compat # compat
......
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