mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-28 17:44:10 +00:00
c4a4dc9b23
BUG=b:237011316 TEST=presubmit and tested in wine Change-Id: I1b6160142b8161d4b09d3fd98dfacde354e238b4 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3934818 Reviewed-by: Dennis Kempin <denniskempin@google.com> Commit-Queue: Vikram Auradkar <auradkar@google.com>
40 lines
1.5 KiB
Rust
40 lines
1.5 KiB
Rust
// Copyright 2020 The ChromiumOS Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
static PREBUILTS_VERSION_FILENAME: &str = "prebuilts_version";
|
|
static SLIRP_LIB: &str = "libslirp.lib";
|
|
static SLIRP_DLL: &str = "libslirp-0.dll";
|
|
#[cfg(unix)]
|
|
static GLIB_FILENAME: &str = "libglib-2.0.dll.a";
|
|
|
|
fn main() {
|
|
// We (the Windows crosvm maintainers) submitted upstream patches to libslirp-sys so it doesn't
|
|
// try to link directly on Windows. This is because linking on Windows tends to be specific
|
|
// to the build system that invokes Cargo (e.g. the crosvm jCI scripts that also produce the
|
|
// required libslirp DLL & lib). The integration here (win_slirp::main) is specific to crosvm's
|
|
// build process.
|
|
if std::env::var("CARGO_CFG_WINDOWS").is_ok() {
|
|
let version = std::fs::read_to_string(PREBUILTS_VERSION_FILENAME)
|
|
.unwrap()
|
|
.trim()
|
|
.parse::<u32>()
|
|
.unwrap();
|
|
// TODO(b:242204245) build libslirp locally on windows from build.rs.
|
|
prebuilts::download_prebuilts(
|
|
"libslirp",
|
|
version,
|
|
&[
|
|
SLIRP_DLL,
|
|
SLIRP_LIB,
|
|
#[cfg(unix)]
|
|
// When compiling with mingw64 to run under wine64, we need glib as slirp links
|
|
// against it.
|
|
GLIB_FILENAME,
|
|
],
|
|
)
|
|
.unwrap();
|
|
}
|
|
|
|
// For unix, libslirp-sys's build script will make the appropriate linking calls to pkg_config.
|
|
}
|