diff options
| author | Matt Jolly <kangie@gentoo.org> | 2025-05-31 00:29:54 +1000 |
|---|---|---|
| committer | Matt Jolly <kangie@gentoo.org> | 2025-06-04 07:36:55 +1000 |
| commit | 388cbca2dd4f4826e9bb99f89b2bb1808e84de52 (patch) | |
| tree | f87a99c56524c77a4c53eae330194d3d7ba7ecc8 /dev-lang/rust/rust-9999.ebuild | |
| parent | eba3efd309f30104ed8e8c6c0a5f9e573c0e0aae (diff) | |
| download | gentoo-388cbca2dd4f4826e9bb99f89b2bb1808e84de52.tar.gz gentoo-388cbca2dd4f4826e9bb99f89b2bb1808e84de52.tar.bz2 gentoo-388cbca2dd4f4826e9bb99f89b2bb1808e84de52.zip | |
{dev-lang,sys-devel}/rust*: add 1.88.0_beta20250526
This is our first beta for 1.88.0, corresponding to beta.4 upstream.
It is also the first release where `beta` and `live` ebuilds get their
patches from gitweb rather than ${FILESDIR}.
Changes:
- in line with upstream changes, `config.toml` has been renamed to
`bootstrap.toml`.
- `*bootstrap.toml` has `change-id = "ignore"` added to suppress
warnings that are not useful to downstream.
- after discussion with upstream `x.py` verbosity reduced to `-v`.
- restrictions on building beta with only the last stable have been
dropped, these can be restored if required.
Signed-off-by: Matt Jolly <kangie@gentoo.org>
Diffstat (limited to 'dev-lang/rust/rust-9999.ebuild')
| -rw-r--r-- | dev-lang/rust/rust-9999.ebuild | 101 |
1 files changed, 59 insertions, 42 deletions
diff --git a/dev-lang/rust/rust-9999.ebuild b/dev-lang/rust/rust-9999.ebuild index 4b395498dc1b..d24136d20a53 100644 --- a/dev-lang/rust/rust-9999.ebuild +++ b/dev-lang/rust/rust-9999.ebuild @@ -4,17 +4,15 @@ EAPI=8 LLVM_COMPAT=( 20 ) -PYTHON_COMPAT=( python3_{10..13} ) +PYTHON_COMPAT=( python3_{10..14} ) + +RUST_PATCH_VER=${PVR} RUST_MAX_VER=${PV%%_*} if [[ ${PV} == *9999* ]]; then - RUST_MIN_VER="1.86.0" # Update this as new `beta` releases come out. + RUST_MIN_VER="1.88.0" # Update this as new `beta` releases come out. elif [[ ${PV} == *beta* ]]; then - # Enforce that `beta` is built from `stable`. - # While uncommon it is possible for feature changes within `beta` to result - # in an older snapshot being unable to build a newer one without modifying the sources. - # 'stable' releases should always be able to build a beta snapshot so just use those. - RUST_MAX_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).1" + RUST_MAX_VER="$(ver_cut 1).$(ver_cut 2).0" RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0" else RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0" @@ -25,11 +23,6 @@ inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing optfeature \ if [[ ${PV} = *9999* ]]; then inherit git-r3 - EGIT_REPO_URI="https://github.com/rust-lang/rust.git" - EGIT_SUBMODULES=( - "*" - "-src/gcc" - ) elif [[ ${PV} == *beta* ]]; then # Identify the snapshot date of the beta release: # curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep beta-src.tar.xz @@ -37,6 +30,7 @@ elif [[ ${PV} == *beta* ]]; then BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}" MY_P="rustc-beta" SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz + https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2 verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc -> rustc-${PV}-src.tar.xz.asc ) " @@ -44,6 +38,7 @@ elif [[ ${PV} == *beta* ]]; then else MY_P="rustc-${PV}" SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz + https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2 verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc ) " S="${WORKDIR}/${MY_P}-src" @@ -70,7 +65,7 @@ done LICENSE="|| ( MIT Apache-2.0 ) BSD BSD-1 BSD-2 BSD-4" SLOT="${PV%%_*}" # Beta releases get to share the same SLOT as the eventual stable -IUSE="big-endian clippy cpu_flags_x86_sse2 debug dist doc llvm-libunwind lto rustfmt rust-analyzer rust-src system-llvm test wasm ${ALL_LLVM_TARGETS[*]}" +IUSE="big-endian clippy cpu_flags_x86_sse2 debug dist doc llvm-libunwind lto rustfmt rust-analyzer rust-src +system-llvm test wasm ${ALL_LLVM_TARGETS[*]}" if [[ ${PV} = *9999* ]]; then # These USE flags require nightly rust @@ -172,12 +167,6 @@ RESTRICT="test" VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc -PATCHES=( - "${FILESDIR}"/1.85.0-cross-compile-libz.patch - "${FILESDIR}"/1.85.0-musl-dynamic-linking.patch - "${FILESDIR}"/1.67.0-doc-wasm.patch -) - clear_vendor_checksums() { sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || die } @@ -186,17 +175,38 @@ toml_usex() { usex "${1}" true false } +rust_live_get_sources() { + EGIT_REPO_URI=" + https://anongit.gentoo.org/git/proj/rust-patches.git + " + EGIT_CHECKOUT_DIR="${WORKDIR}/rust-patches-${RUST_PATCH_VER}" + git-r3_src_unpack + + EGIT_REPO_URI=" + https://github.com/rust-lang/rust.git + " + EGIT_SUBMODULES=( + "*" + "-src/gcc" + ) + S="${WORKDIR}/rust" + EGIT_CHECKOUT_DIR="${S}" + git-r3_src_unpack +} + src_unpack() { - if [[ ${PV} = *9999* ]]; then - git-r3_src_unpack + if [[ ${PV} == *9999* ]] ; then + rust_live_get_sources + + # Vendor dependencies mkdir "${S}/.cargo" || die # The vendor script has a check for .cargo/config{,.toml} - touch "${S}/.cargo/config.toml" || die + touch "${S}/.cargo/bootstrap.toml" || die local rust_stage0_root="$(${RUSTC} --print sysroot || die "Can't determine rust's sysroot")" - local rust_build="" - local rust_host="" # Configure vendor to use the portage-provided toolchain. This prevents it from # attempting to fetch a `beta` toolchain from the internet. - cat <<- _EOF_ > "${T}/vendor-config.toml" + cat <<- _EOF_ > "${T}/vendor-bootstrap.toml" + # Suppresses a warning about tracking changes which we don't care about. + change-id = "ignore" [build] build = "$(rust_abi "${CBUILD}")" host = ["$(rust_abi "${CHOST}")"] @@ -209,7 +219,7 @@ src_unpack() { # to ensure that all dependencies are present and up-to-date mkdir "${S}/vendor" || die # This also compiles the 'build helper', there's no way to avoid this. - ${EPYTHON} "${S}"/x.py vendor -vvv --config="${T}"/vendor-config.toml -j$(makeopts_jobs) || + ${EPYTHON} "${S}"/x.py vendor -v --config="${T}"/vendor-bootstrap.toml -j$(makeopts_jobs) || die "Failed to vendor dependencies" # TODO: This has to be generated somehow, this is from a 1.84.x tarball I had lying around. cat <<- _EOF_ > "${S}/.cargo/config.toml" @@ -303,9 +313,13 @@ pkg_setup() { src_prepare() { if [[ ${PV} = *9999* ]]; then # We need to update / generate lockfiles for the workspace - ${CARGO} generate-lockfile --offline + ${CARGO} generate-lockfile --offline || die "Failed to generate lockfiles" fi + PATCHES=( + "${WORKDIR}/rust-patches-${RUST_PATCH_VER}/" + ) + if use lto && tc-is-clang && ! tc-ld-is-lld && ! tc-ld-is-mold; then export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld" fi @@ -386,7 +400,9 @@ src_configure() { build_channel="stable" ;; esac - cat <<- _EOF_ > "${S}"/config.toml + cat <<- _EOF_ > "${S}"/bootstrap.toml + # Suppresses a warning about tracking changes which we don't care about. + change-id = "ignore" # https://github.com/rust-lang/rust/issues/135358 (bug #947897) profile = "dist" [llvm] @@ -507,7 +523,7 @@ src_configure() { export CFLAGS_${rust_target//-/_}="${arch_cflags}" - cat <<- _EOF_ >> "${S}"/config.toml + cat <<- _EOF_ >> "${S}"/bootstrap.toml [target.${rust_target}] ar = "$(tc-getAR)" cc = "$(tc-getCC)" @@ -517,14 +533,14 @@ src_configure() { llvm-libunwind = "$(usex llvm-libunwind $(usex system-llvm system in-tree) no)" _EOF_ if use system-llvm; then - cat <<- _EOF_ >> "${S}"/config.toml + cat <<- _EOF_ >> "${S}"/bootstrap.toml llvm-config = "$(get_llvm_prefix)/bin/llvm-config" _EOF_ fi # by default librustc_target/spec/linux_musl_base.rs sets base.crt_static_default = true; # but we patch it and set to false here as well if use elibc_musl; then - cat <<- _EOF_ >> "${S}"/config.toml + cat <<- _EOF_ >> "${S}"/bootstrap.toml crt-static = false musl-root = "$($(tc-getCC) -print-sysroot)/usr" _EOF_ @@ -533,7 +549,7 @@ src_configure() { if use wasm; then wasm_target="wasm32-unknown-unknown" export CFLAGS_${wasm_target//-/_}="$(filter-flags '-mcpu*' '-march*' '-mtune*'; echo "$CFLAGS")" - cat <<- _EOF_ >> "${S}"/config.toml + cat <<- _EOF_ >> "${S}"/bootstrap.toml [target.wasm32-unknown-unknown] linker = "$(usex system-llvm lld rust-lld)" # wasm target does not have profiler_builtins https://bugs.gentoo.org/848483 @@ -581,7 +597,7 @@ src_configure() { use llvm_targets_${cross_llvm_target} || die "need llvm_targets_${cross_llvm_target} target enabled" command -v ${cross_toolchain}-gcc > /dev/null 2>&1 || die "need ${cross_toolchain} cross toolchain" - cat <<- _EOF_ >> "${S}"/config.toml + cat <<- _EOF_ >> "${S}"/bootstrap.toml [target.${cross_rust_target}] ar = "${cross_toolchain}-ar" cc = "${cross_toolchain}-gcc" @@ -590,12 +606,12 @@ src_configure() { ranlib = "${cross_toolchain}-ranlib" _EOF_ if use system-llvm; then - cat <<- _EOF_ >> "${S}"/config.toml + cat <<- _EOF_ >> "${S}"/bootstrap.toml llvm-config = "$(get_llvm_prefix)/bin/llvm-config" _EOF_ fi if [[ "${cross_toolchain}" == *-musl* ]]; then - cat <<- _EOF_ >> "${S}"/config.toml + cat <<- _EOF_ >> "${S}"/bootstrap.toml musl-root = "$(${cross_toolchain}-gcc -print-sysroot)/usr" _EOF_ fi @@ -605,7 +621,7 @@ src_configure() { # becomes 'target = ["powerpc64le-unknown-linux-gnu","aarch64-unknown-linux-gnu"]' rust_targets="${rust_targets},\"${cross_rust_target}\"" - sed -i "/^target = \[/ s#\[.*\]#\[${rust_targets}\]#" config.toml || die + sed -i "/^target = \[/ s#\[.*\]#\[${rust_targets}\]#" bootstrap.toml || die ewarn ewarn "Enabled ${cross_rust_target} rust target" @@ -633,13 +649,14 @@ src_configure() { env | grep "CARGO_TARGET_.*_RUSTFLAGS=" env | grep "CFLAGS_.*" echo - einfo "config.toml contents:" - cat "${S}"/config.toml || die + einfo "bootstrap.toml contents:" + cat "${S}"/bootstrap.toml || die echo } src_compile() { - RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vvv --config="${S}"/config.toml -j$(makeopts_jobs) || die + # -v will show invocations, -vv "very verbose" is overkill, -vvv "very very verbose" is insane + RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/bootstrap.toml -j$(makeopts_jobs) || die } src_test() { @@ -680,7 +697,7 @@ src_test() { for i in "${tests[@]}"; do local t="src/test/${i}" einfo "rust_src_test: running ${t}" - if ! RUST_BACKTRACE=1 "${EPYTHON}" ./x.py test -vv --config="${S}"/config.toml \ + if ! RUST_BACKTRACE=1 "${EPYTHON}" ./x.py test -vv --config="${S}"/bootstrap.toml \ -j$(makeopts_jobs) --no-doc --no-fail-fast "${t}" then failed+=( "${t}" ) @@ -695,7 +712,7 @@ src_test() { } src_install() { - DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die + DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/bootstrap.toml -j$(makeopts_jobs) || die docompress /usr/lib/${PN}/${SLOT}/share/man/ @@ -785,7 +802,7 @@ src_install() { doins "${T}/provider-${PN}-${SLOT}" if use dist; then - "${EPYTHON}" ./x.py dist -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die + "${EPYTHON}" ./x.py dist -v --config="${S}"/bootstrap.toml -j$(makeopts_jobs) || die insinto "/usr/lib/${PN}/${SLOT}/dist" doins -r "${S}/build/dist/." fi |
