public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Dirkjan Ochtman" <djc@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/rust/, dev-lang/rust/files/
Date: Sat, 27 Jan 2018 13:24:52 +0000 (UTC)	[thread overview]
Message-ID: <1517059486.7b22a00d25f43b192b738b1393ffdcf5101939a1.djc@gentoo> (raw)

commit:     7b22a00d25f43b192b738b1393ffdcf5101939a1
Author:     Dirkjan Ochtman <djc <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 27 13:24:28 2018 +0000
Commit:     Dirkjan Ochtman <djc <AT> gentoo <DOT> org>
CommitDate: Sat Jan 27 13:24:46 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7b22a00d

dev-lang/rust: bump to 1.23.0-r1, fixing bugs found in 1.23.0

Bug 645466: moving the documentation is no longer necessary during the
install phase, since the doc dir is configured correctly in advance.

Bug 645498: add an "extended" use flag which will build and install
rls, rustfmt and cargo alongside rustc and rustdoc.

Bug 626136: prevent collisions for installed libraries.

Package-Manager: Portage-2.3.19, Repoman-2.3.6

 dev-lang/rust/files/1.23.0-separate-libdir.patch | 180 +++++++++++++++++++++++
 dev-lang/rust/metadata.xml                       |   2 +
 dev-lang/rust/rust-1.23.0-r1.ebuild              | 172 ++++++++++++++++++++++
 3 files changed, 354 insertions(+)

diff --git a/dev-lang/rust/files/1.23.0-separate-libdir.patch b/dev-lang/rust/files/1.23.0-separate-libdir.patch
new file mode 100644
index 00000000000..dcf1762d2fa
--- /dev/null
+++ b/dev-lang/rust/files/1.23.0-separate-libdir.patch
@@ -0,0 +1,180 @@
+From c520b2dd277f13dc09e8e72c486e5c58fb97017d Mon Sep 17 00:00:00 2001
+From: O01eg <o01eg@yandex.ru>
+Date: Wed, 29 Nov 2017 12:32:03 +0300
+Subject: [PATCH] Fix #45345.
+
+Re-implement
+
+```bash
+CFG_LIBDIR_RELATIVE=`echo ${CFG_LIBDIR} | cut -c$((${#CFG_PREFIX}+${CAT_INC}))-`
+```
+
+from old `configure` script.
+
+Accept verbosity in rustdoc.
+
+Stage 1 and later use relative libdir.
+
+Build all stages with relative libdirs.
+
+Add library path for real rustdoc with `RUSTDOC_LIBDIR` environment variable.
+
+Remove unused argument `rustc_cargo`.
+
+Remove unused configuration parameter `libdir_relative`.
+---
+ src/bootstrap/bin/rustdoc.rs | 13 ++++++++++++-
+ src/bootstrap/builder.rs     |  9 ++++++---
+ src/bootstrap/check.rs       |  2 +-
+ src/bootstrap/compile.rs     | 13 ++++---------
+ src/bootstrap/config.rs      |  1 -
+ src/bootstrap/doc.rs         |  2 +-
+ 6 files changed, 24 insertions(+), 16 deletions(-)
+
+diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs
+index 4e975adc97..24312b50ec 100644
+--- a/src/bootstrap/bin/rustdoc.rs
++++ b/src/bootstrap/bin/rustdoc.rs
+@@ -23,10 +23,17 @@ use std::path::PathBuf;
+ fn main() {
+     let args = env::args_os().skip(1).collect::<Vec<_>>();
+     let rustdoc = env::var_os("RUSTDOC_REAL").expect("RUSTDOC_REAL was not set");
+-    let libdir = env::var_os("RUSTC_LIBDIR").expect("RUSTC_LIBDIR was not set");
++    let libdir = env::var_os("RUSTDOC_LIBDIR").expect("RUSTDOC_LIBDIR was not set");
+     let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set");
+     let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set");
+ 
++    use std::str::FromStr;
++
++    let verbose = match env::var("RUSTC_VERBOSE") {
++        Ok(s) => usize::from_str(&s).expect("RUSTC_VERBOSE should be an integer"),
++        Err(_) => 0,
++    };
++
+     let mut dylib_path = bootstrap::util::dylib_path();
+     dylib_path.insert(0, PathBuf::from(libdir));
+ 
+@@ -59,6 +66,10 @@ fn main() {
+            .arg("--crate-version").arg(version);
+     }
+ 
++    if verbose > 1 {
++        eprintln!("rustdoc command: {:?}", cmd);
++    }
++
+     std::process::exit(match cmd.status() {
+         Ok(s) => s.code().unwrap_or(1),
+         Err(e) => panic!("\n\nfailed to run {:?}: {}\n\n", cmd, e),
+diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
+index c76900882b..1927a604c5 100644
+--- a/src/bootstrap/builder.rs
++++ b/src/bootstrap/builder.rs
+@@ -357,8 +357,8 @@ impl<'a> Builder<'a> {
+ 
+             fn run(self, builder: &Builder) -> Interned<PathBuf> {
+                 let compiler = self.compiler;
+-                let lib = if compiler.stage >= 2 && builder.build.config.libdir_relative.is_some() {
+-                    builder.build.config.libdir_relative.clone().unwrap()
++                let lib = if compiler.stage >= 1 && builder.build.config.libdir.is_some() {
++                    builder.build.config.libdir.clone().unwrap()
+                 } else {
+                     PathBuf::from("lib")
+                 };
+@@ -416,7 +416,7 @@ impl<'a> Builder<'a> {
+         let compiler = self.compiler(self.top_stage, host);
+         cmd.env("RUSTC_STAGE", compiler.stage.to_string())
+            .env("RUSTC_SYSROOT", self.sysroot(compiler))
+-           .env("RUSTC_LIBDIR", self.sysroot_libdir(compiler, self.build.build))
++           .env("RUSTDOC_LIBDIR", self.sysroot_libdir(compiler, self.build.build))
+            .env("CFG_RELEASE_CHANNEL", &self.build.config.channel)
+            .env("RUSTDOC_REAL", self.rustdoc(host))
+            .env("RUSTDOC_CRATE_VERSION", self.build.rust_version())
+@@ -496,6 +496,9 @@ impl<'a> Builder<'a> {
+         if let Some(target_linker) = self.build.linker(target) {
+             cargo.env("RUSTC_TARGET_LINKER", target_linker);
+         }
++        if cmd != "build" {
++            cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(self.compiler(2, self.build.build)));
++        }
+ 
+         if mode != Mode::Tool {
+             // Tools don't get debuginfo right now, e.g. cargo and rls don't
+diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs
+index 4d69b19c73..d926c2b901 100644
+--- a/src/bootstrap/check.rs
++++ b/src/bootstrap/check.rs
+@@ -1171,7 +1171,7 @@ impl Step for Crate {
+             }
+             Mode::Librustc => {
+                 builder.ensure(compile::Rustc { compiler, target });
+-                compile::rustc_cargo(build, &compiler, target, &mut cargo);
++                compile::rustc_cargo(build, target, &mut cargo);
+                 ("librustc", "rustc-main")
+             }
+             _ => panic!("can only test libraries"),
+diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
+index db013691bb..d60feb1aff 100644
+--- a/src/bootstrap/compile.rs
++++ b/src/bootstrap/compile.rs
+@@ -485,7 +485,7 @@ impl Step for Rustc {
+         build.clear_if_dirty(&stage_out, &libtest_stamp(build, compiler, target));
+ 
+         let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "build");
+-        rustc_cargo(build, &compiler, target, &mut cargo);
++        rustc_cargo(build, target, &mut cargo);
+         run_cargo(build,
+                   &mut cargo,
+                   &librustc_stamp(build, compiler, target));
+@@ -500,7 +500,6 @@ impl Step for Rustc {
+ 
+ /// Same as `std_cargo`, but for libtest
+ pub fn rustc_cargo(build: &Build,
+-                   compiler: &Compiler,
+                    target: Interned<String>,
+                    cargo: &mut Command) {
+     cargo.arg("--features").arg(build.rustc_features())
+@@ -514,13 +513,9 @@ pub fn rustc_cargo(build: &Build,
+          .env("CFG_VERSION", build.rust_version())
+          .env("CFG_PREFIX", build.config.prefix.clone().unwrap_or_default());
+ 
+-    if compiler.stage == 0 {
+-        cargo.env("CFG_LIBDIR_RELATIVE", "lib");
+-    } else {
+-        let libdir_relative =
+-            build.config.libdir_relative.clone().unwrap_or(PathBuf::from("lib"));
+-        cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative);
+-    }
++    let libdir_relative =
++        build.config.libdir.clone().unwrap_or(PathBuf::from("lib"));
++    cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative);
+ 
+     // If we're not building a compiler with debugging information then remove
+     // these two env vars which would be set otherwise.
+diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
+index 35e62f17f2..1ca19187cf 100644
+--- a/src/bootstrap/config.rs
++++ b/src/bootstrap/config.rs
+@@ -119,7 +119,6 @@ pub struct Config {
+     pub docdir: Option<PathBuf>,
+     pub bindir: Option<PathBuf>,
+     pub libdir: Option<PathBuf>,
+-    pub libdir_relative: Option<PathBuf>,
+     pub mandir: Option<PathBuf>,
+     pub codegen_tests: bool,
+     pub nodejs: Option<PathBuf>,
+diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs
+index 3c12cfc4c7..1314d967d8 100644
+--- a/src/bootstrap/doc.rs
++++ b/src/bootstrap/doc.rs
+@@ -616,7 +616,7 @@ impl Step for Rustc {
+         t!(symlink_dir_force(&my_out, &out_dir));
+ 
+         let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "doc");
+-        compile::rustc_cargo(build, &compiler, target, &mut cargo);
++        compile::rustc_cargo(build, target, &mut cargo);
+ 
+         if build.config.compiler_docs {
+             // src/rustc/Cargo.toml contains a bin crate called rustc which
+-- 
+2.13.6
+

diff --git a/dev-lang/rust/metadata.xml b/dev-lang/rust/metadata.xml
index 050e235f719..c1882e581cf 100644
--- a/dev-lang/rust/metadata.xml
+++ b/dev-lang/rust/metadata.xml
@@ -7,6 +7,8 @@
   </maintainer>
   <use>
     <flag name="clang">Use <pkg>sys-devel/clang</pkg> for building</flag>
+    <flag name="extended">Build and install rls, rustfmt and cargo
+    alongside the compiler and stdlib</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

diff --git a/dev-lang/rust/rust-1.23.0-r1.ebuild b/dev-lang/rust/rust-1.23.0-r1.ebuild
new file mode 100644
index 00000000000..0f20423bb66
--- /dev/null
+++ b/dev-lang/rust/rust-1.23.0-r1.ebuild
@@ -0,0 +1,172 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit python-any-r1 versionator toolchain-funcs
+
+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="debug doc extended +jemalloc"
+
+RDEPEND=">=app-eselect/eselect-rust-0.3_pre20150425
+		jemalloc? ( dev-libs/jemalloc )"
+DEPEND="${RDEPEND}
+	${PYTHON_DEPS}
+	|| (
+		>=sys-devel/gcc-4.7
+		>=sys-devel/clang-3.5
+	)
+	dev-util/cmake
+"
+PDEPEND="!extended? ( >=dev-util/cargo-${CARGO_DEPEND_VERSION} )"
+
+PATCHES=( "${FILESDIR}/1.23.0-separate-libdir.patch" )
+
+S="${WORKDIR}/${MY_P}-src"
+
+toml_usex() {
+	usex "$1" true false
+}
+
+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}"
+
+	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
+		extended = $(toml_usex extended)
+		[install]
+		prefix = "${EPREFIX}/usr"
+		libdir = "$(get_libdir)"
+		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 = "$(tc-getCC)"
+		rpath = false
+		[target.${rust_target}]
+		cc = "$(tc-getBUILD_CC)"
+		cxx = "$(tc-getBUILD_CXX)"
+		linker = "$(tc-getCC)"
+		ar = "$(tc-getAR)"
+	EOF
+}
+
+src_compile() {
+	./x.py build --verbose --config="${S}"/config.toml || die
+}
+
+src_install() {
+	env DESTDIR="${D}" ./x.py 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
+	mv "${D}/usr/bin/rust-lldb" "${D}/usr/bin/rust-lldb-${PV}" || die
+
+	dodoc COPYRIGHT
+
+	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
+		/usr/bin/rust-lldb
+	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 and LLDB,"
+	elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${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
+}


             reply	other threads:[~2018-01-27 13:24 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-27 13:24 Dirkjan Ochtman [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-12-08  7:04 [gentoo-commits] repo/gentoo:master commit in: dev-lang/rust/, dev-lang/rust/files/ Sam James
2024-11-03  6:06 Matt Jolly
2024-07-04  1:15 Sam James
2024-05-31 21:03 Sam James
2024-03-09  2:56 WANG Xuerui
2024-02-10  7:49 Sam James
2024-02-10  4:49 Sam James
2024-01-31 13:56 Matt Turner
2023-07-20  9:49 WANG Xuerui
2023-06-20 19:51 Georgy Yakovlev
2023-06-02  3:06 Georgy Yakovlev
2023-03-21  0:10 Georgy Yakovlev
2023-02-08 22:36 Georgy Yakovlev
2023-01-28 19:34 Georgy Yakovlev
2022-12-20  7:12 Georgy Yakovlev
2022-11-05  5:57 Georgy Yakovlev
2022-09-25  6:37 Georgy Yakovlev
2022-09-13 22:59 Georgy Yakovlev
2022-05-26 16:36 Georgy Yakovlev
2022-05-25 21:09 Georgy Yakovlev
2022-05-24 19:44 Georgy Yakovlev
2022-01-29 17:07 Georgy Yakovlev
2021-12-26  8:58 Georgy Yakovlev
2021-09-13 15:07 Georgy Yakovlev
2021-07-03  7:03 Georgy Yakovlev
2021-06-18  5:26 Georgy Yakovlev
2021-05-05 20:16 Georgy Yakovlev
2021-04-27 11:55 Georgy Yakovlev
2021-04-18 10:30 Georgy Yakovlev
2021-02-05 19:31 Georgy Yakovlev
2021-02-02 23:52 Georgy Yakovlev
2020-10-12  5:14 Georgy Yakovlev
2020-10-09  6:24 Georgy Yakovlev
2020-07-31  9:34 Georgy Yakovlev
2020-04-25  6:13 Georgy Yakovlev
2020-03-30 22:23 Georgy Yakovlev
2020-02-05  9:01 Georgy Yakovlev
2019-12-30  9:59 Georgy Yakovlev
2019-12-20  0:53 Georgy Yakovlev
2019-12-20  0:53 Georgy Yakovlev
2019-10-02 18:42 Georgy Yakovlev
2019-08-16  5:45 Georgy Yakovlev
2019-07-09 16:49 Georgy Yakovlev
2019-07-08 23:01 Georgy Yakovlev
2019-04-12  5:08 Georgy Yakovlev
2019-02-19  1:24 Thomas Deutschmann
2019-02-01  4:36 Georgy Yakovlev
2019-01-26  3:50 Georgy Yakovlev
2019-01-19 20:28 Thomas Deutschmann
2018-11-14 16:16 Dirkjan Ochtman
2018-05-14 14:41 Dirkjan Ochtman
2016-11-08 18:44 Doug Goldstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1517059486.7b22a00d25f43b192b738b1393ffdcf5101939a1.djc@gentoo \
    --to=djc@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox