android13/external/crosvm/base/patches/Android.bp.patch

82 lines
2.8 KiB
Diff

diff --git a/base/Android.bp b/base/Android.bp
index a3fe04d9..55ab423c 100644
--- a/base/Android.bp
+++ b/base/Android.bp
@@ -13,8 +13,6 @@ package {
rust_test {
name: "base_test_src_lib",
defaults: ["crosvm_defaults"],
- // has rustc warnings
- host_supported: true,
crate_name: "base",
cargo_env_compat: true,
cargo_pkg_version: "0.1.0",
@@ -22,7 +20,7 @@ rust_test {
test_suites: ["general-tests"],
auto_gen_config: true,
test_options: {
- unit_test: false,
+ unit_test: true,
},
edition: "2021",
rustlibs: [
@@ -44,14 +42,31 @@ rust_test {
"libbase_poll_token_derive",
"libremain",
],
- static_libs: ["libstdio_fileno"],
+ target: {
+ android: {
+ rustlibs: ["libandroid_log_sys"],
+ },
+ linux_bionic_arm64: {
+ // For ARM architecture, we use aarch64-linux-android for BOTH
+ // device and host targets. As a result, host targets are also
+ // built with target_os = "android". Therefore, sys_util/src/android
+ // is used and thus this android module is required.
+ // This seems incorrect, but is inevitable because rustc doesn't
+ // yet support a Linux-based target using Bionic as libc. We can't
+ // use aarch64-unknown-linux-gnu because it's using glibc which
+ // we don't support for cross-host builds.
+ rustlibs: [
+ "libandroid_log_sys",
+ ],
+ },
+ },
+ shared_libs: ["libcap"], // specified in src/unix/capabilities.rs
}
rust_library {
name: "libbase_rust",
defaults: ["crosvm_defaults"],
stem: "libbase",
- // has rustc warnings
host_supported: true,
crate_name: "base",
cargo_env_compat: true,
@@ -77,5 +92,23 @@ rust_library {
"libbase_poll_token_derive",
"libremain",
],
- static_libs: ["libstdio_fileno"],
+ target: {
+ android: {
+ rustlibs: ["libandroid_log_sys"],
+ },
+ linux_bionic_arm64: {
+ // For ARM architecture, we use aarch64-linux-android for BOTH
+ // device and host targets. As a result, host targets are also
+ // built with target_os = "android". Therefore, sys_util/src/android
+ // is used and thus this android module is required.
+ // This seems incorrect, but is inevitable because rustc doesn't
+ // yet support a Linux-based target using Bionic as libc. We can't
+ // use aarch64-unknown-linux-gnu because it's using glibc which
+ // we don't support for cross-host builds.
+ rustlibs: [
+ "libandroid_log_sys",
+ ],
+ },
+ },
+ shared_libs: ["libcap"], // specified in src/unix/capabilities.rs
}