| 1 | // SPDX-License-Identifier: Apache-2.0 or MIT |
| 2 | // |
| 3 | // Copyright 2021 Sony Group Corporation |
| 4 | // |
| 5 | |
| 6 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/, pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/, strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/}; |
| 7 | |
| 8 | const LIBSECCOMP_LIB_PATHrust-analyzer cargo libseccomp 0.4.0 LIBSECCOMP_LIB_PATH.: &str = "LIBSECCOMP_LIB_PATH"; |
| 9 | |
| 10 | fn mainrust-analyzer cargo libseccomp 0.4.0 main().() { |
| 11 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("cargo:rerun-if-env-changed={}", LIBSECCOMP_LIB_PATHrust-analyzer cargo libseccomp 0.4.0 LIBSECCOMP_LIB_PATH.); |
| 12 | |
| 13 | if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(path) = envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var().(LIBSECCOMP_LIB_PATHrust-analyzer cargo libseccomp 0.4.0 LIBSECCOMP_LIB_PATH.) { |
| 14 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("cargo:rustc-link-search=native={}", path); |
| 15 | let pkgconfig = pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(&path).joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("pkgconfig"); |
| 16 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("PKG_CONFIG_PATH", pkgconfig); |
| 17 | } |
| 18 | |
| 19 | let target = envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var().("TARGET").unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or_default().(); |
| 20 | let host = envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var().("HOST").unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or_default().(); |
| 21 | if target rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().host { |
| 22 | envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::set_varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/set_var().("PKG_CONFIG_ALLOW_CROSS", "1"); |
| 23 | } |
| 24 | |
| 25 | if pkg_configrust-analyzer cargo pkg-config 0.3.34 crate/::Configrust-analyzer cargo pkg-config 0.3.34 Config#::newrust-analyzer cargo pkg-config 0.3.34 impl#[Config]new().() |
| 26 | .atleast_versionrust-analyzer cargo pkg-config 0.3.34 impl#[Config]atleast_version().("2.6.0") |
| 27 | .proberust-analyzer cargo pkg-config 0.3.34 impl#[Config]probe().("libseccomp") |
| 28 | .is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().() |
| 29 | { |
| 30 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("cargo:rustc-cfg=libseccomp_v2_6"); |
| 31 | } |
| 32 | } |