mirror of
https://github.com/flatcar/scripts.git
synced 2025-11-28 14:01:43 +01:00
fix(catalyst): Take advantage of binary packages for cross toolchains.
The previous logic here only skipped the bootstrap if the toolchain packages were already installed (which won't happen on the build host) but we can also skip the bootstrap if binary packages are available (which will happen on the build host). This will help avoid needless gcc rebuilds :)
This commit is contained in:
parent
25f91de8e6
commit
15b637aa78
@ -3,32 +3,28 @@
|
||||
source /tmp/chroot-functions.sh
|
||||
|
||||
# Build cross toolchains
|
||||
# crossdev only does full bootstraps so if all of the packages are already
|
||||
# installed (i.e. we are updating an existing stage4) then use emerge
|
||||
for cross_chost in x86_64-cros-linux-gnu; do
|
||||
echo "Installing toolchain for ${cross_chost}"
|
||||
cross_pkgs=( cross-${cross_chost}/{binutils,gcc,gdb,glibc,linux-headers} )
|
||||
cross_bootstrap=0
|
||||
for pkg in "${cross_pkgs[@]}"; do
|
||||
if ! portageq match / "$pkg" | grep .; then
|
||||
cross_bootstrap=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
crossdev --ov-output "/usr/local/portage/crossdev" \
|
||||
--env 'FEATURES=splitdebug' \
|
||||
--stable --ex-gdb --init-target \
|
||||
--target "${cross_chost}" || exit 1
|
||||
|
||||
if [[ "${cross_bootstrap}" -eq 1 ]]; then
|
||||
# If PKGCACHE is enabled check to see if binary packages are available
|
||||
# or (due to --noreplace) the packages are already installed. If so then
|
||||
# we don't need to perform a full bootstrap and just call emerge instead.
|
||||
if [[ -n "${clst_PKGCACHE}" ]] && \
|
||||
emerge ${clst_myemergeopts} --usepkgonly --binpkg-respect-use=y \
|
||||
--noreplace "${cross_pkgs[@]}" &>/dev/null
|
||||
then
|
||||
run_merge -u "${cross_pkgs[@]}"
|
||||
else
|
||||
crossdev --ov-output "/usr/local/portage/crossdev" \
|
||||
--portage "${clst_myemergeopts}" \
|
||||
--env 'FEATURES=splitdebug' \
|
||||
--stable --ex-gdb --stage4 \
|
||||
--target "${cross_chost}" || exit 1
|
||||
else
|
||||
# Still run --init-target to ensure config is correct
|
||||
crossdev --ov-output "/usr/local/portage/crossdev" \
|
||||
--env 'FEATURES=splitdebug' \
|
||||
--stable --ex-gdb --init-target \
|
||||
--target "${cross_chost}" || exit 1
|
||||
run_merge -u "${cross_pkgs[@]}"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user