| Cross-compile for Android, with an NDK nobody has to install 14a30c0 nandi 19d ago | 1 | # The Android toolchain, built. |
| 2 | # |
| 3 | # There is no Android graph in this repo yet — the third-party crates have no |
| 4 | # Android platform in reindeer.toml, so nothing that depends on them can be |
| 5 | # configured for the device — so these are what keep the toolchain honest in |
| 6 | # the meantime. One C object, compiled by the NDK's clang against bionic's |
| 7 | # headers, and one Rust one, compiled against the device's libstd and linked |
| 8 | # by that same clang. Both configured for the device, neither shipping. |
| 9 | # |
| 10 | # just buck build toolchains//selftest:abi-android |
| 11 | # just buck build toolchains//selftest:std-android |
| 12 | cxx_library( |
| 13 | name = "abi", |
| 14 | srcs = ["abi.c"], |
| 15 | visibility = ["PUBLIC"], |
| 16 | ) |
| 17 | |
| 18 | # The target configuration moves; the execution platform does not. Building |
| 19 | # `:abi` directly would compile it for the host, where it is meant to fail. |
| 20 | configured_alias( |
| 21 | name = "abi-android", |
| 22 | actual = ":abi", |
| 23 | platform = "root//platforms:android-arm64", |
| 24 | visibility = ["PUBLIC"], |
| 25 | ) |
| 26 | |
| 27 | rust_library( |
| 28 | name = "std", |
| 29 | srcs = ["abi.rs"], |
| 30 | crate_root = "abi.rs", |
| 31 | edition = "2021", |
| 32 | # Shared, so the link runs: a rlib would prove rustc found the target |
| 33 | # libstd and nothing about whether the linker can produce a device object. |
| 34 | preferred_linkage = "shared", |
| 35 | visibility = ["PUBLIC"], |
| 36 | ) |
| 37 | |
| 38 | configured_alias( |
| 39 | name = "std-android", |
| 40 | actual = ":std", |
| 41 | platform = "root//platforms:android-arm64", |
| 42 | visibility = ["PUBLIC"], |
| 43 | ) |