From 4bf128a84ca12d1cf061b8c507a0d6dcab5c6d2b Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Mon, 10 Oct 2016 16:18:18 -0500 Subject: [PATCH] add a rustbuild cargo feature for integration with rust-lang/rust --- build.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 046085a..c0fdb52 100644 --- a/build.rs +++ b/build.rs @@ -407,8 +407,15 @@ fn main() { sources.remove(&["aeabi_cdcmp", "aeabi_cfcmp"]); } + let root = if env::var_os("CARGO_FEATURE_RUSTBUILD").is_some() { + Path::new("../../libcompiler_builtins") + } else { + Path::new(".") + }; + + let src_dir = root.join("compiler-rt/compiler-rt-cdylib/compiler-rt/lib/builtins"); for src in sources.map.values() { - let src = Path::new("compiler-rt/compiler-rt-cdylib/compiler-rt/lib/builtins").join(src); + let src = src_dir.join(src); cfg.file(&src); println!("cargo:rerun-if-changed={}", src.display()); }