Diff rust-1.90.0-r1 with a rust-1.92.0_p1-r1

/usr/portage/dev-lang/rust/rust-1.92.0_p1-r1.ebuild 2026-01-18 11:18:03.179802828 +0300
3 3

  
4 4
EAPI=8
5 5

  
6
LLVM_COMPAT=( 20 )
6
# Bump notes: https://wiki.gentoo.org/wiki/Project:Rust/Rust_bump
7

  
8
LLVM_COMPAT=( 21 )
7 9
PYTHON_COMPAT=( python3_{11..14} )
8 10

  
9
# We bumped the rust-patches tag without bumping the revision for
10
# https://bugs.gentoo.org/963657, given that ithe patch affects only a
11
# specific use case (bootstrap with Rust 1.90.0).
12
RUST_PATCH_VER=${PV}_p1
11
# Patches are kept in rust-patches.git, see its README.rst for the versioning
12
# scheme.
13
#
14
# We use _pN from the ebuild version for the patchset but it can be overridden
15
# in the ebuild for changes that don't require a revbump.
16
#
17
# Uncomment this line when the ebuild needs a patchset update but no revbump.
18
#RUST_PATCH_VER=${PV}-1
13 19

  
14 20
RUST_MAX_VER=${PV%%_*}
21
RUST_PV=${PV%%_p*}
22
RUST_P=${PN}-${RUST_PV}
23
[[ -z ${RUST_PATCH_VER} ]] && RUST_PATCH_VER=${PV}
24

  
15 25
if [[ ${PV} == *9999* ]]; then
16
	RUST_MIN_VER="1.88.0" # Update this as new `beta` releases come out.
26
	# Update this as new `beta` releases come out.
27
	RUST_MIN_VER="1.88.0"
17 28
elif [[ ${PV} == *beta* ]]; then
18 29
	RUST_MAX_VER="$(ver_cut 1).$(ver_cut 2).0"
19 30
	RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
......
21 32
	RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
22 33
fi
23 34

  
24
inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing optfeature \
25
	multilib multilib-build python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
35
inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing optfeature
36
inherit multilib multilib-build python-any-r1 rust rust-toolchain toolchain-funcs
37
inherit verify-sig
26 38

  
27 39
if [[ ${PV} = *9999* ]]; then
28 40
	inherit git-r3
......
32 44
	betaver=${PV//*beta}
33 45
	BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
34 46
	MY_P="rustc-beta"
35
	SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
47
	SRC_URI="
48
		https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${RUST_PV}-src.tar.xz
36 49
		https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
37
		verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
38
			-> rustc-${PV}-src.tar.xz.asc )
50
		verify-sig? (
51
			https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
52
				-> rustc-${RUST_PV}-src.tar.xz.asc
53
		)
39 54
	"
40 55
	S="${WORKDIR}/${MY_P}-src"
41 56
else
42
	MY_P="rustc-${PV}"
43
	SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
57
	MY_P="rustc-${RUST_PV}"
58
	SRC_URI="
59
		https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
44 60
		https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
45 61
		verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
46 62
	"
47 63
	S="${WORKDIR}/${MY_P}-src"
48
	KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv ~sparc x86"
64

  
65
	KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
49 66
fi
50 67

  
51 68
DESCRIPTION="Systems programming language originally developed by Mozilla"
52 69
HOMEPAGE="https://www.rust-lang.org/"
53 70

  
54 71
# keep in sync with llvm ebuild of the same version as bundled one.
55
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
56
	LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
57
	WebAssembly X86 XCore Xtensa )
72
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai )
73
ALL_LLVM_TARGETS+=( LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV )
74
ALL_LLVM_TARGETS+=( SystemZ VE WebAssembly X86 XCore Xtensa )
58 75
ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
59 76
LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/(-)?}
60 77

  
......
73 90
LICENSE="|| ( MIT Apache-2.0 ) BSD BSD-1 BSD-2 BSD-4"
74 91
SLOT="${PV%%_*}" # Beta releases get to share the same SLOT as the eventual stable
75 92

  
76
IUSE="big-endian clippy cpu_flags_x86_sse2 debug dist doc llvm-libunwind lto rustfmt rust-analyzer rust-src +system-llvm test ${ALL_LLVM_TARGETS[*]} ${ALL_RUST_SYSROOTS[*]}"
93
IUSE="big-endian clippy cpu_flags_x86_sse2 debug dist doc llvm-libunwind lto"
94
IUSE+=" rustfmt rust-analyzer rust-src +system-llvm test"
95
IUSE+=" ${ALL_LLVM_TARGETS[*]} ${ALL_RUST_SYSROOTS[*]}"
77 96

  
78 97
if [[ ${PV} = *9999* ]]; then
79 98
	# These USE flags require nightly rust
......
92 111
LLVM_DEPEND+=( "	$(llvm_gen_dep 'llvm-core/llvm:${LLVM_SLOT}')" )
93 112

  
94 113
# dev-libs/oniguruma is used for documentation
95
BDEPEND="${PYTHON_DEPS}
114
BDEPEND="
115
	${PYTHON_DEPS}
96 116
	app-eselect/eselect-rust
97 117
	dev-libs/oniguruma
98 118
	|| (
......
105 125
			sys-devel/mold
106 126
		)
107 127
	) )
128
	rust_sysroots_wasm? ( llvm-core/clang )
108 129
	!system-llvm? (
109 130
		>=dev-build/cmake-3.13.4
110 131
		app-alternatives/ninja
......
129 150
	)
130 151
"
131 152

  
132
RDEPEND="${DEPEND}
153
RDEPEND="
154
	${DEPEND}
133 155
	app-eselect/eselect-rust
134 156
	dev-lang/rust-common
135 157
	sys-apps/lsb-release
......
137 159
	!dev-lang/rust-bin:stable
138 160
"
139 161

  
140
REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
162
REQUIRED_USE="
163
	|| ( ${ALL_LLVM_TARGETS[*]} )
141 164
	rust-analyzer? ( rust-src )
142 165
	test? ( ${ALL_LLVM_TARGETS[*]} )
143 166
	rust_sysroots_bpf? ( llvm_targets_BPF )
......
317 340
		_EOF_
318 341
	elif use verify-sig ; then
319 342
		# Patch tarballs are not signed (but we trust Gentoo infra)
320
		verify-sig_verify_detached "${DISTDIR}"/rustc-${PV}-src.tar.xz{,.asc}
343
		verify-sig_verify_detached "${DISTDIR}"/rustc-${RUST_PV}-src.tar.xz{,.asc}
321 344
		default
322 345
	else
323 346
		default
......
325 348
}
326 349

  
327 350
src_prepare() {
328
	if [[ ${PV} = *9999* ]]; then
329
		# We need to update / generate lockfiles for the workspace
330
		${CARGO} generate-lockfile --offline || die "Failed to generate lockfiles"
331
	fi
332

  
333 351
	# Commit patches to the appropriate branch in proj/rust-patches.git
334 352
	# then cut a new tag / tarball. Don't add patches to ${FILESDIR}
335 353
	PATCHES=(
336 354
		"${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
337 355
	)
338
	# Apply patches for bootstrapping with a particular Rust version (RUST_SLOT).
339
	local bootstrap_patchdir="${WORKDIR}/rust-patches-${RUST_PATCH_VER}/${RUST_SLOT}"
340
	if [[ -d "${bootstrap_patchdir}" ]]; then
341
		PATCHES+=(
342
			"${bootstrap_patchdir}"
343
		)
344
	fi
345 356

  
346 357
	if use lto && tc-is-clang && ! tc-ld-is-lld && ! tc-ld-is-mold; then
347 358
		export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
......
426 437
			build_channel="stable"
427 438
			;;
428 439
	esac
440

  
441
	# TODO: Add optimized-compiler-builtins for system-llvm to avoid
442
	# building bundled compiler-rt.
429 443
	cat <<- _EOF_ > "${S}"/bootstrap.toml
430 444
		# Suppresses a warning about tracking changes which we don't care about.
431 445
		change-id = "ignore"
......
574 588
	done
575 589
	if use rust_sysroots_wasm; then
576 590
		wasm_target="wasm32-unknown-unknown"
577
		export CFLAGS_${wasm_target//-/_}="$(filter-flags '-mcpu*' '-march*' '-mtune*'; echo "$CFLAGS")"
591
		if tc-is-clang; then
592
			local wasm_cc=$(tc-getCC)
593
			local wasm_cxx=$(tc-getCXX)
594
		else
595
			local wasm_cc=${CHOST}-clang
596
			local wasm_cxx=${CHOST}-clang++
597
		fi
598
		export CFLAGS_${wasm_target//-/_}="$(
599
			CC="${wasm_cc} --target=wasm32-unknown-unknown"
600
			filter-flags '-mcpu*' '-march*' '-mtune*'
601
			strip-unsupported-flags
602
			echo "${CFLAGS}"
603
		)"
578 604
		cat <<- _EOF_ >> "${S}"/bootstrap.toml
579 605
			[target.wasm32-unknown-unknown]
606
			cc = "${wasm_cc}"
607
			cxx = "${wasm_cxx}"
580 608
			linker = "$(usex system-llvm lld rust-lld)"
581 609
			# wasm target does not have profiler_builtins https://bugs.gentoo.org/848483
582 610
			profiler = false
......
748 776

  
749 777
	docompress /usr/lib/${PN}/${SLOT}/share/man/
750 778

  
751
	# bug #689562, #689160
779
	# bash-completion files are installed by dev-lang/rust-common instead
780
	# bug #689562, #689160.
752 781
	rm -v "${ED}/usr/lib/${PN}/${SLOT}/etc/bash_completion.d/cargo" || die
753
	rmdir -v "${ED}/usr/lib/${PN}/${SLOT}"/etc{/bash_completion.d,} || die
782
	rmdir -v "${ED}/usr/lib/${PN}/${SLOT}/etc/bash_completion.d" || die
754 783

  
755 784
	local symlinks=(
756 785
		cargo
......
774 803
		# we need realpath on /usr/bin/* symlink return version-appended binary path.
775 804
		# so /usr/bin/rustc should point to /usr/lib/rust/<ver>/bin/rustc-<ver>
776 805
		# need to fix eselect-rust to remove this hack.
777
		local ver_i="${i}-${PV%%_*}"
806
		local ver_i="${i}-${RUST_PV%%_*}"
778 807
		if [[ -f "${ED}/usr/lib/${PN}/${SLOT}/bin/${i}" ]]; then
779 808
			einfo "Installing ${i} symlink"
780 809
			ln -v "${ED}/usr/lib/${PN}/${SLOT}/bin/${i}" "${ED}/usr/lib/${PN}/${SLOT}/bin/${ver_i}" || die
......
790 819
	use rust-analyzer && dosym "${SLOT}/libexec" "/usr/lib/${PN}/libexec-${SLOT}"
791 820
	dosym "${SLOT}/share/man" "/usr/lib/${PN}/man-${SLOT}"
792 821
	dosym "rust/${SLOT}/lib/rustlib" "/usr/lib/rustlib-${SLOT}"
793
	dosym "../../lib/${PN}/${SLOT}/share/doc/rust" "/usr/share/doc/${P}"
822
	dosym "../../lib/${PN}/${SLOT}/share/doc/rust" "/usr/share/doc/${RUST_P}"
794 823

  
795
	newenvd - "50${P}" <<-_EOF_
824
	newenvd - "50${RUST_P}" <<-_EOF_
796 825
		MANPATH="${EPREFIX}/usr/lib/rust/man-${SLOT}"
797 826
	_EOF_
798 827

  
......
814 843
	_EOF_
815 844

  
816 845
	if use clippy; then
817
		echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
818
		echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
846
		echo /usr/bin/clippy-driver >> "${T}/provider-${RUST_P}"
847
		echo /usr/bin/cargo-clippy >> "${T}/provider-${RUST_P}"
819 848
	fi
820 849
	if [[ ${SLOT} == *9999* ]] && use miri; then
821
		echo /usr/bin/miri >> "${T}/provider-${P}"
822
		echo /usr/bin/cargo-miri >> "${T}/provider-${P}"
850
		echo /usr/bin/miri >> "${T}/provider-${RUST_P}"
851
		echo /usr/bin/cargo-miri >> "${T}/provider-${RUST_P}"
823 852
	fi
824 853
	if use rustfmt; then
825
		echo /usr/bin/rustfmt >> "${T}/provider-${P}"
826
		echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
854
		echo /usr/bin/rustfmt >> "${T}/provider-${RUST_P}"
855
		echo /usr/bin/cargo-fmt >> "${T}/provider-${RUST_P}"
827 856
	fi
828 857
	if use rust-analyzer; then
829
		echo /usr/lib/rust/libexec >> "${T}/provider-${P}"
830
		echo /usr/bin/rust-analyzer >> "${T}/provider-${P}"
858
		echo /usr/lib/rust/libexec >> "${T}/provider-${RUST_P}"
859
		echo /usr/bin/rust-analyzer >> "${T}/provider-${RUST_P}"
831 860
	fi
832 861

  
833 862
	insinto /etc/env.d/rust
......
841 870
}
842 871

  
843 872
pkg_postinst() {
844

  
845 873
	eselect rust update
846 874

  
847 875
	if has_version dev-debug/gdb || has_version llvm-core/lldb; then
848 876
		elog "Rust installs helper scripts for calling GDB and LLDB,"
849
		elog "for convenience they are installed under /usr/bin/rust-{gdb,lldb}-${PV}."
877
		elog "for convenience they are installed under /usr/bin/rust-{gdb,lldb}-${RUST_PV}."
850 878
	fi
851 879

  
852 880
	if has_version app-editors/emacs; then
Thank you!