Skip to content

Commit

Permalink
Exclude SIG_STFL from build
Browse files Browse the repository at this point in the history
Signed-off-by: Spencer Wilson <[email protected]>
  • Loading branch information
SWilson4 committed Dec 17, 2024
1 parent 36f5d85 commit 0748cf2
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions oqs-sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::path::{Path, PathBuf};

fn generate_bindings(includedir: &Path, headerfile: &str, filter: &str) {
fn generate_bindings(includedir: &Path, headerfile: &str, allow_filter: &str, block_filter: &str) {
let out_path = PathBuf::from(std::env::var("OUT_DIR").unwrap());
bindgen::Builder::default()
.clang_arg(format!("-I{}", includedir.display()))
Expand All @@ -19,11 +19,14 @@ fn generate_bindings(includedir: &Path, headerfile: &str, filter: &str) {
// Don't generate docs unless enabled
// Otherwise it breaks tests
.generate_comments(cfg!(feature = "docs"))
// Whitelist OQS stuff
// Allowlist/blocklist OQS stuff
.allowlist_recursively(false)
.allowlist_type(filter)
.allowlist_function(filter)
.allowlist_var(filter)
.allowlist_type(allow_filter)
.allowlist_function(allow_filter)
.allowlist_var(allow_filter)
.blocklist_type(block_filter)
.blocklist_function(block_filter)
.allowlist_var(block_filter)
// Use core and libc
.use_core()
.ctypes_prefix("::libc")
Expand Down Expand Up @@ -170,12 +173,14 @@ fn main() {
bindgen::clang_version();

let includedir = probe_includedir();
let gen_bindings = |file, filter| generate_bindings(&includedir, file, filter);
let gen_bindings = |file, allow_filter, block_filter| {
generate_bindings(&includedir, file, allow_filter, block_filter)
};

gen_bindings("common", "OQS_.*");
gen_bindings("rand", "OQS_(randombytes|RAND)_.*");
gen_bindings("kem", "OQS_KEM.*");
gen_bindings("sig", "OQS_SIG.*");
gen_bindings("common", "OQS_.*", "");
gen_bindings("rand", "OQS_(randombytes|RAND)_.*", "");
gen_bindings("kem", "OQS_KEM.*", "");
gen_bindings("sig", "OQS_SIG.*", "OQS_SIG_STFL.*");

// https://docs.rs/build-deps/0.1.4/build_deps/fn.rerun_if_changed_paths.html
build_deps::rerun_if_changed_paths("liboqs/src/**/*").unwrap();
Expand Down

0 comments on commit 0748cf2

Please sign in to comment.