From e04d3d37e05d3fc5260bbff7263a3c470b48e07e Mon Sep 17 00:00:00 2001 From: Matt Jolly Date: Thu, 5 Nov 2026 03:51:52 +1000 Subject: [PATCH] dev-lang/rust{,-bin}: add rustc-dev component This is required to link against rust compiler internals for (e.g.) Google's Crubit etc. This should provide a template for adding other Rust components to both the binary and source ebuilds. Signed-off-by: Matt Jolly --- dev-lang/rust-bin/metadata.xml | 1 + dev-lang/rust-bin/rust-bin-1.97.1.ebuild | 16 +++++++++++++++- dev-lang/rust-bin/rust-bin-1.98.1.ebuild | 16 +++++++++++++++- dev-lang/rust-bin/rust-bin-1.99.0.ebuild | 16 +++++++++++++++- dev-lang/rust-bin/rust-bin-9999.ebuild | 16 +++++++++++++++- dev-lang/rust/metadata.xml | 1 + dev-lang/rust/rust-1.97.1.ebuild | 6 +++++- dev-lang/rust/rust-1.98.1.ebuild | 6 +++++- dev-lang/rust/rust-1.99.0.ebuild | 6 +++++- dev-lang/rust/rust-9999.ebuild | 6 +++++- 10 files changed, 82 insertions(+), 8 deletions(-) diff --git a/dev-lang/rust-bin/metadata.xml b/dev-lang/rust-bin/metadata.xml index 74a0ec35c5a8f..2d251778eea16 100644 --- a/dev-lang/rust-bin/metadata.xml +++ b/dev-lang/rust-bin/metadata.xml @@ -9,6 +9,7 @@ Install clippy, Rust code linter Install rust-analyzer, A Rust compiler front-end for IDEs (language server) Install rust-src, needed by developer tools and for build-std (cross) + Install rustc-dev, internal compiler libraries needed to link to compiler internals (e.g. for crubit) Install rustfmt, Rust code formatter diff --git a/dev-lang/rust-bin/rust-bin-1.97.1.ebuild b/dev-lang/rust-bin/rust-bin-1.97.1.ebuild index 6a2fe3faac6e9..8975b8061d7f3 100644 --- a/dev-lang/rust-bin/rust-bin-1.97.1.ebuild +++ b/dev-lang/rust-bin/rust-bin-1.97.1.ebuild @@ -23,6 +23,7 @@ else # curl -Ls static.rust-lang.org/dist/channel-rust-${PV}.toml | grep "xz_url.*rust-src" SRC_URI="$(rust_all_arch_uris "rust-${PV}") rust-src? ( ${RUST_TOOLCHAIN_BASEURL%/}/2026-07-16/rust-src-${PV}.tar.xz ) + rustc-dev? ( $(rust_all_arch_uris "rustc-dev-${PV}") ) " KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86" fi @@ -55,7 +56,7 @@ fi 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 doc prefix rust-analyzer rust-src +rustfmt" +IUSE="big-endian +clippy cpu_flags_x86_sse2 doc prefix rust-analyzer rust-src rustc-dev +rustfmt" # net-misc/curl is needed for our own bootstrapped rustc, since cross-compiling bundled curl is not supported RDEPEND=" @@ -116,6 +117,19 @@ src_unpack() { tar -xf "${WORKDIR}/rust-src-${PV}.tar.xz" || die "Failed to unpack nightly rust-src tarball" fi + if use rustc-dev; then + local rustc_dev_url=$(grep "xz_url.*rustc-dev-nightly-${rust_target}" "${WORKDIR}/channel-rust-nightly.toml" | cut -d '"' -f 2) + einfo "Fetching nightly rustc-dev for ${rust_target} ..." + curl --progress-bar -L "${rustc_dev_url}" -O || die "Failed to fetch nightly rustc-dev" + + if use verify-sig; then + curl --progress-bar -L "${rustc_dev_url}.asc" -O || die "Failed to fetch nightly rustc-dev signature" + verify-sig_verify_detached "${WORKDIR}/rustc-dev-nightly-${rust_target}.tar.xz" \ + "${WORKDIR}/rustc-dev-nightly-${rust_target}.tar.xz.asc" + fi + tar -xf "${WORKDIR}/rustc-dev-nightly-${rust_target}.tar.xz" || die "Failed to unpack nightly rustc-dev" + fi + local v for v in $(multilib_get_enabled_abi_pairs); do rust_target="$(rust_abi $(get_abi_CHOST ${v##*.}))" diff --git a/dev-lang/rust-bin/rust-bin-1.98.1.ebuild b/dev-lang/rust-bin/rust-bin-1.98.1.ebuild index 618ce739f3d16..8cff25596eedd 100644 --- a/dev-lang/rust-bin/rust-bin-1.98.1.ebuild +++ b/dev-lang/rust-bin/rust-bin-1.98.1.ebuild @@ -23,6 +23,7 @@ else # curl -Ls static.rust-lang.org/dist/channel-rust-${PV}.toml | grep "xz_url.*rust-src" SRC_URI="$(rust_all_arch_uris "rust-${PV}") rust-src? ( ${RUST_TOOLCHAIN_BASEURL%/}/2026-09-03/rust-src-${PV}.tar.xz ) + rustc-dev? ( $(rust_all_arch_uris "rustc-dev-${PV}") ) " KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86" fi @@ -55,7 +56,7 @@ fi 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 doc prefix rust-analyzer rust-src +rustfmt" +IUSE="big-endian +clippy cpu_flags_x86_sse2 doc prefix rust-analyzer rust-src rustc-dev +rustfmt" # net-misc/curl is needed for our own bootstrapped rustc, since cross-compiling bundled curl is not supported RDEPEND=" @@ -119,6 +120,19 @@ src_unpack() { local v for v in $(multilib_get_enabled_abi_pairs); do rust_target="$(rust_abi $(get_abi_CHOST ${v##*.}))" + + if use rustc-dev; then + local rustc_dev_url=$(grep "xz_url.*rustc-dev-nightly-${rust_target}" "${WORKDIR}/channel-rust-nightly.toml" | cut -d '"' -f 2) + einfo "Fetching nightly rustc-dev for ${rust_target} ..." + curl --progress-bar -L "${rustc_dev_url}" -O || die "Failed to fetch nightly rustc-dev" + + if use verify-sig; then + curl --progress-bar -L "${rustc_dev_url}.asc" -O || die "Failed to fetch nightly rustc-dev signature" + verify-sig_verify_detached "${WORKDIR}/rustc-dev-nightly-${rust_target}.tar.xz" \ + "${WORKDIR}/rustc-dev-nightly-${rust_target}.tar.xz.asc" + fi + tar -xf "${WORKDIR}/rustc-dev-nightly-${rust_target}.tar.xz" || die "Failed to unpack nightly rustc-dev" + fi rust_bin_url=$(grep "xz_url.*rust-nightly-${rust_target}" "${WORKDIR}/channel-rust-nightly.toml" | cut -d '"' -f 2) einfo "Using nightly Rust from ${rust_bin_url} for ${rust_target}" diff --git a/dev-lang/rust-bin/rust-bin-1.99.0.ebuild b/dev-lang/rust-bin/rust-bin-1.99.0.ebuild index c7d6874a2a238..a1d93b3ff52ac 100644 --- a/dev-lang/rust-bin/rust-bin-1.99.0.ebuild +++ b/dev-lang/rust-bin/rust-bin-1.99.0.ebuild @@ -23,6 +23,7 @@ else # curl -Ls static.rust-lang.org/dist/channel-rust-${PV}.toml | grep "xz_url.*rust-src" SRC_URI="$(rust_all_arch_uris "rust-${PV}") rust-src? ( ${RUST_TOOLCHAIN_BASEURL%/}/2026-10-01/rust-src-${PV}.tar.xz ) + rustc-dev? ( $(rust_all_arch_uris "rustc-dev-${PV}") ) " KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" fi @@ -55,7 +56,7 @@ fi 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 doc prefix rust-analyzer rust-src +rustfmt" +IUSE="big-endian +clippy cpu_flags_x86_sse2 doc prefix rust-analyzer rust-src rustc-dev +rustfmt" # net-misc/curl is needed for our own bootstrapped rustc, since cross-compiling bundled curl is not supported RDEPEND=" @@ -119,6 +120,19 @@ src_unpack() { local v for v in $(multilib_get_enabled_abi_pairs); do rust_target="$(rust_abi $(get_abi_CHOST ${v##*.}))" + + if use rustc-dev; then + local rustc_dev_url=$(grep "xz_url.*rustc-dev-nightly-${rust_target}" "${WORKDIR}/channel-rust-nightly.toml" | cut -d '"' -f 2) + einfo "Fetching nightly rustc-dev for ${rust_target} ..." + curl --progress-bar -L "${rustc_dev_url}" -O || die "Failed to fetch nightly rustc-dev" + + if use verify-sig; then + curl --progress-bar -L "${rustc_dev_url}.asc" -O || die "Failed to fetch nightly rustc-dev signature" + verify-sig_verify_detached "${WORKDIR}/rustc-dev-nightly-${rust_target}.tar.xz" \ + "${WORKDIR}/rustc-dev-nightly-${rust_target}.tar.xz.asc" + fi + tar -xf "${WORKDIR}/rustc-dev-nightly-${rust_target}.tar.xz" || die "Failed to unpack nightly rustc-dev" + fi rust_bin_url=$(grep "xz_url.*rust-nightly-${rust_target}" "${WORKDIR}/channel-rust-nightly.toml" | cut -d '"' -f 2) einfo "Using nightly Rust from ${rust_bin_url} for ${rust_target}" diff --git a/dev-lang/rust-bin/rust-bin-9999.ebuild b/dev-lang/rust-bin/rust-bin-9999.ebuild index fa10160814b6c..17ddf327ee6f5 100644 --- a/dev-lang/rust-bin/rust-bin-9999.ebuild +++ b/dev-lang/rust-bin/rust-bin-9999.ebuild @@ -23,6 +23,7 @@ else # curl -Ls static.rust-lang.org/dist/channel-rust-${PV}.toml | grep "xz_url.*rust-src" SRC_URI="$(rust_all_arch_uris "rust-${PV}") rust-src? ( ${RUST_TOOLCHAIN_BASEURL%/}/2026-03-26/rust-src-${PV}.tar.xz ) + rustc-dev? ( $(rust_all_arch_uris "rustc-dev-${PV}") ) " KEYWORDS=""~mips # ~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"" fi @@ -56,7 +57,7 @@ fi 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 +doc prefix rust-analyzer rust-src +rustfmt" +IUSE="big-endian +clippy cpu_flags_x86_sse2 +doc prefix rust-analyzer rust-src rustc-dev +rustfmt" # net-misc/curl is needed for our own bootstrapped rustc, since cross-compiling bundled curl is not supported RDEPEND=" @@ -120,6 +121,19 @@ src_unpack() { local v for v in $(multilib_get_enabled_abi_pairs); do rust_target="$(rust_abi $(get_abi_CHOST ${v##*.}))" + + if use rustc-dev; then + local rustc_dev_url=$(grep "xz_url.*rustc-dev-nightly-${rust_target}" "${WORKDIR}/channel-rust-nightly.toml" | cut -d '"' -f 2) + einfo "Fetching nightly rustc-dev for ${rust_target} ..." + curl --progress-bar -L "${rustc_dev_url}" -O || die "Failed to fetch nightly rustc-dev" + + if use verify-sig; then + curl --progress-bar -L "${rustc_dev_url}.asc" -O || die "Failed to fetch nightly rustc-dev signature" + verify-sig_verify_detached "${WORKDIR}/rustc-dev-nightly-${rust_target}.tar.xz" \ + "${WORKDIR}/rustc-dev-nightly-${rust_target}.tar.xz.asc" + fi + tar -xf "${WORKDIR}/rustc-dev-nightly-${rust_target}.tar.xz" || die "Failed to unpack nightly rustc-dev" + fi rust_bin_url=$(grep "xz_url.*rust-nightly-${rust_target}" "${WORKDIR}/channel-rust-nightly.toml" | cut -d '"' -f 2) einfo "Using nightly Rust from ${rust_bin_url} for ${rust_target}" diff --git a/dev-lang/rust/metadata.xml b/dev-lang/rust/metadata.xml index 4f4fb5c56451e..b4e07abe9a6bd 100644 --- a/dev-lang/rust/metadata.xml +++ b/dev-lang/rust/metadata.xml @@ -12,6 +12,7 @@ Use dev-lang/mrustc to build the bootstrap Rust sysroot from this package's source Install rust-analyzer, A Rust compiler front-end for IDEs (language server) Install rust-src, needed by developer tools and for build-std (cross) + Install rustc-dev, internal compiler libraries needed to link to compiler internals (e.g. for crubit) Install rustfmt, Rust code formatter Use the system LLVM installation diff --git a/dev-lang/rust/rust-1.97.1.ebuild b/dev-lang/rust/rust-1.97.1.ebuild index e3529d07f6901..a3703804d5183 100644 --- a/dev-lang/rust/rust-1.97.1.ebuild +++ b/dev-lang/rust/rust-1.97.1.ebuild @@ -90,7 +90,7 @@ 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" -IUSE+=" +rustfmt rust-analyzer rust-src +system-llvm test" +IUSE+=" +rustfmt rust-analyzer rustc-dev rust-src +system-llvm test" IUSE+=" ${ALL_LLVM_TARGETS[*]} ${ALL_RUST_SYSROOTS[*]}" if [[ ${PV} = *9999* ]]; then @@ -845,6 +845,10 @@ src_install() { DESTDIR="${D}" "${EPYTHON}" ./x.py install -v \ --config="${S}"/bootstrap.toml -j$(get_makeopts_jobs) || die + # Not required for general use, installs rustc-dev component (i.e. internal rlibs) needed to link to compiler internals for (e.g.) crubit + use rustc-dev && DESTDIR="${D}" "${EPYTHON}" ./x.py install rustc-dev -v \ + --config="${S}"/bootstrap.toml -j$(get_makeopts_jobs) || die + docompress /usr/lib/${PN}/${SLOT}/share/man/ # bash-completion files are installed by dev-lang/rust-common instead diff --git a/dev-lang/rust/rust-1.98.1.ebuild b/dev-lang/rust/rust-1.98.1.ebuild index 6f2c485c098f6..e500f51f1404b 100644 --- a/dev-lang/rust/rust-1.98.1.ebuild +++ b/dev-lang/rust/rust-1.98.1.ebuild @@ -90,7 +90,7 @@ 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" -IUSE+=" +rustfmt rust-analyzer rust-src +system-llvm test" +IUSE+=" +rustfmt rust-analyzer rustc-dev rust-src +system-llvm test" IUSE+=" ${ALL_LLVM_TARGETS[*]} ${ALL_RUST_SYSROOTS[*]}" if [[ ${PV} = *9999* ]]; then @@ -845,6 +845,10 @@ src_install() { DESTDIR="${D}" "${EPYTHON}" ./x.py install -v \ --config="${S}"/bootstrap.toml -j$(get_makeopts_jobs) || die + # Not required for general use, installs rustc-dev component (i.e. internal rlibs) needed to link to compiler internals for (e.g.) crubit + use rustc-dev && DESTDIR="${D}" "${EPYTHON}" ./x.py install rustc-dev -v \ + --config="${S}"/bootstrap.toml -j$(get_makeopts_jobs) || die + docompress /usr/lib/${PN}/${SLOT}/share/man/ # bash-completion files are installed by dev-lang/rust-common instead diff --git a/dev-lang/rust/rust-1.99.0.ebuild b/dev-lang/rust/rust-1.99.0.ebuild index 8468acdec6bb8..013e9dc9db591 100644 --- a/dev-lang/rust/rust-1.99.0.ebuild +++ b/dev-lang/rust/rust-1.99.0.ebuild @@ -90,7 +90,7 @@ 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" -IUSE+=" +rustfmt rust-analyzer rust-src +system-llvm test" +IUSE+=" +rustfmt rust-analyzer rustc-dev rust-src +system-llvm test" IUSE+=" ${ALL_LLVM_TARGETS[*]} ${ALL_RUST_SYSROOTS[*]}" if [[ ${PV} = *9999* ]]; then @@ -845,6 +845,10 @@ src_install() { DESTDIR="${D}" "${EPYTHON}" ./x.py install -v \ --config="${S}"/bootstrap.toml -j$(get_makeopts_jobs) || die + # Not required for general use, installs rustc-dev component (i.e. internal rlibs) needed to link to compiler internals for (e.g.) crubit + use rustc-dev && DESTDIR="${D}" "${EPYTHON}" ./x.py install rustc-dev -v \ + --config="${S}"/bootstrap.toml -j$(get_makeopts_jobs) || die + docompress /usr/lib/${PN}/${SLOT}/share/man/ # bash-completion files are installed by dev-lang/rust-common instead diff --git a/dev-lang/rust/rust-9999.ebuild b/dev-lang/rust/rust-9999.ebuild index 25151fa77c2f9..90f4b6867ffa0 100644 --- a/dev-lang/rust/rust-9999.ebuild +++ b/dev-lang/rust/rust-9999.ebuild @@ -90,7 +90,7 @@ 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" -IUSE+=" +rustfmt rust-analyzer rust-src +system-llvm test" +IUSE+=" +rustfmt rust-analyzer rustc-dev rust-src +system-llvm test" IUSE+=" ${ALL_LLVM_TARGETS[*]} ${ALL_RUST_SYSROOTS[*]}" if [[ ${PV} = *9999* ]]; then @@ -845,6 +845,10 @@ src_install() { DESTDIR="${D}" "${EPYTHON}" ./x.py install -v \ --config="${S}"/bootstrap.toml -j$(get_makeopts_jobs) || die + # Not required for general use, installs rustc-dev component (i.e. internal rlibs) needed to link to compiler internals for (e.g.) crubit + use rustc-dev && DESTDIR="${D}" "${EPYTHON}" ./x.py install rustc-dev -v \ + --config="${S}"/bootstrap.toml -j$(get_makeopts_jobs) || die + docompress /usr/lib/${PN}/${SLOT}/share/man/ # bash-completion files are installed by dev-lang/rust-common instead