Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • abuild abuild
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 56
    • Issues 56
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 32
    • Merge requests 32
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • alpinealpine
  • abuildabuild
  • Merge requests
  • !169

abuild: allow three-way cross-compilation

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Justin Klaassen requested to merge jck112/abuild:master into master Oct 23, 2022
  • Overview 3
  • Commits 1
  • Pipelines 5
  • Changes 2

Currently abuild does not work when $CBUILD != $CHOST != $CTARGET, this patch adds support for three-way cross-compilation by introducing a new environment variable, $CTARGET_BUILDROOT, and by tweaking the way host and target dependencies are handled by abuild.

$CBUILDROOT is the sysroot for $CARCH and $CTARGET_BUILDROOT is the sysroot for $CTARGET_ARCH. When performing a two-way cross-targeting build (i.e. $CBUILD == $CHOST && $CHOST != $CTARGET) we continue to set $CBUILDROOT to the sysroot for $CTARGET_ARCH in order to ensure existing aports and scripts continue to work without modifications. However once these changes are pushed to production, main/binutils, main/gcc, and scripts/bootstrap.sh should be updated to use $CTARGET_BUILDROOT instead of $CBUILDROOT in order to support both two-way and three-way cross-compilation.

In order to test these changes the following builds were performed:

1. Running bootstrap.sh for s390x
scripts/bootstrap.sh s390x
2. Building native build-base
APKBUILD="${APORTSDIR}/main/binutils/APKBUILD" \
BOOTSTRAP=nobase \
abuild -f -r
APKBUILD="${APORTSDIR}/main/gcc/APKBUILD" \
BOOTSTRAP=nobase \
abuild -f -r
APKBUILD="${APORTSDIR}/main/build-base/APKBUILD" \
BOOTSTRAP=nobase \
abuild -f -r
3. Building native build-base-s390x
APKBUILD="${APORTSDIR}/main/binutils/APKBUILD" \
BOOTSTRAP=nobase \
CTARGET=s390x \
abuild -f -r
APKBUILD="${APORTSDIR}/main/gcc/APKBUILD" \
BOOTSTRAP=nobase \
CTARGET=s390x \
EXTRADEPENDS_TARGET="musl-dev" \
LANG_ADA=false \
abuild -f -r
APKBUILD="${APORTSDIR}/main/build-base/APKBUILD" \
BOOTSTRAP=nobase \
CTARGET=s390x \
abuild -f -r
4. Building s390x build-base-s390x
APKBUILD="${APORTSDIR}/main/binutils/APKBUILD" \
CTARGET=s390x \
CHOST=s390x \
EXTRADEPENDS_HOST="libgcc libstdc++ musl-dev" \
abuild -f -r
APKBUILD="${APORTSDIR}/main/gcc/APKBUILD" \
CTARGET=s390x \
CHOST=s390x \
EXTRADEPENDS_HOST="libgcc libstdc++ musl-dev" \
LANG_ADA=false \
abuild -f -r
APKBUILD="${APORTSDIR}/main/build-base/APKBUILD" \
CTARGET=s390x \
CHOST=s390x \
EXTRADEPENDS_HOST="libgcc libstdc++ musl-dev" \
abuild -f -r
5. Building aarch64 build-base-s390x1
APKBUILD="${APORTSDIR}/main/binutils/APKBUILD" \
CTARGET=s390x \
CHOST=aarch64 \
EXTRADEPENDS_HOST="libgcc libstdc++ musl-dev" \
abuild -f -r
APKBUILD="${APORTSDIR}/main/gcc/APKBUILD" \
CTARGET=s390x \
CHOST=aarch64 \
EXTRADEPENDS_TARGET="libgcc libstdc++ musl-dev" \
EXTRADEPENDS_HOST="libgcc libstdc++ musl-dev" \
LANG_ADA=false \
abuild -f -r
APKBUILD="${APORTSDIR}/main/build-base/APKBUILD" \
CTARGET=s390x \
CHOST=aarch64 \
EXTRADEPENDS_HOST="libgcc libstdc++ musl-dev" \
abuild -f -r
6. Building s390x build-base-x86_641,2
APKBUILD="${APORTSDIR}/main/binutils/APKBUILD" \
CTARGET=x86_64 \
CHOST=s390x \
CTARGET_BUILDROOT=/ \
EXTRADEPENDS_HOST="libgcc libstdc++ musl-dev" \
abuild -f -r
APKBUILD="${APORTSDIR}/main/gcc/APKBUILD" \
CTARGET=x86_64 \
CHOST=s390x \
CTARGET_BUILDROOT=/ \
EXTRADEPENDS_TARGET="libgcc libstdc++ musl-dev" \
EXTRADEPENDS_HOST="libgcc libstdc++ musl-dev" \
LANG_ADA=false \
abuild -f -r
APKBUILD="${APORTSDIR}/main/build-base/APKBUILD" \
CTARGET=x86_64 \
CHOST=s390x \
CTARGET_BUILDROOT=/ \
EXTRADEPENDS_HOST="libgcc libstdc++ musl-dev" \
abuild -f -r

1 Requires changing $CBUILDROOT to $CTARGET_BUILDROOT in main/binutils and main/gcc.
2 Setting CTARGET_BUILDROOT=/ allows targeting the native arch without having to create a separate sysroot.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: master