Changeset View
Changeset View
Standalone View
Standalone View
head/lang/rust/files/patch-src_bootstrap_native.rs
From 9741fbd202b2b55de95abe1eb7f3d8185e312444 Mon Sep 17 00:00:00 2001 | From 9741fbd202b2b55de95abe1eb7f3d8185e312444 Mon Sep 17 00:00:00 2001 | ||||
From: Jake Goulding <jake.goulding@gmail.com> | From: Jake Goulding <jake.goulding@gmail.com> | ||||
Date: Sat, 11 Jul 2020 09:38:01 -0400 | Date: Sat, 11 Jul 2020 09:38:01 -0400 | ||||
Subject: [PATCH] Don't allow `DESTDIR` to influence LLVM builds | Subject: [PATCH] Don't allow `DESTDIR` to influence LLVM builds | ||||
When running a command like `DESTDIR=foo x.py install` in a completely | When running a command like `DESTDIR=foo x.py install` in a completely | ||||
clean build directory, this will cause LLVM to be installed into | clean build directory, this will cause LLVM to be installed into | ||||
`DESTDIR`, which then causes the build to fail later when it attempts | `DESTDIR`, which then causes the build to fail later when it attempts | ||||
to *use* those LLVM files. | to *use* those LLVM files. | ||||
--- | --- | ||||
src/bootstrap/native.rs | 5 +++++ | src/bootstrap/native.rs | 5 +++++ | ||||
1 file changed, 5 insertions(+) | 1 file changed, 5 insertions(+) | ||||
--- src/bootstrap/native.rs.orig 2020-07-31 20:16:28 UTC | --- src/bootstrap/native.rs.orig 2020-08-24 15:00:49 UTC | ||||
+++ src/bootstrap/native.rs | +++ src/bootstrap/native.rs | ||||
@@ -324,6 +324,11 @@ fn configure_cmake( | @@ -347,6 +347,11 @@ fn configure_cmake( | ||||
// LLVM and LLD builds can produce a lot of those and hit CI limits on log size. | // LLVM and LLD builds can produce a lot of those and hit CI limits on log size. | ||||
cfg.define("CMAKE_INSTALL_MESSAGE", "LAZY"); | cfg.define("CMAKE_INSTALL_MESSAGE", "LAZY"); | ||||
+ // Do not allow the user's value of DESTDIR to influence where | + // Do not allow the user's value of DESTDIR to influence where | ||||
+ // LLVM will install itself. LLVM must always be installed in our | + // LLVM will install itself. LLVM must always be installed in our | ||||
+ // own build directories. | + // own build directories. | ||||
+ cfg.env("DESTDIR", ""); | + cfg.env("DESTDIR", ""); | ||||
+ | + | ||||
if builder.config.ninja { | if builder.config.ninja { | ||||
cfg.generator("Ninja"); | cfg.generator("Ninja"); | ||||
} | } | ||||
@@ -480,25 +485,9 @@ impl Step for Lld { | @@ -517,26 +522,9 @@ impl Step for Lld { | ||||
let mut cfg = cmake::Config::new(builder.src.join("src/llvm-project/lld")); | let mut cfg = cmake::Config::new(builder.src.join("src/llvm-project/lld")); | ||||
configure_cmake(builder, target, &mut cfg, true); | configure_cmake(builder, target, &mut cfg, true); | ||||
- // This is an awful, awful hack. Discovered when we migrated to using | - // This is an awful, awful hack. Discovered when we migrated to using | ||||
- // clang-cl to compile LLVM/LLD it turns out that LLD, when built out of | - // clang-cl to compile LLVM/LLD it turns out that LLD, when built out of | ||||
- // tree, will execute `llvm-config --cmakedir` and then tell CMake about | - // tree, will execute `llvm-config --cmakedir` and then tell CMake about | ||||
- // that directory for later processing. Unfortunately if this path has | - // that directory for later processing. Unfortunately if this path has | ||||
- // forward slashes in it (which it basically always does on Windows) | - // forward slashes in it (which it basically always does on Windows) | ||||
- // then CMake will hit a syntax error later on as... something isn't | - // then CMake will hit a syntax error later on as... something isn't | ||||
- // escaped it seems? | - // escaped it seems? | ||||
- // | - // | ||||
- // Instead of attempting to fix this problem in upstream CMake and/or | - // Instead of attempting to fix this problem in upstream CMake and/or | ||||
- // LLVM/LLD we just hack around it here. This thin wrapper will take the | - // LLVM/LLD we just hack around it here. This thin wrapper will take the | ||||
- // output from llvm-config and replace all instances of `\` with `/` to | - // output from llvm-config and replace all instances of `\` with `/` to | ||||
- // ensure we don't hit the same bugs with escaping. It means that you | - // ensure we don't hit the same bugs with escaping. It means that you | ||||
- // can't build on a system where your paths require `\` on Windows, but | - // can't build on a system where your paths require `\` on Windows, but | ||||
- // there's probably a lot of reasons you can't do that other than this. | - // there's probably a lot of reasons you can't do that other than this. | ||||
- let llvm_config_shim = env::current_exe().unwrap().with_file_name("llvm-config-wrapper"); | - let llvm_config_shim = env::current_exe().unwrap().with_file_name("llvm-config-wrapper"); | ||||
- | |||||
cfg.out_dir(&out_dir) | cfg.out_dir(&out_dir) | ||||
.profile("Release") | .profile("Release") | ||||
- .env("LLVM_CONFIG_REAL", &llvm_config) | - .env("LLVM_CONFIG_REAL", &llvm_config) | ||||
- .define("LLVM_CONFIG_PATH", llvm_config_shim) | - .define("LLVM_CONFIG_PATH", llvm_config_shim) | ||||
+ .define("LLVM_CONFIG_PATH", &llvm_config) | + .define("LLVM_CONFIG_PATH", &llvm_config) | ||||
.define("LLVM_INCLUDE_TESTS", "OFF"); | .define("LLVM_INCLUDE_TESTS", "OFF"); | ||||
// While we're using this horrible workaround to shim the execution of | // While we're using this horrible workaround to shim the execution of |