rootbld: foreign arch build with QEMU user mode

This commit is contained in:
Kaarle Ritvanen 2021-06-09 17:43:18 +03:00 committed by Natanael Copa
parent 22ff0df215
commit 91c4bc018d
1 changed files with 13 additions and 3 deletions

View File

@ -2355,9 +2355,12 @@ rootbld() {
return
fi
[ "$CBUILD" = "$CHOST" ] || die "rootbld: cross-building not supported currently"
apk info -eq abuild-rootbld || die "rootbld: abuild-rootbld package not installed"
[ $CBUILD = $CHOST ] || die "rootbld: set CBUILD=$CHOST to build for $CHOST"
[ $CBUILD_ARCH = "$(apk --print-arch)" -o -f /proc/sys/fs/binfmt_misc/qemu-${CBUILD_ARCH/arm*/arm} ] || \
die "rootbld: binfmt registration missing for $CBUILD_ARCH binaries"
logcmd "chroot building building $repo/$pkgname-$pkgver-r$pkgrel"
# check early if we have abuild key
@ -2387,7 +2390,11 @@ rootbld() {
"$srcdir"
cp /etc/abuild.conf /etc/group /etc/passwd "$BUILD_ROOT/etc"
cp /etc/apk/keys/* "$BUILD_ROOT/etc/apk/keys"
local dir
for dir in /usr/share/apk/keys/$CBUILD_ARCH /etc/apk/keys; do
cp $dir/* "$BUILD_ROOT/etc/apk/keys"
done
if options_has "net"; then
cp /etc/resolv.conf "$BUILD_ROOT/etc"
@ -2415,7 +2422,9 @@ rootbld() {
) < "$repo_template" > "$BUILD_ROOT/etc/apk/repositories"
calcdeps
$SUDO_APK add --initdb --root "$BUILD_ROOT" --update \
$SUDO_APK add --initdb --update \
--arch $CBUILD_ARCH \
--root "$BUILD_ROOT" \
abuild alpine-base build-base git $hostdeps $builddeps \
${USE_CCACHE:+ccache}
@ -2438,6 +2447,7 @@ rootbld() {
--chdir "$startdir" \
--setenv PATH ${USE_CCACHE:+/usr/lib/ccache/bin:}/bin:/usr/bin:/sbin:/usr/sbin \
--setenv FAKEROOTDONTTRYCHOWN 1 \
--unsetenv CBUILD \
/usr/bin/abuild $force rootbld_actions
update_abuildrepo_index
cleanup $CLEANUP