Skip to content

Commit 4afdf51

Browse files
committed
Merge pull request rust-lang#274 from nox/fix-osx-build
Fix OS X build
2 parents 7a8c507 + c2895a9 commit 4afdf51

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

build.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ const LINUX_CLANG_DIRS: &'static [&'static str] = &[
1212
"/usr/lib64/llvm",
1313
"/usr/lib/x86_64-linux-gnu",
1414
];
15-
const MAC_CLANG_DIR: &'static str = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib";
15+
const MAC_CLANG_DIR: &'static [&'static str] = &[
16+
"/usr/local/opt/llvm/lib",
17+
"/Library/Developer/CommandLineTools/usr/lib",
18+
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib",
19+
];
1620
const WIN_CLANG_DIRS: &'static [&'static str] = &["C:\\Program Files\\LLVM\\bin", "C:\\Program Files\\LLVM\\lib"];
1721

1822
fn path_exists(path: &Path) -> bool {
@@ -30,7 +34,7 @@ fn main() {
3034
} else if cfg!(any(target_os = "linux", target_os = "freebsd")) {
3135
LINUX_CLANG_DIRS.iter().map(ToString::to_string).collect()
3236
} else if cfg!(target_os = "macos") {
33-
vec![MAC_CLANG_DIR.to_string()]
37+
MAC_CLANG_DIR.iter().map(ToString::to_string).collect()
3438
} else if cfg!(target_os = "windows") {
3539
WIN_CLANG_DIRS.iter().map(ToString::to_string).collect()
3640
} else {
@@ -55,7 +59,6 @@ fn main() {
5559
None
5660
}
5761
}).next();
58-
5962
if maybe_clang_dir == None && cfg!(target_os = "linux") {
6063
//try to find via lddconfig
6164
//may return line, like
@@ -137,7 +140,7 @@ fn main() {
137140
}
138141
println!("-L {} -l ncursesw -l z -l stdc++", clang_dir.to_str().unwrap());
139142
} else{
140-
println!("cargo:rustc-link-search=native={}", clang_dir.to_str().unwrap());
143+
println!("cargo:rustc-link-search={}", clang_dir.to_str().unwrap());
141144
if !libclang_path_string.is_empty() {
142145
let libclang_path = Path::new(&libclang_path_string);
143146
println!("cargo:rustc-link-lib=dylib=:{}", libclang_path.file_name().unwrap().to_str().unwrap());

0 commit comments

Comments
 (0)