diff --git a/Cargo.toml b/Cargo.toml index 79ac814..6211774 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,15 +8,11 @@ keywords = ["dyld", "dylib", "shared", "library", "dl_iterate_phdr"] license = "MIT OR Apache-2.0" readme = "./README.md" repository = "https://github.com/gimli-rs/findshlibs" +rust-version = "1.82" [dependencies] libc = "0.2.104" -[build-dependencies] -# Only needed for Android, but cannot be target dependent -# https://github.com/rust-lang/cargo/issues/4932 -cc = "1.0.67" - [target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies] lazy_static = "1.4" diff --git a/build.rs b/build.rs deleted file mode 100644 index 29415f2..0000000 --- a/build.rs +++ /dev/null @@ -1,41 +0,0 @@ -extern crate cc; - -use std::env; - -fn main() { - match env::var("CARGO_CFG_TARGET_OS").unwrap_or_default().as_str() { - "android" => build_android(), - _ => {} - } -} - -fn build_android() { - let expansion = match cc::Build::new().file("src/android-api.c").try_expand() { - Ok(result) => result, - Err(e) => { - println!("cargo:warning=failed to run C compiler: {}", e); - return; - } - }; - - let expansion = match std::str::from_utf8(&expansion) { - Ok(s) => s, - Err(_) => return, - }; - - let marker = "APIVERSION"; - let i = expansion.find(marker).unwrap_or_default(); - - let version = expansion[i + marker.len() + 1..] - .split_whitespace() - .next() - .unwrap_or(""); - let version = version.parse::().unwrap_or_else(|_| { - println!("cargo:warning=failed to get android api version."); - 0 - }); - - if version >= 21 { - println!("cargo:rustc-cfg=feature=\"dl_iterate_phdr\""); - } -} diff --git a/src/android-api.c b/src/android-api.c deleted file mode 100644 index 8af17b4..0000000 --- a/src/android-api.c +++ /dev/null @@ -1,4 +0,0 @@ -// Used from the build script to detect the value of the `__ANDROID_API__` -// builtin #define - -APIVERSION __ANDROID_API__ \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 08c8a94..302a967 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -100,10 +100,7 @@ #[cfg(any(target_os = "macos", target_os = "ios"))] pub mod macos; -#[cfg(any( - target_os = "linux", - all(target_os = "android", feature = "dl_iterate_phdr") -))] +#[cfg(any(target_os = "linux", target_os = "android"))] pub mod linux; #[cfg(target_os = "windows")] @@ -111,14 +108,10 @@ pub mod windows; use std::ffi::OsStr; use std::fmt::{self, Debug}; -use std::usize; pub mod unsupported; -#[cfg(any( - target_os = "linux", - all(target_os = "android", feature = "dl_iterate_phdr") -))] +#[cfg(any(target_os = "linux", target_os = "android"))] use crate::linux as native_mod; #[cfg(any(target_os = "macos", target_os = "ios"))] @@ -131,7 +124,7 @@ use crate::windows as native_mod; target_os = "macos", target_os = "ios", target_os = "linux", - all(target_os = "android", feature = "dl_iterate_phdr"), + target_os = "android", target_os = "windows" )))] use unsupported as native_mod; @@ -145,7 +138,7 @@ pub const TARGET_SUPPORTED: bool = cfg!(any( target_os = "macos", target_os = "ios", target_os = "linux", - all(target_os = "android", feature = "dl_iterate_phdr"), + target_os = "android", target_os = "windows" ));