summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFelix Obenhuber <flxo@users.noreply.github.com>2024-04-02 11:39:24 +0200
committerGitHub <noreply@github.com>2024-04-02 17:39:24 +0800
commit9354683481ff3c1a874d25f2a4082f14ec253698 (patch)
treef4fd5dcaaf39ca7c4b9d8bb114d8459208435cbe /src
parent6ef2d569b531faf0c0b9dce2f3b0588ca6645e47 (diff)
Enable Android build (#384)
* Support build for target_os android The target_os `android` is quite similar to `linux` but must be mentioned in the guards explicitly. Tested for target `aarch64-linux-android`. * Add target aarch64-linux-android to ci Use `cross` for building target `aarch64-linux-android`. In the `ci` workflow the matrix branch of `os` `ubuntu-latest` is used because the matrix organization is host os centric instead of target. Releases are build with `cross` for target `aarch64-linux-android`. Install `cross` if needed for a run. At the time of writing the latest release of `cross` can't build binaries for target `aarch64-linux-android` and it's common sense that the latest git tag or `master` shall be used [1]. [1] https://github.com/cross-rs/cross/issues/1222 * Add android related readme section
Diffstat (limited to 'src')
-rw-r--r--src/os/mod.rs2
-rw-r--r--src/os/shared.rs4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/os/mod.rs b/src/os/mod.rs
index 7770de9..434c9d7 100644
--- a/src/os/mod.rs
+++ b/src/os/mod.rs
@@ -1,4 +1,4 @@
-#[cfg(target_os = "linux")]
+#[cfg(any(target_os = "android", target_os = "linux"))]
mod linux;
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
diff --git a/src/os/shared.rs b/src/os/shared.rs
index fbe3559..bb0e532 100644
--- a/src/os/shared.rs
+++ b/src/os/shared.rs
@@ -13,7 +13,7 @@ use tokio::runtime::Runtime;
use crate::{network::dns, os::errors::GetInterfaceError, OsInputOutput};
-#[cfg(target_os = "linux")]
+#[cfg(any(target_os = "android", target_os = "linux"))]
use crate::os::linux::get_open_sockets;
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
use crate::os::lsof::get_open_sockets;
@@ -220,7 +220,7 @@ fn eperm_message() -> &'static str {
}
#[inline]
-#[cfg(target_os = "linux")]
+#[cfg(any(target_os = "android", target_os = "linux"))]
fn eperm_message() -> &'static str {
r#"
Insufficient permissions to listen on network interface(s). You can work around