@@ -25,6 +25,7 @@ use crate::builder::{Builder, Kind, RunConfig, ShouldRun, Step};
25
25
use crate :: cache:: { Interned , INTERNER } ;
26
26
use crate :: channel;
27
27
use crate :: compile;
28
+ use crate :: config:: Target ;
28
29
use crate :: config:: TargetSelection ;
29
30
use crate :: doc:: DocumentationFormat ;
30
31
use crate :: llvm;
@@ -1964,20 +1965,29 @@ fn install_llvm_file(builder: &Builder<'_>, source: &Path, destination: &Path) {
1964
1965
///
1965
1966
/// Returns whether the files were actually copied.
1966
1967
fn maybe_install_llvm ( builder : & Builder < ' _ > , target : TargetSelection , dst_libdir : & Path ) -> bool {
1967
- if !builder. is_rust_llvm ( target) {
1968
- // If the LLVM was externally provided, then we don't currently copy
1969
- // artifacts into the sysroot. This is not necessarily the right
1970
- // choice (in particular, it will require the LLVM dylib to be in
1971
- // the linker's load path at runtime), but the common use case for
1972
- // external LLVMs is distribution provided LLVMs, and in that case
1973
- // they're usually in the standard search path (e.g., /usr/lib) and
1974
- // copying them here is going to cause problems as we may end up
1975
- // with the wrong files and isn't what distributions want.
1976
- //
1977
- // This behavior may be revisited in the future though.
1978
- //
1968
+ // If the LLVM was externally provided, then we don't currently copy
1969
+ // artifacts into the sysroot. This is not necessarily the right
1970
+ // choice (in particular, it will require the LLVM dylib to be in
1971
+ // the linker's load path at runtime), but the common use case for
1972
+ // external LLVMs is distribution provided LLVMs, and in that case
1973
+ // they're usually in the standard search path (e.g., /usr/lib) and
1974
+ // copying them here is going to cause problems as we may end up
1975
+ // with the wrong files and isn't what distributions want.
1976
+ //
1977
+ // This behavior may be revisited in the future though.
1978
+ //
1979
+ // NOTE: this intentionally doesn't use `is_rust_llvm`; whether this is patched or not doesn't matter,
1980
+ // we only care if the shared object itself is managed by bootstrap.
1981
+ let should_install_llvm = match builder. config . target_config . get ( & target) {
1979
1982
// If the LLVM is coming from ourselves (just from CI) though, we
1980
1983
// still want to install it, as it otherwise won't be available.
1984
+ Some ( Target { llvm_config : Some ( _) , .. } ) => {
1985
+ builder. config . llvm_from_ci && target == builder. config . build
1986
+ }
1987
+ Some ( Target { llvm_config : None , .. } ) | None => true ,
1988
+ } ;
1989
+
1990
+ if !should_install_llvm {
1981
1991
return false ;
1982
1992
}
1983
1993
0 commit comments