diff options
author | lafleur <lafleur@boum.org> | 2021-11-07 14:19:37 +0100 |
---|---|---|
committer | lafleur <lafleur@boum.org> | 2021-11-07 14:19:37 +0100 |
commit | 1e33e3ab0790d977add329e9686b4b9e5570ba3c (patch) | |
tree | eb55ce7ff42be89be640ce2330e2503349267798 /rustables-sys/build.rs | |
parent | 55d9bf885e009953a0001062b2b60c21e8322a31 (diff) |
call bindgen on build in rustables
Diffstat (limited to 'rustables-sys/build.rs')
-rw-r--r-- | rustables-sys/build.rs | 65 |
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(); - } -} |