From df9a8d021d538c438c8fcfdd9fc12b50c63b5a1d Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Thu, 17 Mar 2022 15:28:38 +0100 Subject: [PATCH] Add debian cross build support --- build-pkg-deb | 23 +++++++++++++++++++++++ build-recipe-dsc | 12 ++++++++++++ 2 files changed, 35 insertions(+) diff --git a/build-pkg-deb b/build-pkg-deb index bac42e80e..0f15eb217 100644 --- a/build-pkg-deb +++ b/build-pkg-deb @@ -180,6 +180,29 @@ pkg_runscripts_deb() { fi } +pkg_sysrootinstall_deb() { + if test "x$1" = "x--prepare" ; then + assert_dir_path "$BUILD_SYSROOT" + chroot $BUILD_ROOT mkdir -p "$BUILD_SYSROOT" + local target=$(queryconfig target --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH") + if test -n "$target" ; then + local debarch=$(deb_chroot $BUILD_ROOT dpkg-architecture -q DEB_HOST_ARCH --host-type "$target") + if test -n "$debarch" ; then + echo "Adding architecture $debarch" + deb_chroot $BUILD_ROOT dpkg --add-architecture "$debarch" + fi + fi + return + fi + if test "x$1" = "x--finalize" ; then + return + fi + + ( deb_chroot $BUILD_ROOT dpkg --install $DEB_UNSAFE_IO --force-depends .init_b_cache/$PKG.deb 2>&1 || touch $BUILD_ROOT/exit ) | \ + perl -ne '$|=1;/^(Configuration file|Installing new config file|Selecting previously deselected|Selecting previously unselected|\(Reading database|Unpacking |Setting up|Creating config file|Preparing to replace dpkg|Preparing to unpack )/||/^$/||print' +} + + # Local Variables: # mode: Shell-script # End: diff --git a/build-recipe-dsc b/build-recipe-dsc index 9aa256339..5467d4681 100644 --- a/build-recipe-dsc +++ b/build-recipe-dsc @@ -158,6 +158,18 @@ dsc_build() { DSC_BUILD_CMD="source $TOPDIR/SOURCES/build.script" chmod +x $buildroot/$TOPDIR/SOURCES/build.script fi + 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 + if test -n "$ABUILD_TARGET" ; then + DSC_BUILD_CMD="$DSC_BUILD_CMD --host-type $ABUILD_TARGET" + fi + if test -n "$ABUILD_TARGET" -a -d "$BUILD_ROOT/.build.sysroot" ; then + DSC_BUILD_CMD="$DSC_BUILD_CMD -Pcross,nocheck" + DSC_BUILD_OPTIONS="$DSC_BUILD_OPTIONS nocheck" + DSC_BUILD_OPTIONS="${DSC_BUILD_OPTIONS# }" + fi chroot $buildroot su -c "export DEB_BUILD_OPTIONS=${DSC_BUILD_OPTIONS} ; cd $TOPDIR/BUILD && $DSC_BUILD_CMD" - $BUILD_USER < /dev/null && BUILD_SUCCEEDED=true if test "$BUILD_SUCCEEDED" = true -a "$DO_CHECKS" != "false" && ( chroot $buildroot su -c "which lintian > /dev/null" - $BUILD_USER < /dev/null ); then