Skip to content

Commit

Permalink
Add check for missing seccomp sources to ensure that they are always …
Browse files Browse the repository at this point in the history
…published
  • Loading branch information
inikulin committed Jan 26, 2024
1 parent 5305113 commit d74c5bc
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions foundations/build.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
use std::env;
use std::path::PathBuf;

fn main() {
ensure_seccomp_sources_fetched();

#[cfg(feature = "security")]
security::build()
}

fn ensure_seccomp_sources_fetched() {
let src_dir =
PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()).join("src/security/libseccomp/src");

if !src_dir.exists() {
panic!(
"Can't find libssecomp sources. Run `git submodule update --init --recursive`. \
This is required even if `security` feature is disabled or the OS is not Linux, \
to ensure that sources are always included on publishing."
);
}
}

#[cfg(feature = "security")]
mod security {
use super::*;
use bindgen::{Builder, CargoCallbacks};
use std::env;
use std::fs;
use std::path::{Path, PathBuf};
use std::path::Path;

const SRC_FILES: &[&str] = &[
"api.c",
Expand Down

0 comments on commit d74c5bc

Please sign in to comment.