Skip to content

Commit

Permalink
Set up cross building support if needed for docker builds
Browse files Browse the repository at this point in the history
This is similar to what we do in the kiwi case.
  • Loading branch information
mlschroe committed Aug 29, 2024
1 parent 6b13b01 commit ec45dec
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions build-recipe-docker
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ recipe_setup_docker() {
fi
fi
chown -hR "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT$TOPDIR"
if test -z "$ABUILD_TARGET"; then
ABUILD_TARGET=$(queryconfig target --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH" )
test -z "$ABUILD_TARGET" || echo "build target is $ABUILD_TARGET"
fi
}

recipe_prepare_docker() {
Expand Down Expand Up @@ -239,6 +243,20 @@ recipe_build_docker() {
mv "$BUILD_ROOT/$TOPDIR/SOURCES/.$RECIPEFILE" "$BUILD_ROOT/$TOPDIR/SOURCES/$RECIPEFILE"
test -n "$DISTURL" && echo "LABEL org.openbuildservice.disturl=$DISTURL" >> "$BUILD_ROOT/$TOPDIR/SOURCES/$RECIPEFILE"

# setup binfmt handler for cross builds
if test -n "$ABUILD_TARGET" ; then
local target="${ABUILD_TARGET%%-*}"
if test -n "$target" && ! check_native_arch "$target" ; then
local initvm=/usr/lib/build/initvm.`uname -m`
if test -x $initvm ; then
echo "setting up cross building support"
$initvm
else
echo "warning: $initvm is missing, cross building may not work"
fi
fi
fi

# now do the build
squashopt=--squash
if test -n "$(perl -I$BUILD_DIR -MBuild::Docker -e Build::Docker::show -- "$BUILD_ROOT/$TOPDIR/SOURCES/$RECIPEFILE" nosquash)" ; then
Expand Down

0 comments on commit ec45dec

Please sign in to comment.