mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
bootstrap: Add llvm-has-rust-patches target option
This is so you can check out an upstream commit in src/llvm-project and have everything just work.
This commit is contained in:
parent
03d488b48a
commit
e136e02fd9
@ -666,6 +666,10 @@ changelog-seen = 2
|
|||||||
# target.
|
# target.
|
||||||
#llvm-config = <none> (path)
|
#llvm-config = <none> (path)
|
||||||
|
|
||||||
|
# Override detection of whether this is a Rust-patched LLVM. This would be used
|
||||||
|
# in conjunction with either an llvm-config or build.submodules = false.
|
||||||
|
#llvm-has-rust-patches = if llvm-config { false } else { true }
|
||||||
|
|
||||||
# Normally the build system can find LLVM's FileCheck utility, but if
|
# Normally the build system can find LLVM's FileCheck utility, but if
|
||||||
# not, you can specify an explicit file name for it.
|
# not, you can specify an explicit file name for it.
|
||||||
#llvm-filecheck = "/path/to/llvm-version/bin/FileCheck"
|
#llvm-filecheck = "/path/to/llvm-version/bin/FileCheck"
|
||||||
|
@ -388,6 +388,7 @@ impl PartialEq<&str> for TargetSelection {
|
|||||||
pub struct Target {
|
pub struct Target {
|
||||||
/// Some(path to llvm-config) if using an external LLVM.
|
/// Some(path to llvm-config) if using an external LLVM.
|
||||||
pub llvm_config: Option<PathBuf>,
|
pub llvm_config: Option<PathBuf>,
|
||||||
|
pub llvm_has_rust_patches: Option<bool>,
|
||||||
/// Some(path to FileCheck) if one was specified.
|
/// Some(path to FileCheck) if one was specified.
|
||||||
pub llvm_filecheck: Option<PathBuf>,
|
pub llvm_filecheck: Option<PathBuf>,
|
||||||
pub llvm_libunwind: Option<LlvmLibunwind>,
|
pub llvm_libunwind: Option<LlvmLibunwind>,
|
||||||
@ -729,6 +730,7 @@ define_config! {
|
|||||||
default_linker: Option<PathBuf> = "default-linker",
|
default_linker: Option<PathBuf> = "default-linker",
|
||||||
linker: Option<String> = "linker",
|
linker: Option<String> = "linker",
|
||||||
llvm_config: Option<String> = "llvm-config",
|
llvm_config: Option<String> = "llvm-config",
|
||||||
|
llvm_has_rust_patches: Option<bool> = "llvm-has-rust-patches",
|
||||||
llvm_filecheck: Option<String> = "llvm-filecheck",
|
llvm_filecheck: Option<String> = "llvm-filecheck",
|
||||||
llvm_libunwind: Option<String> = "llvm-libunwind",
|
llvm_libunwind: Option<String> = "llvm-libunwind",
|
||||||
android_ndk: Option<String> = "android-ndk",
|
android_ndk: Option<String> = "android-ndk",
|
||||||
@ -1140,6 +1142,7 @@ impl Config {
|
|||||||
if let Some(ref s) = cfg.llvm_config {
|
if let Some(ref s) = cfg.llvm_config {
|
||||||
target.llvm_config = Some(config.src.join(s));
|
target.llvm_config = Some(config.src.join(s));
|
||||||
}
|
}
|
||||||
|
target.llvm_has_rust_patches = cfg.llvm_has_rust_patches;
|
||||||
if let Some(ref s) = cfg.llvm_filecheck {
|
if let Some(ref s) = cfg.llvm_filecheck {
|
||||||
target.llvm_filecheck = Some(config.src.join(s));
|
target.llvm_filecheck = Some(config.src.join(s));
|
||||||
}
|
}
|
||||||
|
@ -112,6 +112,7 @@ use std::path::{Path, PathBuf};
|
|||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::str;
|
use std::str;
|
||||||
|
|
||||||
|
use config::Target;
|
||||||
use filetime::FileTime;
|
use filetime::FileTime;
|
||||||
use once_cell::sync::OnceCell;
|
use once_cell::sync::OnceCell;
|
||||||
|
|
||||||
@ -854,12 +855,13 @@ impl Build {
|
|||||||
///
|
///
|
||||||
/// If no custom `llvm-config` was specified then Rust's llvm will be used.
|
/// If no custom `llvm-config` was specified then Rust's llvm will be used.
|
||||||
fn is_rust_llvm(&self, target: TargetSelection) -> bool {
|
fn is_rust_llvm(&self, target: TargetSelection) -> bool {
|
||||||
if self.config.llvm_from_ci && target == self.config.build {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
match self.config.target_config.get(&target) {
|
match self.config.target_config.get(&target) {
|
||||||
Some(ref c) => c.llvm_config.is_none(),
|
Some(Target { llvm_has_rust_patches: Some(patched), .. }) => *patched,
|
||||||
|
Some(Target { llvm_config, .. }) => {
|
||||||
|
// If the user set llvm-config we assume Rust is not patched,
|
||||||
|
// but first check to see if it was configured by llvm-from-ci.
|
||||||
|
(self.config.llvm_from_ci && target == self.config.build) || llvm_config.is_none()
|
||||||
|
}
|
||||||
None => true,
|
None => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user