Skip to content

Commit 8b717bb

Browse files
committed
dev-lang/rust-1.17.0 version bump
Use Cargo PV[minor]+1, as the tarball for Cargo 0.17 is broken: It contains a directory that is called "nightly" instead of the actual version number. Add patch to make bootstrap verbose rust-lang/rust#42186 Add patch to output config file location on failure rust-lang/rust#41820
1 parent f5201d6 commit 8b717bb

5 files changed

+366
-0
lines changed

dev-lang/rust/Manifest

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
DIST rust-1.16.0-i686-unknown-linux-gnu.tar.gz 106129219 SHA256 b5859161ebb182d3b75fa14a5741e5de87b088146fb0ef4a30f3b2439c6179c5 SHA512 7a780a107d98c6a8883f95dbb5a5ec95bad52fb1e735afba29b47411b450d464cbc8dfe73d35de1eb18b9a1f9ea727daa1ca9d3042e2a98c67ad570d328e139d WHIRLPOOL e7cbcfdb984a76ce8c7885cde6380582f75205ec498db904ccbaf7fac891caf7d1ef377c67e40265cdd998ad420d6cc55cf2a989abb167da0285d24319a36bd6
2+
DIST rust-1.16.0-x86_64-unknown-linux-gnu.tar.gz 103142459 SHA256 48621912c242753ba37cad5145df375eeba41c81079df46f93ffb4896542e8fd SHA512 f3d381c0e47e0af02eb116376422c3e48295c2854c6ad8c03d4c13e662f3cc1fdddf25923f7b3ef358c5cf670ed67d75e2197162434a81d5f9499e6e0e2d1054 WHIRLPOOL db9547a3b92471d5f46b431fc6c66d12cb2bcda22d548993904a03485f729b4a0f91813dbf2a5b3f46c9aeb0ca39332db1f95454cabb9f0684e4142fe3bfdcf3
3+
DIST rustc-1.17.0-src.tar.gz 31570599 SHA256 4baba3895b75f2492df6ce5a28a916307ecd1c088dc1fd02dbfa8a8e86174f87 SHA512 781799b29d83b4f0f433814bd818df034526db8e7f88c2df51d3b814eacafe8098d4bbe47ace951e1943325b3267b244007cf04f1f11083645b25aeacd40ebb6 WHIRLPOOL 5f0ff59266c53d22f4e7488224c9fa1430b93a9af6f4c918cce0d684c1d5481f6dc6415b9c7cbd560990b842fa792d0db8eb244cbd9cf7c75e731638e144c511
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
From cf05cd8abffadd701cab32de43e59b5ac73241f3 Mon Sep 17 00:00:00 2001
2+
From: Dennis Schridde <devurandom@users.noreply.github.com>
3+
Date: Sun, 7 May 2017 23:20:28 +0200
4+
Subject: [PATCH] bootstrap: Output name of failed config in case of errors
5+
6+
---
7+
src/bootstrap/config.rs | 2 +-
8+
1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
11+
index 34fbc33d981a..9c536111811a 100644
12+
--- a/src/bootstrap/config.rs
13+
+++ b/src/bootstrap/config.rs
14+
@@ -264,7 +264,7 @@ impl Config {
15+
let table = match p.parse() {
16+
Some(table) => table,
17+
None => {
18+
- println!("failed to parse TOML configuration:");
19+
+ println!("failed to parse TOML configuration '{}':", file.to_str().unwrap());
20+
for err in p.errors.iter() {
21+
let (loline, locol) = p.to_linecol(err.lo);
22+
let (hiline, hicol) = p.to_linecol(err.hi);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
From 21484c8799606b8b7eb8645372cf076758d44f02 Mon Sep 17 00:00:00 2001
2+
From: Dennis Schridde <devurandom@gmx.net>
3+
Date: Wed, 24 May 2017 09:09:17 +0200
4+
Subject: [PATCH 1/3] bootstrap: Actually respect verbosity setting in
5+
config.toml
6+
7+
---
8+
src/bootstrap/bootstrap.py | 5 +++++
9+
1 file changed, 5 insertions(+)
10+
11+
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
12+
index b326f95e50..cc9e7e5df0 100644
13+
--- a/src/bootstrap/bootstrap.py
14+
+++ b/src/bootstrap/bootstrap.py
15+
@@ -545,6 +545,11 @@ def bootstrap():
16+
except:
17+
pass
18+
19+
+ if '\nverbose = 2' in rb.config_toml:
20+
+ rb.verbose = 2
21+
+ elif '\nverbose = 1' in rb.config_toml:
22+
+ rb.verbose = 1
23+
+
24+
rb.use_vendored_sources = '\nvendor = true' in rb.config_toml or \
25+
'CFG_ENABLE_VENDOR' in rb.config_mk
26+
27+
--
28+
2.13.0
29+
30+
From 36b628f813d3e75b81916358b0aee6f74ffc4dba Mon Sep 17 00:00:00 2001
31+
From: Dennis Schridde <devurandom@gmx.net>
32+
Date: Wed, 24 May 2017 09:10:15 +0200
33+
Subject: [PATCH 2/3] bootstrap: Make bootstrap verbose if requested
34+
35+
Fixes: #42099
36+
---
37+
src/bootstrap/bootstrap.py | 4 ++++
38+
1 file changed, 4 insertions(+)
39+
40+
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
41+
index cc9e7e5df0..2e55bfcf4f 100644
42+
--- a/src/bootstrap/bootstrap.py
43+
+++ b/src/bootstrap/bootstrap.py
44+
@@ -370,6 +370,10 @@ class RustBuild(object):
45+
raise Exception("no cargo executable found at `%s`" % self.cargo())
46+
args = [self.cargo(), "build", "--manifest-path",
47+
os.path.join(self.rust_root, "src/bootstrap/Cargo.toml")]
48+
+ if self.verbose:
49+
+ args.append("--verbose")
50+
+ if self.verbose > 1:
51+
+ args.append("--verbose")
52+
if self.use_locked_deps:
53+
args.append("--locked")
54+
if self.use_vendored_sources:
55+
--
56+
2.13.0
57+
58+
From 8689e8431ff290a9ce204b84ffb7296793fbed30 Mon Sep 17 00:00:00 2001
59+
From: Dennis Schridde <devurandom@gmx.net>
60+
Date: Wed, 24 May 2017 09:11:10 +0200
61+
Subject: [PATCH 3/3] bootstrap: Use common run() function to call cargo
62+
63+
This brings verbosity even to invocation of cargo itself
64+
---
65+
src/bootstrap/bootstrap.py | 14 ++++----------
66+
1 file changed, 4 insertions(+), 10 deletions(-)
67+
68+
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
69+
index 2e55bfcf4f..463f3fa031 100644
70+
--- a/src/bootstrap/bootstrap.py
71+
+++ b/src/bootstrap/bootstrap.py
72+
@@ -126,13 +126,13 @@ def unpack(tarball, dst, verbose=False, match=None):
73+
shutil.move(tp, fp)
74+
shutil.rmtree(os.path.join(dst, fname))
75+
76+
-def run(args, verbose=False, exception=False):
77+
+def run(args, verbose=False, exception=False, env=None):
78+
if verbose:
79+
print("running: " + ' '.join(args))
80+
sys.stdout.flush()
81+
# Use Popen here instead of call() as it apparently allows powershell on
82+
# Windows to not lock up waiting for input presumably.
83+
- ret = subprocess.Popen(args)
84+
+ ret = subprocess.Popen(args, env=env)
85+
code = ret.wait()
86+
if code != 0:
87+
err = "failed to run: " + ' '.join(args)
88+
@@ -378,13 +378,7 @@ class RustBuild(object):
89+
args.append("--locked")
90+
if self.use_vendored_sources:
91+
args.append("--frozen")
92+
- self.run(args, env)
93+
-
94+
- def run(self, args, env):
95+
- proc = subprocess.Popen(args, env=env)
96+
- ret = proc.wait()
97+
- if ret != 0:
98+
- sys.exit(ret)
99+
+ run(args, env=env, verbose=self.verbose)
100+
101+
def build_triple(self):
102+
default_encoding = sys.getdefaultencoding()
103+
@@ -603,7 +597,7 @@ def bootstrap():
104+
env["BUILD"] = rb.build
105+
env["SRC"] = rb.rust_root
106+
env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
107+
- rb.run(args, env)
108+
+ run(args, env=env, verbose=rb.verbose)
109+
110+
def main():
111+
start_time = time()
112+
--
113+
2.13.0
114+

dev-lang/rust/metadata.xml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
3+
<pkgmetadata>
4+
<maintainer type="project">
5+
<email>rust@gentoo.org</email>
6+
<name>Rust Project</name>
7+
</maintainer>
8+
<use>
9+
<flag name="clang">Use <pkg>sys-devel/clang</pkg> for building</flag>
10+
<flag name="libcxx">Use <pkg>sys-libs/libcxx</pkg> as standard
11+
library when building with <pkg>sys-devel/clang</pkg></flag>
12+
<flag name="system-llvm">Use system <pkg>sys-devel/llvm</pkg> in
13+
place of the bundled one</flag>
14+
</use>
15+
</pkgmetadata>

dev-lang/rust/rust-1.17.0.ebuild

+212
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
# Copyright 1999-2017 Gentoo Foundation
2+
# Distributed under the terms of the GNU General Public License v2
3+
4+
EAPI=6
5+
6+
PYTHON_COMPAT=( python2_7 )
7+
8+
LLVM_MAX_SLOT=4
9+
10+
inherit python-any-r1 versionator toolchain-funcs llvm
11+
12+
if [[ ${PV} = *beta* ]]; then
13+
betaver=${PV//*beta}
14+
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
15+
MY_P="rustc-beta"
16+
SLOT="beta/${PV}"
17+
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.gz"
18+
KEYWORDS=""
19+
else
20+
ABI_VER="$(get_version_component_range 1-2)"
21+
SLOT="stable/${ABI_VER}"
22+
MY_P="rustc-${PV}"
23+
SRC="${MY_P}-src.tar.gz"
24+
KEYWORDS="~amd64 ~x86"
25+
fi
26+
27+
CHOST_amd64=x86_64-unknown-linux-gnu
28+
CHOST_x86=i686-unknown-linux-gnu
29+
30+
RUST_STAGE0_VERSION="1.$(($(get_version_component_range 2) - 1)).0"
31+
RUST_STAGE0_amd64="rust-${RUST_STAGE0_VERSION}-${CHOST_amd64}"
32+
RUST_STAGE0_x86="rust-${RUST_STAGE0_VERSION}-${CHOST_x86}"
33+
34+
CARGO_DEPEND_VERSION="0.$(($(get_version_component_range 2) + 1)).0"
35+
36+
DESCRIPTION="Systems programming language from Mozilla"
37+
HOMEPAGE="http://www.rust-lang.org/"
38+
39+
SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.gz
40+
amd64? ( https://static.rust-lang.org/dist/${RUST_STAGE0_amd64}.tar.gz )
41+
x86? ( https://static.rust-lang.org/dist/${RUST_STAGE0_x86}.tar.gz )
42+
"
43+
44+
LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
45+
46+
IUSE="clang debug doc jemalloc llvm"
47+
REQUIRED_USE="clang? ( llvm )"
48+
49+
RDEPEND=""
50+
DEPEND="${RDEPEND}
51+
${PYTHON_DEPS}
52+
clang? (
53+
<sys-devel/clang-6_pre:=
54+
|| (
55+
sys-devel/clang:4
56+
>=sys-devel/clang-3:0
57+
)
58+
)
59+
!clang? ( >=sys-devel/gcc-4.7 )
60+
dev-util/cmake
61+
"
62+
PDEPEND=">=app-eselect/eselect-rust-0.3_pre20150425
63+
>=dev-util/cargo-${CARGO_DEPEND_VERSION}"
64+
65+
PATCHES=(
66+
"${FILESDIR}/${P}"-bootstrap-output-name-of-failed-config.patch
67+
"${FILESDIR}/${P}"-bootstrap-verbose.patch
68+
)
69+
70+
S="${WORKDIR}/${MY_P}-src"
71+
72+
toml_usex() {
73+
usex "$1" true false
74+
}
75+
76+
pkg_setup() {
77+
python-any-r1_pkg_setup
78+
llvm_pkg_setup
79+
}
80+
81+
src_prepare() {
82+
local rust_stage0_root="${WORKDIR}"/rust-stage0
83+
84+
local rust_stage0_name="RUST_STAGE0_${ARCH}"
85+
local rust_stage0="${!rust_stage0_name}"
86+
87+
"${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig --destdir="${rust_stage0_root}" --prefix=/ || die
88+
89+
default
90+
}
91+
92+
src_configure() {
93+
local rust_stage0_root="${WORKDIR}"/rust-stage0
94+
95+
local rust_target_name="CHOST_${ARCH}"
96+
local rust_target="${!rust_target_name}"
97+
98+
local archiver="$(tc-getAR)"
99+
local linker="$(tc-getCC)"
100+
if use llvm ; then
101+
# Gentoo currently lacks CHOST prefixed binaries for sys-devel/llvm
102+
# https://bugs.gentoo.org/show_bug.cgi?id=617776
103+
#archiver="${CHOST}"-llvm-ar
104+
#linker="${CHOST}"-llvm-link
105+
archiver=llvm-ar
106+
linker=llvm-link
107+
fi
108+
109+
local llvm_config="$(get_llvm_prefix)/bin/${CBUILD}-llvm-config"
110+
local c_compiler="$(tc-getBUILD_CC)"
111+
local cxx_compiler="$(tc-getBUILD_CXX)"
112+
if use clang ; then
113+
c_compiler="${CBUILD}-clang"
114+
cxx_compiler="${CBUILD}-clang++"
115+
fi
116+
117+
cat <<- EOF > "${S}"/config.toml
118+
[llvm]
119+
optimize = $(toml_usex !debug)
120+
release-debuginfo = $(toml_usex debug)
121+
assertions = $(toml_usex debug)
122+
[build]
123+
build = "${rust_target}"
124+
host = ["${rust_target}"]
125+
target = ["${rust_target}"]
126+
cargo = "${rust_stage0_root}/bin/cargo"
127+
rustc = "${rust_stage0_root}/bin/rustc"
128+
docs = $(toml_usex doc)
129+
submodules = false
130+
python = "${EPYTHON}"
131+
locked-deps = true
132+
vendor = true
133+
verbose = 2
134+
[install]
135+
prefix = "${EPREFIX}/usr"
136+
libdir = "$(get_libdir)/${P}"
137+
docdir = "share/doc/${P}"
138+
mandir = "share/${P}/man"
139+
[rust]
140+
optimize = $(toml_usex !debug)
141+
debuginfo = $(toml_usex debug)
142+
debug-assertions = $(toml_usex debug)
143+
use-jemalloc = $(toml_usex jemalloc)
144+
default-linker = "${linker}"
145+
default-ar = "${archiver}"
146+
rpath = false
147+
[target.${rust_target}]
148+
cc = "${c_compiler}"
149+
cxx = "${cxx_compiler}"
150+
llvm-config = "${llvm_config}"
151+
EOF
152+
}
153+
154+
src_compile() {
155+
export RUST_BACKTRACE=1
156+
export LLVM_LINK_SHARED=1
157+
158+
./x.py build --verbose --config="${S}"/config.toml || die
159+
}
160+
161+
src_install() {
162+
env DESTDIR="${D}" ./x.py dist --install || die
163+
164+
mv "${D}/usr/bin/rustc" "${D}/usr/bin/rustc-${PV}" || die
165+
mv "${D}/usr/bin/rustdoc" "${D}/usr/bin/rustdoc-${PV}" || die
166+
mv "${D}/usr/bin/rust-gdb" "${D}/usr/bin/rust-gdb-${PV}" || die
167+
168+
dodoc COPYRIGHT
169+
170+
if use doc ; then
171+
dodir "/usr/share/doc/rust-${PV}/"
172+
mv "${D}/usr/share/doc/rust"/* "${D}/usr/share/doc/rust-${PV}/" || die
173+
rmdir "${D}/usr/share/doc/rust/" || die
174+
fi
175+
176+
cat <<-EOF > "${T}"/50${P}
177+
LDPATH="/usr/$(get_libdir)/${P}"
178+
MANPATH="/usr/share/${P}/man"
179+
EOF
180+
doenvd "${T}"/50${P}
181+
182+
cat <<-EOF > "${T}/provider-${P}"
183+
/usr/bin/rustdoc
184+
/usr/bin/rust-gdb
185+
EOF
186+
dodir /etc/env.d/rust
187+
insinto /etc/env.d/rust
188+
doins "${T}/provider-${P}"
189+
}
190+
191+
pkg_postinst() {
192+
eselect rust update --if-unset
193+
194+
elog "Rust installs a helper script for calling GDB now,"
195+
elog "for your convenience it is installed under /usr/bin/rust-gdb-${PV}."
196+
197+
if has_version app-editors/emacs || has_version app-editors/emacs-vcs; then
198+
elog "install app-emacs/rust-mode to get emacs support for rust."
199+
fi
200+
201+
if has_version app-editors/gvim || has_version app-editors/vim; then
202+
elog "install app-vim/rust-vim to get vim support for rust."
203+
fi
204+
205+
if has_version 'app-shells/zsh'; then
206+
elog "install app-shells/rust-zshcomp to get zsh completion for rust."
207+
fi
208+
}
209+
210+
pkg_postrm() {
211+
eselect rust unset --if-invalid
212+
}

0 commit comments

Comments
 (0)