@@ -1847,21 +1847,23 @@ fn add_env(builder: &Builder<'_>, cmd: &mut Command, target: TargetSelection) {
18471847///
18481848/// Returns whether the files were actually copied.
18491849fn maybe_install_llvm ( builder : & Builder < ' _ > , target : TargetSelection , dst_libdir : & Path ) -> bool {
1850- if !builder. is_rust_llvm ( target) {
1851- // If the LLVM was externally provided, then we don't currently copy
1852- // artifacts into the sysroot. This is not necessarily the right
1853- // choice (in particular, it will require the LLVM dylib to be in
1854- // the linker's load path at runtime), but the common use case for
1855- // external LLVMs is distribution provided LLVMs, and in that case
1856- // they're usually in the standard search path (e.g., /usr/lib) and
1857- // copying them here is going to cause problems as we may end up
1858- // with the wrong files and isn't what distributions want.
1859- //
1860- // This behavior may be revisited in the future though.
1861- //
1862- // If the LLVM is coming from ourselves (just from CI) though, we
1863- // still want to install it, as it otherwise won't be available.
1864- return false ;
1850+ if let Some ( config) = builder. config . target_config . get ( & target) {
1851+ if config. llvm_config . is_some ( ) && !builder. config . llvm_from_ci {
1852+ // If the LLVM was externally provided, then we don't currently copy
1853+ // artifacts into the sysroot. This is not necessarily the right
1854+ // choice (in particular, it will require the LLVM dylib to be in
1855+ // the linker's load path at runtime), but the common use case for
1856+ // external LLVMs is distribution provided LLVMs, and in that case
1857+ // they're usually in the standard search path (e.g., /usr/lib) and
1858+ // copying them here is going to cause problems as we may end up
1859+ // with the wrong files and isn't what distributions want.
1860+ //
1861+ // This behavior may be revisited in the future though.
1862+ //
1863+ // If the LLVM is coming from ourselves (just from CI) though, we
1864+ // still want to install it, as it otherwise won't be available.
1865+ return false ;
1866+ }
18651867 }
18661868
18671869 // On macOS, rustc (and LLVM tools) link to an unversioned libLLVM.dylib
0 commit comments