compiler-builtins-zynq/compiler-rt/compiler-rt-cdylib/build.rs
Alex Crichton 8e161a791a Expand and refactor teting infrastructure
This commit moves over most of the testing infrastructure to in-tree docker
images that are all dispatched to from Travis (no other test configuration).
This allows versioning modifications to the test infrastructure as well as the
code itself. Additionally separate docker images allows for easy modification of
one without worrying about tampering of others as well as easy addition of new
targets by simply adding a new `Dockerfile`.

Additionally this commit bundles the master version of the `compiler-rt` source
repository from `llvm-mirror/compiler-rt` to test against. The compiler-rt
library itself is compiled as a `cdylib` which is then dynamically located at
runtime and we look for symbols in. There's a few hoops here, but they currently
get the job done.

All tests now execute against both gcc_s and compiler-rt, and this
testing strategy is now all hidden behind a macro as well (refactoring
all existing tests along the way).
2016-09-28 22:09:55 -07:00

69 lines
1.4 KiB
Rust

extern crate gcc;
use std::env;
use std::path::Path;
use std::process::Command;
struct Sources {
files: Vec<&'static str>,
}
impl Sources {
fn new() -> Sources {
Sources { files: Vec::new() }
}
fn extend(&mut self, sources: &[&'static str]) {
self.files.extend(sources);
}
}
fn main() {
if !Path::new("compiler-rt/.git").exists() {
let _ = Command::new("git").args(&["submodule", "update", "--init"])
.status();
}
let target = env::var("TARGET").expect("TARGET was not set");
let cfg = &mut gcc::Config::new();
if target.contains("msvc") {
cfg.define("__func__", Some("__FUNCTION__"));
} else {
cfg.flag("-fno-builtin");
cfg.flag("-fomit-frame-pointer");
cfg.flag("-ffreestanding");
}
let mut sources = Sources::new();
sources.extend(&[
"muldi3.c",
"mulosi4.c",
"mulodi4.c",
"divsi3.c",
"divdi3.c",
"modsi3.c",
"moddi3.c",
"divmodsi4.c",
"divmoddi4.c",
"ashldi3.c",
"ashrdi3.c",
"lshrdi3.c",
"udivdi3.c",
"umoddi3.c",
"udivmoddi4.c",
"udivsi3.c",
"umodsi3.c",
"udivmodsi4.c",
"adddf3.c",
"addsf3.c",
]);
for src in sources.files.iter() {
cfg.file(Path::new("compiler-rt/lib/builtins").join(src));
}
cfg.compile("libcompiler-rt.a");
}