From 1d3c0aaebf51abdc4ebcf43ca1026a179c18d6a2 Mon Sep 17 00:00:00 2001 From: "Ya-wen, Jeng" Date: Fri, 15 Aug 2025 14:10:36 +0800 Subject: [PATCH] refactor: remove Android-specific linking logic from build script --- crates/build.rs | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/crates/build.rs b/crates/build.rs index 80a5ca9..768aab7 100644 --- a/crates/build.rs +++ b/crates/build.rs @@ -1,7 +1,6 @@ use std::env; use std::fs; use std::path::Path; -use std::path::PathBuf; use std::process::Command; const RAPIDSNARK_DOWNLOAD_SCRIPT: &str = include_str!("./download_rapidsnark.sh"); @@ -71,28 +70,4 @@ fn main() { println!("cargo:rustc-link-lib=dylib=fq"); println!("cargo:rustc-link-lib=dylib=gmp"); } - - // refer to https://github.com/bbqsrc/cargo-ndk to see how to link the libc++_shared.so file in Android - if env::var("CARGO_CFG_TARGET_OS").unwrap() == "android" { - android(); - } -} - -fn android() { - println!("cargo:rustc-link-lib=c++_shared"); - - if let Ok(output_path) = env::var("CARGO_NDK_OUTPUT_PATH") { - let sysroot_libs_path = PathBuf::from(env::var_os("CARGO_NDK_SYSROOT_LIBS_PATH").unwrap()); - let lib_path = sysroot_libs_path.join("libc++_shared.so"); - assert!( - lib_path.exists(), - "Error: Source file {lib_path:?} does not exist" - ); - let dest_dir = Path::new(&output_path).join(env::var("CARGO_NDK_ANDROID_TARGET").unwrap()); - println!("cargo:rerun-if-changed={dest_dir:?}"); - if !dest_dir.exists() { - fs::create_dir_all(&dest_dir).unwrap(); - } - fs::copy(lib_path, Path::new(&dest_dir).join("libc++_shared.so")).unwrap(); - } }