f.write("\n")
-args = [llvm_config, '--shared-mode']
-args.extend(components)
-llvm_shared, out = runErr(args)
-if llvm_shared:
- llvm_shared = 'shared' in out
+llvm_shared = True
# LLVM libs
-args = [llvm_config, '--libs', '--system-libs']
-args.extend(components)
-out = run(args)
-for lib in out.strip().replace("\n", ' ').split(' '):
- if len(lib) == 0:
- continue
- # in some cases we get extra spaces in between libs so ignore those
- if len(lib) == 1 and lib == ' ':
- continue
- # not all libs strictly follow -lfoo, on Bitrig, there is -pthread
- if lib[0:2] == '-l':
- lib = lib.strip()[2:]
- elif lib[0] == '-':
- lib = lib.strip()[1:]
- # If this actually points at a literal file then we're on MSVC which now
- # prints full paths, so get just the name of the library and strip off the
- # trailing ".lib"
- elif os.path.exists(lib):
- lib = os.path.basename(lib)[:-4]
- elif lib[-4:] == '.lib':
- lib = lib[:-4]
- f.write("#[link(name = \"" + lib + "\"")
- if not llvm_shared and 'LLVM' in lib:
- f.write(", kind = \"static\"")
- f.write(")]\n")
+# Link in Debian full LLVM shared library.
+# FIXME: not sure what to do in the cross-compiling case.
+f.write("#[link(name = \"LLVM-3.9\")]\n")
+
# LLVM ldflags
out = run([llvm_config, '--ldflags'])
let (llvm_kind, llvm_link_arg) = detect_llvm_link(&llvm_config);
- // Link in all LLVM libraries, if we're uwring the "wrong" llvm-config then
- // we don't pick up system libs because unfortunately they're for the host
- // of llvm-config, not the target that we're attempting to link.
- let mut cmd = Command::new(&llvm_config);
- cmd.arg("--libs");
-
- if let Some(link_arg) = llvm_link_arg {
- cmd.arg(link_arg);
- }
-
- if !is_crossed {
- cmd.arg("--system-libs");
- }
- cmd.args(&components[..]);
-
- for lib in output(&mut cmd).split_whitespace() {
- let name = if lib.starts_with("-l") {
- &lib[2..]
- } else if lib.starts_with("-") {
- &lib[1..]
- } else if Path::new(lib).exists() {
- // On MSVC llvm-config will print the full name to libraries, but
- // we're only interested in the name part
- let name = Path::new(lib).file_name().unwrap().to_str().unwrap();
- name.trim_right_matches(".lib")
- } else if lib.ends_with(".lib") {
- // Some MSVC libraries just come up with `.lib` tacked on, so chop
- // that off
- lib.trim_right_matches(".lib")
- } else {
- continue;
- };
-
- // Don't need or want this library, but LLVM's CMake build system
- // doesn't provide a way to disable it, so filter it here even though we
- // may or may not have built it. We don't reference anything from this
- // library and it otherwise may just pull in extra dependencies on
- // libedit which we don't want
- if name == "LLVMLineEditor" {
- continue;
- }
-
- let kind = if name.starts_with("LLVM") {
- llvm_kind
- } else {
- "dylib"
- };
- println!("cargo:rustc-link-lib={}={}", kind, name);
- }
+ // Link in all LLVM libraries
+ // Link in Debian full LLVM shared library.
+ // FIXME: not sure what to do in the cross-compiling case.
+ println!("cargo:rustc-link-lib={}={}", "dylib", "LLVM-3.9");
// LLVM ldflags
//