Skip to content

Commit 8e5b5af

Browse files
committed
dev-lang/rust: Drop our custom package in favour of upstream Gentoo's
It is not clear why this was forked originally. One reason was to avoid the sys-apps/lsb-release dependency, but it probably wasn't just that. It seems likely that the upstream package did not support cross targets at the time. Now it does. It appears that LTO was previously enabled by us following Gentoo rather than through an explicit decision. They now disable it by default, so we do likewise. It previously used "fat" LTO, which makes Rust especially slow to build and reportedly made rustc slower than with "thin" LTO! There seems little benefit in using thin LTO given that we rebuild Rust almost as much as the packages that use it, plus we don't enable LTO anywhere else. We still avoid rustdoc to keep the size down using INSTALL_MASK. This isn't as good as not building it in the first place, but this alone isn't worth keeping a fork. Cross targets are now handled via the admittedly experimental RUST_CROSS_TARGETS support. This has been in place for a while, and I think it is fairly widely used now. If it does disappear, it would almost certainly be for something even better. This also updates Rust from 1.80.0 to 1.80.1. Signed-off-by: James Le Cuirot <[email protected]>
1 parent b88b31a commit 8e5b5af

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+7913
-217
lines changed

.github/workflows/portage-stable-packages-list

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ dev-lang/perl
207207
dev-lang/python
208208
dev-lang/python-exec
209209
dev-lang/python-exec-conf
210+
dev-lang/rust
210211
dev-lang/swig
211212
dev-lang/tcl
212213
dev-lang/yasm
@@ -688,6 +689,7 @@ virtual/perl-Getopt-Long
688689
virtual/perl-IO
689690
virtual/perl-Unicode-Collate
690691
virtual/pkgconfig
692+
virtual/rust
691693
virtual/service-manager
692694
virtual/ssh
693695
virtual/tmpfiles

.github/workflows/rust-apply-patch.sh

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/rust-release-main.yaml

Lines changed: 0 additions & 48 deletions
This file was deleted.

build_library/catalyst.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ cat <<EOF
105105
# stage1 packages aren't published, save in tmp
106106
pkgcache_path: ${TEMPDIR}/stage1-${ARCH}-packages
107107
update_seed: yes
108-
update_seed_command: --exclude cross-*-cros-linux-gnu/* --exclude dev-lang/rust --ignore-world y --ignore-built-slot-operator-deps y @changed-subslot
108+
update_seed_command: --exclude cross-*-cros-linux-gnu/* --exclude dev-lang/rust --exclude virtual/rust --ignore-world y --ignore-built-slot-operator-deps y @changed-subslot
109109
EOF
110110
catalyst_stage_default 1
111111
}

build_library/catalyst_sdk.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ for cross_chost in $(get_chost_list); do
2020
echo "Building cross toolchain for ${cross_chost}"
2121
PKGDIR="$(portageq envvar PKGDIR)/crossdev" \
2222
install_cross_toolchain "${cross_chost}" ${clst_myemergeopts}
23-
PKGDIR="$(portageq envvar PKGDIR)/crossdev" \
24-
install_cross_rust "${cross_chost}" ${clst_myemergeopts}
2523
done
24+
25+
PKGDIR="$(portageq envvar PKGDIR)/crossdev" install_cross_rust ${clst_myemergeopts}

build_library/toolchain_util.sh

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -410,14 +410,6 @@ install_cross_toolchain() {
410410
else
411411
echo "Installing existing binaries"
412412
"${sudo[@]}" emerge "${emerge_flags[@]}" "${emerge_atoms[@]}"
413-
if [ "${cbuild}" = "x86_64-pc-linux-gnu" ] && [ "${cross_chost}" = aarch64-cros-linux-gnu ] && \
414-
[ ! -d /usr/lib/rust-*/rustlib/aarch64-unknown-linux-gnu ] && [ ! -d /usr/lib/rustlib/aarch64-unknown-linux-gnu ]; then
415-
# If no aarch64 folder exists, warn about the situation but don't compile Rust here or download it as binary package
416-
echo "WARNING: No aarch64 cross-compilation Rust libraries found!"
417-
echo "In case building fails, make sure the old Rust version is deleted with: sudo emerge --unmerge virtual/rust dev-lang/rust"
418-
echo "Then install it again with: sudo emerge ${emerge_flags[@]} virtual/rust"
419-
echo "This will download the binary package or build from source."
420-
fi
421413
fi
422414

423415
# Setup environment and wrappers for our shiny new toolchain
@@ -471,22 +463,22 @@ install_cross_libs() {
471463
}
472464

473465
install_cross_rust() {
474-
local cross_chost="$1"; shift
475-
local emerge_flags=( "$@" --binpkg-respect-use=y --update )
476-
local cbuild="$(portageq envvar CBUILD)"
477-
478466
# may be called from either catalyst (root) or upgrade_chroot (user)
479467
local sudo=("env")
480468
if [[ $(id -u) -ne 0 ]]; then
481469
sudo=("sudo" "-E")
482470
fi
483471

484-
if [ "${cbuild}" = "x86_64-pc-linux-gnu" ] && [ "${cross_chost}" = "aarch64-cros-linux-gnu" ]; then
485-
echo "Building Rust for arm64"
486-
# If no aarch64 folder exists, try to remove any existing Rust packages.
487-
[ ! -d /usr/lib/rustlib/aarch64-unknown-linux-gnu ] && ("${sudo[@]}" emerge --unmerge dev-lang/rust || true)
488-
"${sudo[@]}" emerge "${emerge_flags[@]}" dev-lang/rust
489-
fi
472+
echo "Installing dev-lang/rust with (potentially outdated) cross targets."
473+
"${sudo[@]}" emerge "${emerge_flags[@]}" --binpkg-respect-use=y --update dev-lang/rust
474+
475+
[[
476+
-d /usr/lib/rustlib/x86_64-unknown-linux-gnu &&
477+
-d /usr/lib/rustlib/aarch64-unknown-linux-gnu
478+
]] && return
479+
480+
echo "Rebuilding dev-lang/rust with updated cross targets."
481+
"${sudo[@]}" emerge "${emerge_flags[@]}" --usepkg=n dev-lang/rust
490482
}
491483

492484
# Update to the latest binutils profile for a given CHOST if required
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- SDK: Rust ([1.80.1](https://github.com/rust-lang/rust/releases/tag/1.80.1))
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
INSTALL_MASK+=" *rustdoc*"
2+
I_KNOW_WHAT_I_AM_DOING_CROSS=1
3+
4+
RUST_CROSS_TARGETS=(
5+
$(aarch64-cros-linux-gnu-gcc --version >/dev/null && echo "AArch64:aarch64-unknown-linux-gnu:aarch64-cros-linux-gnu")
6+
)

sdk_container/src/third_party/coreos-overlay/dev-lang/rust/Manifest

Lines changed: 0 additions & 30 deletions
This file was deleted.

sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/package.accept_keywords

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
=dev-lang/python-3.11.9_p1 ~amd64
5050

5151
# Accept unstable host Rust compilers.
52-
=dev-lang/rust-1.80.0 ~amd64 ~arm64
52+
=dev-lang/rust-1.80.1 ~amd64 ~arm64
5353

5454
# Needed by arm64-native SDK.
5555
=dev-lang/yasm-1.3.0-r1 ~arm64
@@ -106,4 +106,4 @@ dev-util/catalyst ~amd64 ~arm64
106106
=sys-cluster/ipvsadm-1.31-r1 ~arm64
107107

108108
# Accept unstable host Rust compilers.
109-
=virtual/rust-1.80.0 ~amd64 ~arm64
109+
=virtual/rust-1.80.1 ~amd64 ~arm64

0 commit comments

Comments
 (0)