@@ -22,6 +22,7 @@ use crate::builder::{Builder, Kind, RunConfig, ShouldRun, Step};
2222use crate :: cache:: { Interned , INTERNER } ;
2323use crate :: channel;
2424use crate :: compile;
25+ use crate :: config:: Target ;
2526use crate :: config:: TargetSelection ;
2627use crate :: doc:: DocumentationFormat ;
2728use crate :: tarball:: { GeneratedTarball , OverlayKind , Tarball } ;
@@ -1890,20 +1891,29 @@ fn add_env(builder: &Builder<'_>, cmd: &mut Command, target: TargetSelection) {
18901891///
18911892/// Returns whether the files were actually copied.
18921893fn maybe_install_llvm ( builder : & Builder < ' _ > , target : TargetSelection , dst_libdir : & Path ) -> bool {
1893- if !builder. is_rust_llvm ( target) {
1894- // If the LLVM was externally provided, then we don't currently copy
1895- // artifacts into the sysroot. This is not necessarily the right
1896- // choice (in particular, it will require the LLVM dylib to be in
1897- // the linker's load path at runtime), but the common use case for
1898- // external LLVMs is distribution provided LLVMs, and in that case
1899- // they're usually in the standard search path (e.g., /usr/lib) and
1900- // copying them here is going to cause problems as we may end up
1901- // with the wrong files and isn't what distributions want.
1902- //
1903- // This behavior may be revisited in the future though.
1904- //
1894+ // If the LLVM was externally provided, then we don't currently copy
1895+ // artifacts into the sysroot. This is not necessarily the right
1896+ // choice (in particular, it will require the LLVM dylib to be in
1897+ // the linker's load path at runtime), but the common use case for
1898+ // external LLVMs is distribution provided LLVMs, and in that case
1899+ // they're usually in the standard search path (e.g., /usr/lib) and
1900+ // copying them here is going to cause problems as we may end up
1901+ // with the wrong files and isn't what distributions want.
1902+ //
1903+ // This behavior may be revisited in the future though.
1904+ //
1905+ // NOTE: this intentionally doesn't use `is_rust_llvm`; whether this is patched or not doesn't matter,
1906+ // we only care if the shared object itself is managed by bootstrap.
1907+ let should_install_llvm = match builder. config . target_config . get ( & target) {
19051908 // If the LLVM is coming from ourselves (just from CI) though, we
19061909 // still want to install it, as it otherwise won't be available.
1910+ Some ( Target { llvm_config : Some ( _) , .. } ) => {
1911+ builder. config . llvm_from_ci && target == builder. config . build
1912+ }
1913+ Some ( Target { llvm_config : None , .. } ) | None => true ,
1914+ } ;
1915+
1916+ if !should_install_llvm {
19071917 return false ;
19081918 }
19091919
0 commit comments