Gentoo Archives: gentoo-commits

From: Mikhail Pukhlikov <cynede@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/rust/
Date: Wed, 30 May 2018 11:48:56
Message-Id: 1527680907.663aa5ce666a4b8c35094870275690e247a119dc.cynede@gentoo
1 commit: 663aa5ce666a4b8c35094870275690e247a119dc
2 Author: Mikhail Pukhlikov <cynede <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 30 11:48:27 2018 +0000
4 Commit: Mikhail Pukhlikov <cynede <AT> gentoo <DOT> org>
5 CommitDate: Wed May 30 11:48:27 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=663aa5ce
7
8 dev-lang/rust: bump to 1.26.1
9
10 Package-Manager: Portage-2.3.40, Repoman-2.3.9
11
12 dev-lang/rust/Manifest | 1 +
13 dev-lang/rust/rust-1.26.1.ebuild | 221 +++++++++++++++++++++++++++++++++++++++
14 2 files changed, 222 insertions(+)
15
16 diff --git a/dev-lang/rust/Manifest b/dev-lang/rust/Manifest
17 index e543c9ffc86..db4a09c3a93 100644
18 --- a/dev-lang/rust/Manifest
19 +++ b/dev-lang/rust/Manifest
20 @@ -6,3 +6,4 @@ DIST rust-1.25.0-i686-unknown-linux-gnu.tar.xz 102453124 BLAKE2B 8986ebab6a7a9d0
21 DIST rust-1.25.0-x86_64-unknown-linux-gnu.tar.xz 111059260 BLAKE2B ae982976a735c2b5226722207a983bb638cb7c0cb0ceb6b438456d54fac86a5d1892b535f01ac463157205c0ae27ae876482f6ac1fa269a9ec3e1177be0cef2e SHA512 aea93ff64f620a1dd6b48d07ec3dcbc126b2f5c17b4697c096ec8cd02a3c7dfec7ae7d5df70a55eceb372897ad12f3d01c67d5aaea0167a80270931c61323f78
22 DIST rustc-1.25.0-src.tar.gz 98639156 BLAKE2B 1408d5dd0611d4830de3b6b3d00e3fad4198a47599b639d0ac0bd05aaba401f743056a942e9df04a4d192c6b12e8cfe9a9cdf8cd26e48b72104ce9b423df049e SHA512 7d8886f4d5a621eb794e814deb60be681fa38cf086f87ffa14e5a3500c640b237c549a632de1331a0f1b71963de41f6d31a4df3866b7e597424002316fed81ce
23 DIST rustc-1.26.0-src.tar.xz 54613664 BLAKE2B 798985e4060c28828066118f39fc296e52b3796ae02f3917912680154047eb6f91806b3d45f3a0e9afcef55d95cea3079debae12d2ddf2d9c46f992e12519094 SHA512 563b910ecf4b2a0d798a1201177f733333e64efad49e5aceec5adc66a8c6903df391c9afc0fdd8284348c08082e0c4de1e5cb68efe6797594de43ca93e4ad7a2
24 +DIST rustc-1.26.1-src.tar.xz 54604108 BLAKE2B 73e14d835812a42f32342732db448294c98e5cfdcb76b4a5d11085bef6302ae340abadba564c38319882b558df6dbe826ed73347229599f2f8718085a6cdbe10 SHA512 219b8d4dbc1aa087422d8227de8a6be10c0579fd9d1aae83af0a0305baf2c3a72222c6bdca8635c550b5b754d08a7a5b03b81b8b28019b23250327be1c7f8b00
25
26 diff --git a/dev-lang/rust/rust-1.26.1.ebuild b/dev-lang/rust/rust-1.26.1.ebuild
27 new file mode 100644
28 index 00000000000..7c8ad9c0011
29 --- /dev/null
30 +++ b/dev-lang/rust/rust-1.26.1.ebuild
31 @@ -0,0 +1,221 @@
32 +# Copyright 1999-2018 Gentoo Foundation
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=6
36 +
37 +PYTHON_COMPAT=( python2_7 python3_{5,6} pypy )
38 +
39 +inherit multiprocessing multilib-build python-any-r1 versionator toolchain-funcs
40 +
41 +if [[ ${PV} = *beta* ]]; then
42 + betaver=${PV//*beta}
43 + BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
44 + MY_P="rustc-beta"
45 + SLOT="beta/${PV}"
46 + SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
47 + KEYWORDS=""
48 +else
49 + ABI_VER="$(get_version_component_range 1-2)"
50 + SLOT="stable/${ABI_VER}"
51 + MY_P="rustc-${PV}"
52 + SRC="${MY_P}-src.tar.xz"
53 + KEYWORDS="~amd64 ~arm64 ~x86"
54 +fi
55 +
56 +CHOST_amd64=x86_64-unknown-linux-gnu
57 +CHOST_x86=i686-unknown-linux-gnu
58 +CHOST_arm64=aarch64-unknown-linux-gnu
59 +
60 +RUST_STAGE0_VERSION="1.$(($(get_version_component_range 2) - 1)).0"
61 +RUST_STAGE0_amd64="rust-${RUST_STAGE0_VERSION}-${CHOST_amd64}"
62 +RUST_STAGE0_x86="rust-${RUST_STAGE0_VERSION}-${CHOST_x86}"
63 +RUST_STAGE0_arm64="rust-${RUST_STAGE0_VERSION}-${CHOST_arm64}"
64 +
65 +CARGO_DEPEND_VERSION="0.$(($(get_version_component_range 2) + 1)).0"
66 +
67 +DESCRIPTION="Systems programming language from Mozilla"
68 +HOMEPAGE="http://www.rust-lang.org/"
69 +
70 +SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz
71 + amd64? ( https://static.rust-lang.org/dist/${RUST_STAGE0_amd64}.tar.xz )
72 + x86? ( https://static.rust-lang.org/dist/${RUST_STAGE0_x86}.tar.xz )
73 + arm64? ( https://static.rust-lang.org/dist/${RUST_STAGE0_arm64}.tar.xz )
74 +"
75 +
76 +ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
77 + NVPTX PowerPC Sparc SystemZ X86 XCore )
78 +ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
79 +LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
80 +
81 +LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
82 +
83 +IUSE="debug doc extended +jemalloc ${ALL_LLVM_TARGETS[*]}"
84 +
85 +RDEPEND=">=app-eselect/eselect-rust-0.3_pre20150425
86 + jemalloc? ( dev-libs/jemalloc )"
87 +DEPEND="${RDEPEND}
88 + ${PYTHON_DEPS}
89 + || (
90 + >=sys-devel/gcc-4.7
91 + >=sys-devel/clang-3.5
92 + )
93 + dev-util/cmake
94 +"
95 +PDEPEND="!extended? ( >=dev-util/cargo-${CARGO_DEPEND_VERSION} )"
96 +
97 +REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )"
98 +
99 +S="${WORKDIR}/${MY_P}-src"
100 +
101 +toml_usex() {
102 + usex "$1" true false
103 +}
104 +
105 +src_prepare() {
106 + local rust_stage0_root="${WORKDIR}"/rust-stage0
107 +
108 + local rust_stage0_name="RUST_STAGE0_${ARCH}"
109 + local rust_stage0="${!rust_stage0_name}"
110 +
111 + "${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig --destdir="${rust_stage0_root}" --prefix=/ || die
112 +
113 + default
114 +}
115 +
116 +src_configure() {
117 + local rust_target="" rust_targets="" rust_target_name arch_cflags
118 +
119 + # Collect rust target names to compile standard libs for all ABIs.
120 + for v in $(multilib_get_enabled_abi_pairs); do
121 + rust_target_name="CHOST_${v##*.}"
122 + rust_targets="${rust_targets},\"${!rust_target_name}\""
123 + done
124 + rust_targets="${rust_targets#,}"
125 +
126 + local rust_stage0_root="${WORKDIR}"/rust-stage0
127 +
128 + rust_target_name="CHOST_${ARCH}"
129 + rust_target="${!rust_target_name}"
130 +
131 + cat <<- EOF > "${S}"/config.toml
132 + [llvm]
133 + optimize = $(toml_usex !debug)
134 + release-debuginfo = $(toml_usex debug)
135 + assertions = $(toml_usex debug)
136 + targets = "${LLVM_TARGETS// /;}"
137 + [build]
138 + build = "${rust_target}"
139 + host = ["${rust_target}"]
140 + target = [${rust_targets}]
141 + cargo = "${rust_stage0_root}/bin/cargo"
142 + rustc = "${rust_stage0_root}/bin/rustc"
143 + docs = $(toml_usex doc)
144 + submodules = false
145 + python = "${EPYTHON}"
146 + locked-deps = true
147 + vendor = true
148 + verbose = 2
149 + extended = $(toml_usex extended)
150 + [install]
151 + prefix = "${EPREFIX}/usr"
152 + libdir = "$(get_libdir)"
153 + docdir = "share/doc/${P}"
154 + mandir = "share/${P}/man"
155 + [rust]
156 + optimize = $(toml_usex !debug)
157 + debuginfo = $(toml_usex debug)
158 + debug-assertions = $(toml_usex debug)
159 + use-jemalloc = $(toml_usex jemalloc)
160 + default-linker = "$(tc-getCC)"
161 + rpath = false
162 + EOF
163 +
164 + for v in $(multilib_get_enabled_abi_pairs); do
165 + rust_target=$(get_abi_CHOST ${v##*.})
166 + arch_cflags="$(get_abi_CFLAGS ${v##*.})"
167 +
168 + cat <<- EOF >> "${S}"/config.env
169 + CFLAGS_${rust_target}=${arch_cflags}
170 + EOF
171 +
172 + cat <<- EOF >> "${S}"/config.toml
173 + [target.${rust_target}]
174 + cc = "$(tc-getBUILD_CC)"
175 + cxx = "$(tc-getBUILD_CXX)"
176 + linker = "$(tc-getCC)"
177 + ar = "$(tc-getAR)"
178 + EOF
179 + done
180 +}
181 +
182 +src_compile() {
183 + env $(cat "${S}"/config.env)\
184 + ./x.py build --verbose --config="${S}"/config.toml -j$(makeopts_jobs) || die
185 +}
186 +
187 +src_install() {
188 + local rust_target abi_libdir
189 +
190 + env DESTDIR="${D}" ./x.py install || die
191 +
192 + mv "${D}/usr/bin/rustc" "${D}/usr/bin/rustc-${PV}" || die
193 + mv "${D}/usr/bin/rustdoc" "${D}/usr/bin/rustdoc-${PV}" || die
194 + mv "${D}/usr/bin/rust-gdb" "${D}/usr/bin/rust-gdb-${PV}" || die
195 + mv "${D}/usr/bin/rust-lldb" "${D}/usr/bin/rust-lldb-${PV}" || die
196 +
197 + # Copy shared library versions of standard libraries for all targets
198 + # into the system's abi-dependent lib directories because the rust
199 + # installer only does so for the native ABI.
200 + for v in $(multilib_get_enabled_abi_pairs); do
201 + if [ ${v##*.} = ${DEFAULT_ABI} ]; then
202 + continue
203 + fi
204 + abi_libdir=$(get_abi_LIBDIR ${v##*.})
205 + rust_target=$(get_abi_CHOST ${v##*.})
206 + mkdir -p ${D}/usr/${abi_libdir}
207 + cp ${D}/usr/$(get_libdir)/rustlib/${rust_target}/lib/*.so \
208 + ${D}/usr/${abi_libdir} || die
209 + done
210 +
211 + dodoc COPYRIGHT
212 +
213 + # FIXME:
214 + # Really not sure if that env is needed, specailly LDPATH
215 + cat <<-EOF > "${T}"/50${P}
216 + LDPATH="/usr/$(get_libdir)/${P}"
217 + MANPATH="/usr/share/${P}/man"
218 + EOF
219 + doenvd "${T}"/50${P}
220 +
221 + cat <<-EOF > "${T}/provider-${P}"
222 + /usr/bin/rustdoc
223 + /usr/bin/rust-gdb
224 + /usr/bin/rust-lldb
225 + EOF
226 + dodir /etc/env.d/rust
227 + insinto /etc/env.d/rust
228 + doins "${T}/provider-${P}"
229 +}
230 +
231 +pkg_postinst() {
232 + eselect rust update --if-unset
233 +
234 + elog "Rust installs a helper script for calling GDB and LLDB,"
235 + elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
236 +
237 + if has_version app-editors/emacs || has_version app-editors/emacs-vcs; then
238 + elog "install app-emacs/rust-mode to get emacs support for rust."
239 + fi
240 +
241 + if has_version app-editors/gvim || has_version app-editors/vim; then
242 + elog "install app-vim/rust-vim to get vim support for rust."
243 + fi
244 +
245 + if has_version 'app-shells/zsh'; then
246 + elog "install app-shells/rust-zshcomp to get zsh completion for rust."
247 + fi
248 +}
249 +
250 +pkg_postrm() {
251 + eselect rust unset --if-invalid
252 +}