Skip to content

Commit

Permalink
Allow using LIBOQS_NO_VENDOR env var to force system liboqs
Browse files Browse the repository at this point in the history
  • Loading branch information
tranzystorekk committed Sep 13, 2023
1 parent cfb27ea commit 61669e4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion oqs-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ fn probe_includedir() -> PathBuf {
return includedir_from_source();
}

println!("cargo:rerun-if-env-changed=LIBOQS_NO_VENDOR");
let force_no_vendor = std::env::var_os("LIBOQS_NO_VENDOR").map_or(false, |v| v != "0");

let major_version: usize = env!("CARGO_PKG_VERSION_MAJOR").parse().unwrap();
let minor_version: usize = env!("CARGO_PKG_VERSION_MINOR").parse().unwrap();
let patch_version = env!("CARGO_PKG_VERSION_PATCH");
Expand All @@ -148,7 +151,13 @@ fn probe_includedir() -> PathBuf {

match config {
Ok(lib) => lib.include_paths.first().cloned().unwrap(),
_ => includedir_from_source(),
_ => {
if force_no_vendor {
panic!("The env variable LIBOQS_NO_VENDOR has been set but a suitable system liboqs could not be found.");
}

includedir_from_source()
}
}
}

Expand Down

0 comments on commit 61669e4

Please sign in to comment.