Skip to content

Commit

Permalink
dev-lang/rust-1.17.0 version bump
Browse files Browse the repository at this point in the history
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
  • Loading branch information
devurandom committed Jun 5, 2017
1 parent f5201d6 commit 8b717bb
Show file tree
Hide file tree
Showing 5 changed files with 366 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dev-lang/rust/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DIST rust-1.16.0-i686-unknown-linux-gnu.tar.gz 106129219 SHA256 b5859161ebb182d3b75fa14a5741e5de87b088146fb0ef4a30f3b2439c6179c5 SHA512 7a780a107d98c6a8883f95dbb5a5ec95bad52fb1e735afba29b47411b450d464cbc8dfe73d35de1eb18b9a1f9ea727daa1ca9d3042e2a98c67ad570d328e139d WHIRLPOOL e7cbcfdb984a76ce8c7885cde6380582f75205ec498db904ccbaf7fac891caf7d1ef377c67e40265cdd998ad420d6cc55cf2a989abb167da0285d24319a36bd6
DIST rust-1.16.0-x86_64-unknown-linux-gnu.tar.gz 103142459 SHA256 48621912c242753ba37cad5145df375eeba41c81079df46f93ffb4896542e8fd SHA512 f3d381c0e47e0af02eb116376422c3e48295c2854c6ad8c03d4c13e662f3cc1fdddf25923f7b3ef358c5cf670ed67d75e2197162434a81d5f9499e6e0e2d1054 WHIRLPOOL db9547a3b92471d5f46b431fc6c66d12cb2bcda22d548993904a03485f729b4a0f91813dbf2a5b3f46c9aeb0ca39332db1f95454cabb9f0684e4142fe3bfdcf3
DIST rustc-1.17.0-src.tar.gz 31570599 SHA256 4baba3895b75f2492df6ce5a28a916307ecd1c088dc1fd02dbfa8a8e86174f87 SHA512 781799b29d83b4f0f433814bd818df034526db8e7f88c2df51d3b814eacafe8098d4bbe47ace951e1943325b3267b244007cf04f1f11083645b25aeacd40ebb6 WHIRLPOOL 5f0ff59266c53d22f4e7488224c9fa1430b93a9af6f4c918cce0d684c1d5481f6dc6415b9c7cbd560990b842fa792d0db8eb244cbd9cf7c75e731638e144c511
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
From cf05cd8abffadd701cab32de43e59b5ac73241f3 Mon Sep 17 00:00:00 2001
From: Dennis Schridde <devurandom@users.noreply.github.com>
Date: Sun, 7 May 2017 23:20:28 +0200
Subject: [PATCH] bootstrap: Output name of failed config in case of errors

---
src/bootstrap/config.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 34fbc33d981a..9c536111811a 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -264,7 +264,7 @@ impl Config {
let table = match p.parse() {
Some(table) => table,
None => {
- println!("failed to parse TOML configuration:");
+ println!("failed to parse TOML configuration '{}':", file.to_str().unwrap());
for err in p.errors.iter() {
let (loline, locol) = p.to_linecol(err.lo);
let (hiline, hicol) = p.to_linecol(err.hi);
114 changes: 114 additions & 0 deletions dev-lang/rust/files/rust-1.17.0-bootstrap-verbose.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
From 21484c8799606b8b7eb8645372cf076758d44f02 Mon Sep 17 00:00:00 2001
From: Dennis Schridde <devurandom@gmx.net>
Date: Wed, 24 May 2017 09:09:17 +0200
Subject: [PATCH 1/3] bootstrap: Actually respect verbosity setting in
config.toml

---
src/bootstrap/bootstrap.py | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index b326f95e50..cc9e7e5df0 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -545,6 +545,11 @@ def bootstrap():
except:
pass

+ if '\nverbose = 2' in rb.config_toml:
+ rb.verbose = 2
+ elif '\nverbose = 1' in rb.config_toml:
+ rb.verbose = 1
+
rb.use_vendored_sources = '\nvendor = true' in rb.config_toml or \
'CFG_ENABLE_VENDOR' in rb.config_mk

--
2.13.0

From 36b628f813d3e75b81916358b0aee6f74ffc4dba Mon Sep 17 00:00:00 2001
From: Dennis Schridde <devurandom@gmx.net>
Date: Wed, 24 May 2017 09:10:15 +0200
Subject: [PATCH 2/3] bootstrap: Make bootstrap verbose if requested

Fixes: #42099
---
src/bootstrap/bootstrap.py | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index cc9e7e5df0..2e55bfcf4f 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -370,6 +370,10 @@ class RustBuild(object):
raise Exception("no cargo executable found at `%s`" % self.cargo())
args = [self.cargo(), "build", "--manifest-path",
os.path.join(self.rust_root, "src/bootstrap/Cargo.toml")]
+ if self.verbose:
+ args.append("--verbose")
+ if self.verbose > 1:
+ args.append("--verbose")
if self.use_locked_deps:
args.append("--locked")
if self.use_vendored_sources:
--
2.13.0

From 8689e8431ff290a9ce204b84ffb7296793fbed30 Mon Sep 17 00:00:00 2001
From: Dennis Schridde <devurandom@gmx.net>
Date: Wed, 24 May 2017 09:11:10 +0200
Subject: [PATCH 3/3] bootstrap: Use common run() function to call cargo

This brings verbosity even to invocation of cargo itself
---
src/bootstrap/bootstrap.py | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 2e55bfcf4f..463f3fa031 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -126,13 +126,13 @@ def unpack(tarball, dst, verbose=False, match=None):
shutil.move(tp, fp)
shutil.rmtree(os.path.join(dst, fname))

-def run(args, verbose=False, exception=False):
+def run(args, verbose=False, exception=False, env=None):
if verbose:
print("running: " + ' '.join(args))
sys.stdout.flush()
# Use Popen here instead of call() as it apparently allows powershell on
# Windows to not lock up waiting for input presumably.
- ret = subprocess.Popen(args)
+ ret = subprocess.Popen(args, env=env)
code = ret.wait()
if code != 0:
err = "failed to run: " + ' '.join(args)
@@ -378,13 +378,7 @@ class RustBuild(object):
args.append("--locked")
if self.use_vendored_sources:
args.append("--frozen")
- self.run(args, env)
-
- def run(self, args, env):
- proc = subprocess.Popen(args, env=env)
- ret = proc.wait()
- if ret != 0:
- sys.exit(ret)
+ run(args, env=env, verbose=self.verbose)

def build_triple(self):
default_encoding = sys.getdefaultencoding()
@@ -603,7 +597,7 @@ def bootstrap():
env["BUILD"] = rb.build
env["SRC"] = rb.rust_root
env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
- rb.run(args, env)
+ run(args, env=env, verbose=rb.verbose)

def main():
start_time = time()
--
2.13.0

15 changes: 15 additions & 0 deletions dev-lang/rust/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>rust@gentoo.org</email>
<name>Rust Project</name>
</maintainer>
<use>
<flag name="clang">Use <pkg>sys-devel/clang</pkg> for building</flag>
<flag name="libcxx">Use <pkg>sys-libs/libcxx</pkg> as standard
library when building with <pkg>sys-devel/clang</pkg></flag>
<flag name="system-llvm">Use system <pkg>sys-devel/llvm</pkg> in
place of the bundled one</flag>
</use>
</pkgmetadata>
212 changes: 212 additions & 0 deletions dev-lang/rust/rust-1.17.0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

PYTHON_COMPAT=( python2_7 )

LLVM_MAX_SLOT=4

inherit python-any-r1 versionator toolchain-funcs llvm

if [[ ${PV} = *beta* ]]; then
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SLOT="beta/${PV}"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.gz"
KEYWORDS=""
else
ABI_VER="$(get_version_component_range 1-2)"
SLOT="stable/${ABI_VER}"
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.gz"
KEYWORDS="~amd64 ~x86"
fi

CHOST_amd64=x86_64-unknown-linux-gnu
CHOST_x86=i686-unknown-linux-gnu

RUST_STAGE0_VERSION="1.$(($(get_version_component_range 2) - 1)).0"
RUST_STAGE0_amd64="rust-${RUST_STAGE0_VERSION}-${CHOST_amd64}"
RUST_STAGE0_x86="rust-${RUST_STAGE0_VERSION}-${CHOST_x86}"

CARGO_DEPEND_VERSION="0.$(($(get_version_component_range 2) + 1)).0"

DESCRIPTION="Systems programming language from Mozilla"
HOMEPAGE="http://www.rust-lang.org/"

SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.gz
amd64? ( https://static.rust-lang.org/dist/${RUST_STAGE0_amd64}.tar.gz )
x86? ( https://static.rust-lang.org/dist/${RUST_STAGE0_x86}.tar.gz )
"

LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"

IUSE="clang debug doc jemalloc llvm"
REQUIRED_USE="clang? ( llvm )"

RDEPEND=""
DEPEND="${RDEPEND}
${PYTHON_DEPS}
clang? (
<sys-devel/clang-6_pre:=
|| (
sys-devel/clang:4
>=sys-devel/clang-3:0
)
)
!clang? ( >=sys-devel/gcc-4.7 )
dev-util/cmake
"
PDEPEND=">=app-eselect/eselect-rust-0.3_pre20150425
>=dev-util/cargo-${CARGO_DEPEND_VERSION}"

PATCHES=(
"${FILESDIR}/${P}"-bootstrap-output-name-of-failed-config.patch
"${FILESDIR}/${P}"-bootstrap-verbose.patch
)

S="${WORKDIR}/${MY_P}-src"

toml_usex() {
usex "$1" true false
}

pkg_setup() {
python-any-r1_pkg_setup
llvm_pkg_setup
}

src_prepare() {
local rust_stage0_root="${WORKDIR}"/rust-stage0

local rust_stage0_name="RUST_STAGE0_${ARCH}"
local rust_stage0="${!rust_stage0_name}"

"${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig --destdir="${rust_stage0_root}" --prefix=/ || die

default
}

src_configure() {
local rust_stage0_root="${WORKDIR}"/rust-stage0

local rust_target_name="CHOST_${ARCH}"
local rust_target="${!rust_target_name}"

local archiver="$(tc-getAR)"
local linker="$(tc-getCC)"
if use llvm ; then
# Gentoo currently lacks CHOST prefixed binaries for sys-devel/llvm
# https://bugs.gentoo.org/show_bug.cgi?id=617776
#archiver="${CHOST}"-llvm-ar
#linker="${CHOST}"-llvm-link
archiver=llvm-ar
linker=llvm-link
fi

local llvm_config="$(get_llvm_prefix)/bin/${CBUILD}-llvm-config"
local c_compiler="$(tc-getBUILD_CC)"
local cxx_compiler="$(tc-getBUILD_CXX)"
if use clang ; then
c_compiler="${CBUILD}-clang"
cxx_compiler="${CBUILD}-clang++"
fi

cat <<- EOF > "${S}"/config.toml
[llvm]
optimize = $(toml_usex !debug)
release-debuginfo = $(toml_usex debug)
assertions = $(toml_usex debug)
[build]
build = "${rust_target}"
host = ["${rust_target}"]
target = ["${rust_target}"]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
docs = $(toml_usex doc)
submodules = false
python = "${EPYTHON}"
locked-deps = true
vendor = true
verbose = 2
[install]
prefix = "${EPREFIX}/usr"
libdir = "$(get_libdir)/${P}"
docdir = "share/doc/${P}"
mandir = "share/${P}/man"
[rust]
optimize = $(toml_usex !debug)
debuginfo = $(toml_usex debug)
debug-assertions = $(toml_usex debug)
use-jemalloc = $(toml_usex jemalloc)
default-linker = "${linker}"
default-ar = "${archiver}"
rpath = false
[target.${rust_target}]
cc = "${c_compiler}"
cxx = "${cxx_compiler}"
llvm-config = "${llvm_config}"
EOF
}

src_compile() {
export RUST_BACKTRACE=1
export LLVM_LINK_SHARED=1

./x.py build --verbose --config="${S}"/config.toml || die
}

src_install() {
env DESTDIR="${D}" ./x.py dist --install || die

mv "${D}/usr/bin/rustc" "${D}/usr/bin/rustc-${PV}" || die
mv "${D}/usr/bin/rustdoc" "${D}/usr/bin/rustdoc-${PV}" || die
mv "${D}/usr/bin/rust-gdb" "${D}/usr/bin/rust-gdb-${PV}" || die

dodoc COPYRIGHT

if use doc ; then
dodir "/usr/share/doc/rust-${PV}/"
mv "${D}/usr/share/doc/rust"/* "${D}/usr/share/doc/rust-${PV}/" || die
rmdir "${D}/usr/share/doc/rust/" || die
fi

cat <<-EOF > "${T}"/50${P}
LDPATH="/usr/$(get_libdir)/${P}"
MANPATH="/usr/share/${P}/man"
EOF
doenvd "${T}"/50${P}

cat <<-EOF > "${T}/provider-${P}"
/usr/bin/rustdoc
/usr/bin/rust-gdb
EOF
dodir /etc/env.d/rust
insinto /etc/env.d/rust
doins "${T}/provider-${P}"
}

pkg_postinst() {
eselect rust update --if-unset

elog "Rust installs a helper script for calling GDB now,"
elog "for your convenience it is installed under /usr/bin/rust-gdb-${PV}."

if has_version app-editors/emacs || has_version app-editors/emacs-vcs; then
elog "install app-emacs/rust-mode to get emacs support for rust."
fi

if has_version app-editors/gvim || has_version app-editors/vim; then
elog "install app-vim/rust-vim to get vim support for rust."
fi

if has_version 'app-shells/zsh'; then
elog "install app-shells/rust-zshcomp to get zsh completion for rust."
fi
}

pkg_postrm() {
eselect rust unset --if-invalid
}

0 comments on commit 8b717bb

Please sign in to comment.