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

abuild: add a cross_compiling helper function

to detect if we cross compile
parent 7bda0cea
......@@ -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
......
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