Gentoo Archives: gentoo-commits

From: Georgy Yakovlev <gyakovlev@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/rust-std/
Date: Fri, 01 Jul 2022 19:32:52
Message-Id: 1656703748.cc43303920d897fe2c89db0f59cf8ff21c4b26fe.gyakovlev@gentoo
1 commit: cc43303920d897fe2c89db0f59cf8ff21c4b26fe
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 1 18:58:55 2022 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Fri Jul 1 19:29:08 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cc433039
7
8 sys-devel/rust-std: add 1.59.0
9
10 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
11
12 sys-devel/rust-std/Manifest | 1 +
13 sys-devel/rust-std/rust-std-1.59.0.ebuild | 155 ++++++++++++++++++++++++++++++
14 2 files changed, 156 insertions(+)
15
16 diff --git a/sys-devel/rust-std/Manifest b/sys-devel/rust-std/Manifest
17 index 8a08fb30efdc..ab8e7d688c6e 100644
18 --- a/sys-devel/rust-std/Manifest
19 +++ b/sys-devel/rust-std/Manifest
20 @@ -1 +1,2 @@
21 DIST rustc-1.58.1-src.tar.xz 124353160 BLAKE2B 686c7272db544ad46f7fb01b4e05f24f4e08ff959a000cadfaef5d8fc413b93f5ed839077bc9715defc7a0a179af091f65c7a5d7104b0b3153f0654c237c094b SHA512 eff3279d2e519343cea542a9ae2daab592e44f35af344e33ff43ed55fc7c824511790d1991dd36a603d12465de8c3688e7194c2b9557f288c587ffa04738c2ce
22 +DIST rustc-1.59.0-src.tar.xz 128942756 BLAKE2B b28114f14c9a0fec7db56fde79a985360fd8438c3b14eede49ed12e540c2636be960d0fd800c569af193886ac76fe8bf604d5dae59214ae08cb0cc6cc0ca404e SHA512 acace866871d13a55d365f65d7e15c192c3cd33096862571df6317e066b7474d668b95ae281e0244967778c05f1e33966c3c55616218bd25d3770a2b2d4f0365
23
24 diff --git a/sys-devel/rust-std/rust-std-1.59.0.ebuild b/sys-devel/rust-std/rust-std-1.59.0.ebuild
25 new file mode 100644
26 index 000000000000..b3528f3325e7
27 --- /dev/null
28 +++ b/sys-devel/rust-std/rust-std-1.59.0.ebuild
29 @@ -0,0 +1,155 @@
30 +# Copyright 2020-2022 Gentoo Authors
31 +# Distributed under the terms of the GNU General Public License v2
32 +
33 +EAPI=8
34 +
35 +PYTHON_COMPAT=( python3_{8..10} )
36 +
37 +inherit flag-o-matic multiprocessing python-any-r1 rust-toolchain toolchain-funcs
38 +
39 +DESCRIPTION="Rust standard library, standalone (for crossdev)"
40 +HOMEPAGE="https://www.rust-lang.org"
41 +SRC_URI="https://static.rust-lang.org/dist/rustc-${PV}-src.tar.xz"
42 +
43 +LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
44 +SLOT="stable/$(ver_cut 1-2)"
45 +# please do not keyword
46 +#KEYWORDS="" #nowarn
47 +IUSE="debug"
48 +
49 +BDEPEND="
50 + ${PYTHON_DEPS}
51 + ~dev-lang/rust-${PV}:=
52 +"
53 +
54 +DEPEND="||
55 + (
56 + >="${CATEGORY}"/gcc-4.7:*
57 + >="${CATEGORY}"/clang-3.5:*
58 + )
59 +"
60 +
61 +RDEPEND="${DEPEND}"
62 +
63 +# need full compiler to run tests
64 +RESTRICT="test"
65 +
66 +QA_FLAGS_IGNORED="usr/lib/rust/${PV}/rustlib/.*/lib/lib.*.so"
67 +
68 +S="${WORKDIR}/${P/-std/c}-src"
69 +
70 +#
71 +# The cross magic
72 +#
73 +export CTARGET=${CTARGET:-${CHOST}}
74 +if [[ ${CTARGET} == ${CHOST} ]] ; then
75 + if [[ ${CATEGORY} == cross-* ]] ; then
76 + export CTARGET=${CATEGORY#cross-}
77 + fi
78 +fi
79 +
80 +is_cross() {
81 + [[ ${CHOST} != ${CTARGET} ]]
82 +}
83 +
84 +toml_usex() {
85 + usex "$1" true false
86 +}
87 +
88 +pkg_pretend() {
89 + is_cross || die "${PN} should only be used for cross"
90 +}
91 +
92 +pkg_setup() {
93 + python-any-r1_pkg_setup
94 +}
95 +
96 +src_prepare() {
97 + default
98 +}
99 +
100 +src_configure() {
101 + # do the great cleanup
102 + strip-flags
103 + filter-flags '-mcpu=*' '-march=*' '-mtune=*' '-m32' '-m64'
104 + strip-unsupported-flags
105 +
106 + local rust_root x
107 + rust_root="$(rustc --print sysroot)"
108 + rtarget="$(rust_abi ${CTARGET})"
109 + rtarget="${ERUST_STD_RTARGET:-${rtarget}}" # some targets need to be custom.
110 + rbuild="$(rust_abi ${CBUILD})"
111 + rhost="$(rust_abi ${CHOST})"
112 +
113 + echo
114 + for x in CATEGORY rust_root rbuild rhost rtarget RUSTFLAGS CFLAGS CXXFLAGS LDFLAGS; do
115 + einfo "$(printf '%10s' ${x^^}:) ${!x}"
116 + done
117 +
118 + cat <<- EOF > "${S}"/config.toml
119 + [build]
120 + build = "${rbuild}"
121 + host = ["${rhost}"]
122 + target = ["${rtarget}"]
123 + cargo = "${rust_root}/bin/cargo"
124 + rustc = "${rust_root}/bin/rustc"
125 + submodules = false
126 + python = "${EPYTHON}"
127 + locked-deps = true
128 + vendor = true
129 + extended = true
130 + verbose = 2
131 + cargo-native-static = false
132 + [install]
133 + prefix = "${EPREFIX}/usr/lib/${PN}/${PV}"
134 + sysconfdir = "etc"
135 + docdir = "share/doc/rust"
136 + bindir = "bin"
137 + libdir = "lib"
138 + mandir = "share/man"
139 + [rust]
140 + # https://github.com/rust-lang/rust/issues/54872
141 + codegen-units-std = 1
142 + optimize = true
143 + debug = $(toml_usex debug)
144 + debug-assertions = $(toml_usex debug)
145 + debuginfo-level-rustc = 0
146 + backtrace = true
147 + incremental = false
148 + default-linker = "$(tc-getCC)"
149 + rpath = false
150 + dist-src = false
151 + remap-debuginfo = true
152 + jemalloc = false
153 + [dist]
154 + src-tarball = false
155 + [target.${rtarget}]
156 + ar = "$(tc-getAR ${CTARGET})"
157 + cc = "$(tc-getCC ${CTARGET})"
158 + cxx = "$(tc-getCXX ${CTARGET})"
159 + linker = "$(tc-getCC ${CTARGET})"
160 + ranlib = "$(tc-getRANLIB ${CTARGET})"
161 + $(usev elibc_musl 'crt-static = false')
162 + EOF
163 +
164 + einfo "${PN^} configured with the following settings:"
165 + cat "${S}"/config.toml || die
166 +}
167 +
168 +src_compile() {
169 + env RUST_BACKTRACE=1 \
170 + "${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) \
171 + library/std --stage 0 || die
172 +}
173 +
174 +src_test() {
175 + ewarn "${PN} can't run tests"
176 +}
177 +
178 +src_install() {
179 + local rustlib="lib/rust/${PV}/lib/rustlib"
180 + dodir "/usr/${rustlib}"
181 + pushd "build/${rhost}/stage0-sysroot/lib/rustlib" > /dev/null || die
182 + cp -pPRv "${rtarget}" "${ED}/usr/${rustlib}" || die
183 + popd > /dev/null || die
184 +}