mirror of
https://github.com/egor-white/zaprett.git
synced 2026-01-28 05:29:51 +05:00
40 lines
1.2 KiB
Rust
40 lines
1.2 KiB
Rust
use once_cell::sync::Lazy;
|
|
use std::env;
|
|
use std::path::{Path, PathBuf};
|
|
|
|
macro_rules! rel_manifest_path {
|
|
($name:ident, $path:expr) => {
|
|
static $name: Lazy<PathBuf> = Lazy::new(|| {
|
|
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
|
Path::new(&manifest_dir).join($path)
|
|
});
|
|
};
|
|
}
|
|
|
|
rel_manifest_path!(NFQ, "libs/zapret/nfq");
|
|
rel_manifest_path!(NFQ_CRYPTO, "libs/zapret/nfq/crypto");
|
|
|
|
fn main() {
|
|
cc::Build::new()
|
|
.files(glob::glob(&format!("{}/*.c", NFQ.display()))
|
|
.unwrap()
|
|
.filter_map(Result::ok))
|
|
.files(glob::glob(&format!("{}/*.c", NFQ_CRYPTO.display()))
|
|
.unwrap()
|
|
.filter_map(Result::ok))
|
|
.include(&*NFQ)
|
|
.include(&*NFQ_CRYPTO)
|
|
.flag("-w")
|
|
.define("main", "nfqws_main")
|
|
.compile("libnfqws.a");
|
|
|
|
println!("cargo:rustc-link-lib=z");
|
|
println!("cargo:rustc-link-lib=netfilter_queue");
|
|
println!("cargo:rustc-link-lib=nfnetlink");
|
|
println!("cargo:rustc-link-lib=mnl");
|
|
|
|
println!("cargo:rustc-link-lib=static=nfqws");
|
|
println!("cargo:rerun-if-changed={}", NFQ.display());
|
|
println!("cargo:rerun-if-changed={}", NFQ_CRYPTO.display());
|
|
}
|