aboutsummaryrefslogtreecommitdiff
path: root/rustables-sys/build.rs
diff options
context:
space:
mode:
authorSimon THOBY <git@nightmared.fr>2021-11-08 19:29:50 +0000
committerSimon THOBY <git@nightmared.fr>2021-11-08 19:29:50 +0000
commite3fea7960d8a962bd25ac3d905d3b67aefc1fa49 (patch)
tree9f1017f302e19bb4ac9ecff3993be932ed3efcd3 /rustables-sys/build.rs
parentc708cc2191aecef86c134174165126f93230c684 (diff)
parent0698c2f2d0b20e0e42e50c498650117b64f8e4c4 (diff)
Merge branch 'auto-bindgen' into 'master'
auto generate sys files See merge request rustwall/rustables!9
Diffstat (limited to 'rustables-sys/build.rs')
-rw-r--r--rustables-sys/build.rs65
1 files changed, 0 insertions, 65 deletions
diff --git a/rustables-sys/build.rs b/rustables-sys/build.rs
deleted file mode 100644
index 52e7329..0000000
--- a/rustables-sys/build.rs
+++ /dev/null
@@ -1,65 +0,0 @@
-extern crate pkg_config;
-
-use std::{env, path::PathBuf};
-
-cfg_if::cfg_if! {
- if #[cfg(feature = "nftnl-1-2-0")] {
- const MIN_VERSION: &str = "1.2.0";
- } else if #[cfg(feature = "nftnl-1-1-2")] {
- const MIN_VERSION: &str = "1.1.2";
- } else if #[cfg(feature = "nftnl-1-1-1")] {
- const MIN_VERSION: &str = "1.1.1";
- } else if #[cfg(feature = "nftnl-1-1-0")] {
- const MIN_VERSION: &str = "1.1.0";
- } else if #[cfg(feature = "nftnl-1-0-9")] {
- const MIN_VERSION: &str = "1.0.9";
- } else if #[cfg(feature = "nftnl-1-0-8")] {
- const MIN_VERSION: &str = "1.0.8";
- } else if #[cfg(feature = "nftnl-1-0-7")] {
- const MIN_VERSION: &str = "1.0.7";
- } else {
- const MIN_VERSION: &str = "1.0.6";
- }
-}
-
-fn get_env(var: &'static str) -> Option<PathBuf> {
- println!("cargo:rerun-if-env-changed={}", var);
- env::var_os(var).map(PathBuf::from)
-}
-
-fn main() {
- if let Some(lib_dir) = get_env("LIBNFTNL_LIB_DIR") {
- if !lib_dir.is_dir() {
- panic!(
- "libnftnl library directory does not exist: {}",
- lib_dir.display()
- );
- }
- println!("cargo:rustc-link-search=native={}", lib_dir.display());
- println!("cargo:rustc-link-lib=nftnl");
- } else {
- // Trying with pkg-config instead
- println!("Minimum libnftnl version: {}", MIN_VERSION);
- pkg_config::Config::new()
- .atleast_version(MIN_VERSION)
- .probe("libnftnl")
- .unwrap();
- }
-
- if let Some(lib_dir) = get_env("LIBMNL_LIB_DIR") {
- if !lib_dir.is_dir() {
- panic!(
- "libmnl library directory does not exist: {}",
- lib_dir.display()
- );
- }
- println!("cargo:rustc-link-search=native={}", lib_dir.display());
- println!("cargo:rustc-link-lib=mnl");
- } else {
- // Trying with pkg-config instead
- pkg_config::Config::new()
- .atleast_version("1.0.0")
- .probe("libmnl")
- .unwrap();
- }
-}