1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
// SPDX-License-Identifier: Apache-2.0 or MIT
//
// Copyright 2021 Sony Group Corporation
//
use std::{env, path};
const LIBSECCOMP_LIB_PATH: &str = "LIBSECCOMP_LIB_PATH";
fn main() {
println!("cargo:rerun-if-env-changed={}", LIBSECCOMP_LIB_PATH);
if let Ok(path) = env::var(LIBSECCOMP_LIB_PATH) {
println!("cargo:rustc-link-search=native={}", path);
let pkgconfig = path::Path::new(&path).join("pkgconfig");
env::set_var("PKG_CONFIG_PATH", pkgconfig);
}
let target = env::var("TARGET").unwrap_or_default();
let host = env::var("HOST").unwrap_or_default();
if target != host {
env::set_var("PKG_CONFIG_ALLOW_CROSS", "1");
}
if pkg_config::Config::new()
.atleast_version("2.5.0")
.probe("libseccomp")
.is_ok()
{
println!("cargo:rustc-cfg=libseccomp_v2_5");
}
}
|