mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-07 21:16:57 +02:00
Before, we were relying on the toolchains job to build and upload packages that were part of the SDK. With this change, all packages that should be part of the SDK are built and uploaded by the SDK job. The toolchains job only builds toolchain packages specific for the release. This change includes several adjustments done to both the SDK and the toolchains jobs to make this work: * Make the SDK job build all cross toolchains, including Rust * Stop building Rust in the toolchains job and use the one in the SDK instead. * In toolchain_util.sh: detect when the symlink folder for crossdev packages is missing and run crossdev to create it during update_chroot setup. * Make it possible to build the SDK starting from stage 4 instead of stage 1, to make the SDK building faster for PR branches / nightlies (full build should still be done for releases / weeklies).
57 lines
1.9 KiB
Bash
57 lines
1.9 KiB
Bash
#!/bin/bash
|
|
|
|
set -e
|
|
source /tmp/chroot-functions.sh
|
|
source /tmp/toolchain_util.sh
|
|
|
|
# A note on packages:
|
|
# The default PKGDIR is /usr/portage/packages
|
|
# To make sure things are uploaded to the correct places we split things up:
|
|
# crossdev build packages use ${PKGDIR}/crossdev (uploaded to SDK location)
|
|
# build deps in crossdev's sysroot use ${PKGDIR}/cross/${CHOST} (no upload)
|
|
# native toolchains use ${PKGDIR}/target/${BOARD} (uploaded to board location)
|
|
|
|
configure_target_root() {
|
|
local board="$1"
|
|
local cross_chost=$(get_board_chost "$1")
|
|
local profile=$(get_board_profile "${board}")
|
|
|
|
CBUILD="$(portageq envvar CBUILD)" \
|
|
CHOST="${cross_chost}" \
|
|
ROOT="/build/${board}" \
|
|
SYSROOT="/build/${board}" \
|
|
_configure_sysroot "${profile}"
|
|
}
|
|
|
|
build_target_toolchain() {
|
|
local board="$1"
|
|
local ROOT="/build/${board}"
|
|
local SYSROOT="/usr/$(get_board_chost "${board}")"
|
|
|
|
mkdir -p "${ROOT}/usr"
|
|
cp -at "${ROOT}" "${SYSROOT}"/lib*
|
|
cp -at "${ROOT}"/usr "${SYSROOT}"/usr/include "${SYSROOT}"/usr/lib*
|
|
|
|
# --root is required because run_merge overrides ROOT=
|
|
PORTAGE_CONFIGROOT="$ROOT" \
|
|
run_merge -u --root="$ROOT" --sysroot="$ROOT" "${TOOLCHAIN_PKGS[@]}"
|
|
}
|
|
|
|
configure_crossdev_overlay / /tmp/crossdev
|
|
|
|
# TODO: this is building the SDK packages and shouldn't actually be needed
|
|
for cross_chost in $(get_chost_list); do
|
|
echo "Building cross toolchain for ${cross_chost}"
|
|
PKGDIR="$(portageq envvar PKGDIR)/crossdev" \
|
|
install_cross_toolchain "${cross_chost}" ${clst_myemergeopts}
|
|
PKGDIR="$(portageq envvar PKGDIR)/cross/${cross_chost}" \
|
|
install_cross_libs "${cross_chost}" ${clst_myemergeopts}
|
|
done
|
|
|
|
for board in $(get_board_list); do
|
|
echo "Building native toolchain for ${board}"
|
|
target_pkgdir="$(portageq envvar PKGDIR)/target/${board}"
|
|
PKGDIR="${target_pkgdir}" configure_target_root "${board}"
|
|
PKGDIR="${target_pkgdir}" build_target_toolchain "${board}"
|
|
done
|