diff options
author | Carl Lerche <me@carllerche.com> | 2015-07-09 10:00:54 -0700 |
---|---|---|
committer | Carl Lerche <me@carllerche.com> | 2015-07-09 16:28:51 -0700 |
commit | ecbaadde52ed175d25d01f8fb2723a647947d830 (patch) | |
tree | 6994547f0b7c214426826901b841a51ce695681f /nix-test | |
parent | 1f366ff8285d147cfe3faeb1567c5f047d056a72 (diff) | |
download | nix-ecbaadde52ed175d25d01f8fb2723a647947d830.zip |
Run 32 bit CI builds
Diffstat (limited to 'nix-test')
-rw-r--r-- | nix-test/Cargo.toml | 3 | ||||
-rw-r--r-- | nix-test/Makefile | 11 | ||||
-rw-r--r-- | nix-test/build.rs | 28 | ||||
-rw-r--r-- | nix-test/src/const.c | 2 | ||||
-rw-r--r-- | nix-test/src/sizes.c | 3 |
5 files changed, 35 insertions, 12 deletions
diff --git a/nix-test/Cargo.toml b/nix-test/Cargo.toml index 0082e0e4..e62a8e52 100644 --- a/nix-test/Cargo.toml +++ b/nix-test/Cargo.toml @@ -10,3 +10,6 @@ license = "MIT" [dependencies] libc = "*" + +[build-dependencies] +gcc = "0.3.8" diff --git a/nix-test/Makefile b/nix-test/Makefile deleted file mode 100644 index 67674529..00000000 --- a/nix-test/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -OUT = libnixtest.a -CFLAGS = -fPIC -D$(OS) -OBJS = const.o \ - sizes.o - -$(OUT): $(OBJS) - ar -rcs $@ $^ - -clean: - rm -f $(OBJS) - rm -f $(OUT) diff --git a/nix-test/build.rs b/nix-test/build.rs index b9421014..6717b48c 100644 --- a/nix-test/build.rs +++ b/nix-test/build.rs @@ -1,3 +1,30 @@ +extern crate gcc; + +use std::env; + +pub fn main() { + let target = env::var("TARGET").unwrap(); + + let os = if target.contains("linux") { + "LINUX" + } else if target.contains("darwin") { + "DARWIN" + } else { + "UNKNOWN" + }; + + let mut config = gcc::Config::new(); + + for file in &["src/const.c", "src/sizes.c"] { + config.file(file); + } + + config.define(os, None); + + config.compile("libnixtest.a"); +} + +/* use std::env; use std::process::Command; @@ -28,3 +55,4 @@ pub fn main() { println!("cargo:rustc-flags=-L {}/", out); } +*/ diff --git a/nix-test/src/const.c b/nix-test/src/const.c index 87f6ae5c..42030833 100644 --- a/nix-test/src/const.c +++ b/nix-test/src/const.c @@ -275,8 +275,8 @@ get_int_const(const char* err) { // GET_CONST(SO_PEEK_OFF); GET_CONST(SO_PEERCRED); GET_CONST(SO_SNDBUFFORCE); +#endif return -1; -#endif } diff --git a/nix-test/src/sizes.c b/nix-test/src/sizes.c index 8cf30d20..97a9b4a3 100644 --- a/nix-test/src/sizes.c +++ b/nix-test/src/sizes.c @@ -17,6 +17,9 @@ size_t size_of(const char* type) { + // Builtin + SIZE_OF_T(long); + // sys/socket SIZE_OF_S(sockaddr_storage); |