crosvm/media/libvda/build.rs
Dennis Kempin a2ecd1eb50 Modify builds via CROSVM_BUILD_VARIANT env var
We currently use cargo features to modify the build process, which
makes them non-additive and prevents us from moving towards
using --all-features in the future.

To change build.rs behavior to integrate with downstream build
systems (e.g. use pkg_config only on chromeos) we will use the newly
added CROSVM_BUILD_VARIANT env variable. Currently only
used by ChromeOS, but not limited to it.

For now, CROSVM_BUILD_VARIANT=chromeos will prevent the
embedding of seccomp policies.

BUG=b:244618505
TEST=Test in combination with https://crrev.com/c/3923813

Change-Id: I2bfe999b5252740d57c73c4a85d73bd343c8259e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3926325
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-10-04 21:23:00 +00:00

14 lines
636 B
Rust

// Copyright 2019 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
fn main() {
// libvda is only avalable on chromeos build.
// To enable clippy checks with this feature enabled upstream we will just skip
// linking the library, allowing the crate to be compiled, but not linked.
println!("cargo:rerun-if-env-changed=CROSVM_BUILD_VARIANT");
if std::env::var("CROSVM_BUILD_VARIANT").unwrap_or(String::new()) == "chromeos" {
pkg_config::probe_library("libvda").unwrap();
println!("cargo:rustc-link-lib=dylib=vda");
}
}