aboutsummaryrefslogtreecommitdiff
path: root/cc/cc-test/build.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2020-04-04 14:39:19 -0700
committerDaniel Mueller <deso@posteo.net>2020-04-04 14:39:19 -0700
commitd0d9683df8398696147e7ee1fcffb2e4e957008c (patch)
tree4baa76712a76f4d072ee3936c07956580b230820 /cc/cc-test/build.rs
parent203e691f46d591a2cc8acdfd850fa9f5b0fb8a98 (diff)
downloadnitrocli-d0d9683df8398696147e7ee1fcffb2e4e957008c.tar.gz
nitrocli-d0d9683df8398696147e7ee1fcffb2e4e957008c.tar.bz2
Remove vendored dependencies
While it appears that by now we actually can get successful builds without Cargo insisting on Internet access by virtue of using the --frozen flag, maintaining vendored dependencies is somewhat of a pain point. This state will also get worse with upcoming changes that replace argparse in favor of structopt and pull in a slew of new dependencies by doing so. Then there is also the repository structure aspect, which is non-standard due to the way we vendor dependencies and a potential source of confusion. In order to fix these problems, this change removes all the vendored dependencies we have. Delete subrepo argparse/:argparse Delete subrepo base32/:base32 Delete subrepo cc/:cc Delete subrepo cfg-if/:cfg-if Delete subrepo getrandom/:getrandom Delete subrepo lazy-static/:lazy-static Delete subrepo libc/:libc Delete subrepo nitrokey-sys/:nitrokey-sys Delete subrepo nitrokey/:nitrokey Delete subrepo rand/:rand
Diffstat (limited to 'cc/cc-test/build.rs')
-rw-r--r--cc/cc-test/build.rs88
1 files changed, 0 insertions, 88 deletions
diff --git a/cc/cc-test/build.rs b/cc/cc-test/build.rs
deleted file mode 100644
index 3065861..0000000
--- a/cc/cc-test/build.rs
+++ /dev/null
@@ -1,88 +0,0 @@
-use std::env;
-use std::fs;
-use std::path::PathBuf;
-
-fn main() {
- let out = PathBuf::from(env::var_os("OUT_DIR").unwrap());
- fs::remove_dir_all(&out).unwrap();
- fs::create_dir(&out).unwrap();
-
- cc::Build::new()
- .file("src/foo.c")
- .flag_if_supported("-Wall")
- .flag_if_supported("-Wfoo-bar-this-flag-does-not-exist")
- .define("FOO", None)
- .define("BAR", "1")
- .compile("foo");
-
- cc::Build::new()
- .file("src/bar1.c")
- .file("src/bar2.c")
- .include("src/include")
- .compile("bar");
-
- let target = std::env::var("TARGET").unwrap();
- let file = target.split("-").next().unwrap();
- let file = format!(
- "src/{}.{}",
- file,
- if target.contains("msvc") { "asm" } else { "S" }
- );
- cc::Build::new().file(file).compile("asm");
-
- cc::Build::new()
- .file("src/baz.cpp")
- .cpp(true)
- .compile("baz");
-
- if target.contains("windows") {
- cc::Build::new().file("src/windows.c").compile("windows");
- }
-
- // Test that the `windows_registry` module will set PATH by looking for
- // nmake which runs vanilla cl, and then also test it after we remove all
- // the relevant env vars from our own process.
- if target.contains("msvc") {
- let out = out.join("tmp");
- fs::create_dir(&out).unwrap();
- println!("nmake 1");
- let status = cc::windows_registry::find(&target, "nmake.exe")
- .unwrap()
- .env_remove("MAKEFLAGS")
- .arg("/fsrc/NMakefile")
- .env("OUT_DIR", &out)
- .status()
- .unwrap();
- assert!(status.success());
-
- fs::remove_dir_all(&out).unwrap();
- fs::create_dir(&out).unwrap();
-
- env::remove_var("PATH");
- env::remove_var("VCINSTALLDIR");
- env::remove_var("INCLUDE");
- env::remove_var("LIB");
- println!("nmake 2");
- let status = cc::windows_registry::find(&target, "nmake.exe")
- .unwrap()
- .env_remove("MAKEFLAGS")
- .arg("/fsrc/NMakefile")
- .env("OUT_DIR", &out)
- .status()
- .unwrap();
- assert!(status.success());
- println!("cargo:rustc-link-lib=msvc");
- println!("cargo:rustc-link-search={}", out.display());
- }
-
- // This tests whether we can build a library but not link it to the main
- // crate. The test module will do its own linking.
- cc::Build::new()
- .cargo_metadata(false)
- .file("src/opt_linkage.c")
- .compile("OptLinkage");
-
- let out = cc::Build::new().file("src/expand.c").expand();
- let out = String::from_utf8(out).unwrap();
- assert!(out.contains("hello world"));
-}