mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-06 10:32:10 +00:00
pkg_config has introduced a new error type, Error::ProbeFailure, with version 0.3.23 and returns this new error for the pattern we were trying to match using Error::Failure. This causes the build script to fail if the host is using version 0.3.23 or later. Chrome OS is still using an older version, but trying to build with cargo is likely to pull a newer one. The pkg_config crate explicitly advises against matching these errors anyway, so change the strategy by ignoring the errors if the chromeos feature is not set. That way we still get clippy coverage while making sure a missing libvda package is caught during builds that actually use it (libvda is not used outside of Chrome OS). BUG=None TEST=cargo build --features "video-decoder,libvda" TEST=emerge-zork-arc-r chromeos-base/crosvm Change-Id: Ib2aad9f41541d3f4fe3cfb89f8b0f857d8033dcb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3347307 Reviewed-by: Chirantan Ekbote <chirantan@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
18 lines
616 B
Rust
18 lines
616 B
Rust
// Copyright 2019 The Chromium OS Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
fn main() {
|
|
#[allow(clippy::single_match)]
|
|
match pkg_config::probe_library("libvda") {
|
|
Ok(_) => (),
|
|
// Ignore pkg-config failures on non-chromeos platforms to allow cargo-clippy to run even
|
|
// if libvda.pc doesn't exist.
|
|
#[cfg(not(feature = "chromeos"))]
|
|
Err(_) => (),
|
|
#[cfg(feature = "chromeos")]
|
|
Err(e) => panic!("{}", e),
|
|
};
|
|
|
|
println!("cargo:rustc-link-lib=dylib=vda");
|
|
}
|