feat: added FreeBSD support
to make use of it, create a FreeBSD VM with curl installed and install rustup by default from rustup.rs, then run `cargo build -p sparse-05-server`
This commit is contained in:
@@ -20,6 +20,32 @@ fn main() {
|
||||
println!("cargo:rustc-link-search=native={}", std::env::var("SPARSE_BUILD_WINPCAP").unwrap());
|
||||
println!("cargo:rustc-link-search=native={}/x64", std::env::var("SPARSE_BUILD_WINPCAP").unwrap());
|
||||
println!("cargo:rustc-link-lib=wpcap");
|
||||
} else if std::env::var("CARGO_CFG_TARGET_OS").unwrap() == "freebsd" {
|
||||
let libpcap_src = format!("{}/pcap_src", std::env::var("OUT_DIR").unwrap());
|
||||
|
||||
let mut options = CopyOptions::new();
|
||||
options.copy_inside = true;
|
||||
options.skip_exist = true;
|
||||
copy(std::env::var("SPARSE_BUILD_LIBPCAP").unwrap(), &libpcap_src, &options).expect("could not copy libpcap source code to build");
|
||||
|
||||
let dst = cmake::Config::new(&libpcap_src)
|
||||
.profile("MinSizeRel")
|
||||
.define("BUILD_SHARED_LIBS", "OFF")
|
||||
.define("DISABLE_BLUETOOTH", "ON")
|
||||
.define("DISABLE_DAG", "ON")
|
||||
.define("DISABLE_DBUS", "ON")
|
||||
.define("DISABLE_DPDK", "ON")
|
||||
.define("DISABLE_NETMAP", "ON")
|
||||
.define("DISABLE_RDMA", "ON")
|
||||
.define("DISABLE_SEPTEL", "ON")
|
||||
.define("DISABLE_SNF", "ON")
|
||||
.define("DISABLE_TC", "ON")
|
||||
.build();
|
||||
|
||||
// panic!("hahahahah test {}", dst.display());
|
||||
println!("cargo:rustc-link-search=native={}/lib", dst.display());
|
||||
println!("cargo:rustc-link-search=native={}/lib64", dst.display());
|
||||
println!("cargo:rustc-link-lib=static=pcap");
|
||||
} else {
|
||||
let libpcap_src = format!("{}/pcap_src", std::env::var("OUT_DIR").unwrap());
|
||||
|
||||
@@ -29,6 +55,7 @@ fn main() {
|
||||
copy(std::env::var("SPARSE_BUILD_LIBPCAP").unwrap(), &libpcap_src, &options).expect("could not copy libpcap source code to build");
|
||||
|
||||
let dst = cmake::Config::new(&libpcap_src)
|
||||
.profile("MinSizeRel")
|
||||
.define("BUILD_SHARED_LIBS", "OFF")
|
||||
.define("BUILD_WITH_LIBNL", "OFF")
|
||||
.define("DISABLE_BLUETOOTH", "ON")
|
||||
|
||||
Reference in New Issue
Block a user