Skip to content

Commit

Permalink
ci: use winpcap 4.1.3.20161116 for CI since npcap free version does n…
Browse files Browse the repository at this point in the history
  • Loading branch information
ttys3 committed Jan 20, 2023
1 parent 9b3ddd2 commit 211da1f
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fn main() {
}

#[cfg(windows)]
download_winpcap_dll();
install_winpcap();
}

fn download_winpcap_sdk() {
Expand Down Expand Up @@ -35,12 +35,8 @@ fn download_winpcap_sdk() {

let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
let lib_dir = match target_arch.as_str() {
"x86_64" => {
"Lib/x64"
}
_ => {
"Lib"
}
"x86_64" => "Lib/x64",
_ => "Lib",
};

let lib_path = format!("{}/{}", lib_dir, lib_name);
Expand All @@ -63,6 +59,7 @@ fn download_winpcap_sdk() {
println!("cargo:rustc-link-search=native={}/{}", out_dir, lib_dir);
}

#[allow(dead_code)]
#[cfg(windows)]
fn download_winpcap_dll() {
use http_req::request;
Expand Down Expand Up @@ -105,3 +102,21 @@ fn download_winpcap_dll() {
panic!("CFixInstall.bat failing with error: {:?}", output);
}
}

#[cfg(windows)]
fn install_winpcap() {
use std::process::Command;

// cinst -y winpcap --version 4.1.3.20161116
let output = Command::new("cinst")
.arg("-y")
.arg("winpcap")
.arg("--version")
.arg("4.1.3.20161116")
.output()
.expect("failed to run winpcap install command");

if !output.status.success() {
panic!("install winpcap failing with error: {:?}", output);
}
}

0 comments on commit 211da1f

Please sign in to comment.