summaryrefslogtreecommitdiff
path: root/dev-lang/rust/files
diff options
context:
space:
mode:
Diffstat (limited to 'dev-lang/rust/files')
-rw-r--r--dev-lang/rust/files/1.38.0-fix-custom-libdir.patch90
-rw-r--r--dev-lang/rust/files/1.38.0-fix-multiple-llvm-rebuilds.patch75
2 files changed, 165 insertions, 0 deletions
diff --git a/dev-lang/rust/files/1.38.0-fix-custom-libdir.patch b/dev-lang/rust/files/1.38.0-fix-custom-libdir.patch
new file mode 100644
index 000000000000..b2b14876c906
--- /dev/null
+++ b/dev-lang/rust/files/1.38.0-fix-custom-libdir.patch
@@ -0,0 +1,90 @@
+From 8553cc0681db7fb6b58b25bb3fbd520604a0cc3a Mon Sep 17 00:00:00 2001
+From: O01eg <o01eg@yandex.ru>
+Date: Wed, 7 Aug 2019 23:37:55 +0300
+Subject: [PATCH] Fix double resolving custom libdir
+
+---
+ src/bootstrap/builder.rs | 20 +++++++++++++-------
+ src/bootstrap/dist.rs | 13 +++++++++----
+ 2 files changed, 22 insertions(+), 11 deletions(-)
+
+diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
+index 5a75497173eb..06ccdd8e7f0f 100644
+--- a/src/bootstrap/builder.rs
++++ b/src/bootstrap/builder.rs
+@@ -627,13 +627,7 @@ impl<'a> Builder<'a> {
+ }
+
+ fn run(self, builder: &Builder<'_>) -> Interned<PathBuf> {
+- let compiler = self.compiler;
+- let config = &builder.build.config;
+- let lib = if compiler.stage >= 1 && config.libdir_relative().is_some() {
+- builder.build.config.libdir_relative().unwrap()
+- } else {
+- Path::new("lib")
+- };
++ let lib = builder.sysroot_libdir_relative(self.compiler);
+ let sysroot = builder
+ .sysroot(self.compiler)
+ .join(lib)
+@@ -687,6 +681,18 @@ impl<'a> Builder<'a> {
+ }
+ }
+
++ /// Returns the compiler's relative libdir where the standard library and other artifacts are
++ /// found for a compiler's sysroot.
++ ///
++ /// For example this returns `lib` on Unix and Windows.
++ pub fn sysroot_libdir_relative(&self, compiler: Compiler) -> &Path {
++ match self.config.libdir_relative() {
++ Some(relative_libdir) if compiler.stage >= 1
++ => relative_libdir,
++ _ => Path::new("lib")
++ }
++ }
++
+ /// Adds the compiler's directory of dynamic libraries to `cmd`'s dynamic
+ /// library lookup path.
+ pub fn add_rustc_lib_path(&self, compiler: Compiler, cmd: &mut Command) {
+diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
+index bd012a887c26..213ceb194a81 100644
+--- a/src/bootstrap/dist.rs
++++ b/src/bootstrap/dist.rs
+@@ -469,7 +469,6 @@ impl Step for Rustc {
+ fn prepare_image(builder: &Builder<'_>, compiler: Compiler, image: &Path) {
+ let host = compiler.host;
+ let src = builder.sysroot(compiler);
+- let libdir = builder.rustc_libdir(compiler);
+
+ // Copy rustc/rustdoc binaries
+ t!(fs::create_dir_all(image.join("bin")));
+@@ -481,11 +480,14 @@ impl Step for Rustc {
+
+ // Copy runtime DLLs needed by the compiler
+ if libdir_relative.to_str() != Some("bin") {
++ let libdir = builder.rustc_libdir(compiler);
+ for entry in builder.read_dir(&libdir) {
+ let name = entry.file_name();
+ if let Some(s) = name.to_str() {
+ if is_dylib(s) {
+- builder.install(&entry.path(), &image.join(&libdir_relative), 0o644);
++ // Don't use custom libdir here because ^lib/ will be resolved again
++ // with installer
++ builder.install(&entry.path(), &image.join("lib"), 0o644);
+ }
+ }
+ }
+@@ -493,8 +495,11 @@ impl Step for Rustc {
+
+ // Copy over the codegen backends
+ let backends_src = builder.sysroot_codegen_backends(compiler);
+- let backends_rel = backends_src.strip_prefix(&src).unwrap();
+- let backends_dst = image.join(&backends_rel);
++ let backends_rel = backends_src.strip_prefix(&src).unwrap()
++ .strip_prefix(builder.sysroot_libdir_relative(compiler)).unwrap();
++ // Don't use custom libdir here because ^lib/ will be resolved again with installer
++ let backends_dst = image.join("lib").join(&backends_rel);
++
+ t!(fs::create_dir_all(&backends_dst));
+ builder.cp_r(&backends_src, &backends_dst);
+
diff --git a/dev-lang/rust/files/1.38.0-fix-multiple-llvm-rebuilds.patch b/dev-lang/rust/files/1.38.0-fix-multiple-llvm-rebuilds.patch
new file mode 100644
index 000000000000..235b95625e41
--- /dev/null
+++ b/dev-lang/rust/files/1.38.0-fix-multiple-llvm-rebuilds.patch
@@ -0,0 +1,75 @@
+From 53fe76479aab03b1fbe5b7184f45484886f769b1 Mon Sep 17 00:00:00 2001
+From: Josh Stone <jistone@redhat.com>
+Date: Wed, 4 Sep 2019 16:02:31 -0700
+Subject: [PATCH] Assume non-git LLVM is fresh if the stamp file exists
+
+Rustbuild usually writes the LLVM submodule commit in a stamp file, so
+we can avoid rebuilding it unnecessarily. However, for builds from a
+source tarball (non-git), we were assuming a rebuild is always needed.
+This can cause a lot of extra work if any environment like `CFLAGS`
+changed between steps like build and install, which are often separate
+in distro builds.
+
+Now we also write an empty stamp file if the git commit is unknown, and
+its presence is trusted to indicate that no rebuild is needed. An info
+message reports that this is happening, along with the stamp file path
+that can be deleted to force a rebuild anyway.
+---
+ src/bootstrap/native.rs | 27 ++++++++++++++-------------
+ 1 file changed, 14 insertions(+), 13 deletions(-)
+
+diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
+index f02def3e1b05..7bf9ea2688f4 100644
+--- a/src/bootstrap/native.rs
++++ b/src/bootstrap/native.rs
+@@ -81,26 +81,29 @@ impl Step for Llvm {
+ (info, "src/llvm-project/llvm", builder.llvm_out(target), dir.join("bin"))
+ };
+
+- if !llvm_info.is_git() {
+- println!(
+- "git could not determine the LLVM submodule commit hash. \
+- Assuming that an LLVM build is necessary.",
+- );
+- }
+-
+ let build_llvm_config = llvm_config_ret_dir
+ .join(exe("llvm-config", &*builder.config.build));
+ let done_stamp = out_dir.join("llvm-finished-building");
+
+- if let Some(llvm_commit) = llvm_info.sha() {
+- if done_stamp.exists() {
++ if done_stamp.exists() {
++ if let Some(llvm_commit) = llvm_info.sha() {
+ let done_contents = t!(fs::read(&done_stamp));
+
+ // If LLVM was already built previously and the submodule's commit didn't change
+ // from the previous build, then no action is required.
+ if done_contents == llvm_commit.as_bytes() {
+- return build_llvm_config
++ return build_llvm_config;
+ }
++ } else {
++ builder.info(
++ "Could not determine the LLVM submodule commit hash. \
++ Assuming that an LLVM rebuild is not necessary.",
++ );
++ builder.info(&format!(
++ "To force LLVM to rebuild, remove the file `{}`",
++ done_stamp.display()
++ ));
++ return build_llvm_config;
+ }
+ }
+
+@@ -303,9 +306,7 @@ impl Step for Llvm {
+
+ cfg.build();
+
+- if let Some(llvm_commit) = llvm_info.sha() {
+- t!(fs::write(&done_stamp, llvm_commit));
+- }
++ t!(fs::write(&done_stamp, llvm_info.sha().unwrap_or("")));
+
+ build_llvm_config
+ }