mirror of
https://github.com/logos-blockchain/logos-blockchain-rust-rapidsnark.git
synced 2026-06-07 11:49:32 +00:00
feat: integrate chkstk_stub crate and simplify iOS stub handling in build script
This commit is contained in:
parent
33e7c86ff5
commit
9b3c80eacc
10
Cargo.lock
generated
10
Cargo.lock
generated
@ -25,6 +25,15 @@ dependencies = [
|
||||
"shlex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chkstk_stub"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "047f6ab2f3b9bcaf23b593d1580898e4244d27eadf1a1fae99212ee5735d3d1c"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
@ -86,6 +95,7 @@ version = "0.1.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cc",
|
||||
"chkstk_stub",
|
||||
"num-bigint",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
@ -17,3 +17,4 @@ num-traits = "0.2.19"
|
||||
|
||||
[build-dependencies]
|
||||
cc = "1.0"
|
||||
chkstk_stub = "0.1"
|
||||
|
||||
@ -11,10 +11,8 @@ fn main() {
|
||||
let out_dir = env::var("OUT_DIR").expect("OUT_DIR not set");
|
||||
let arch = target.split('-').next().unwrap();
|
||||
|
||||
// Create the stub source file
|
||||
if target.contains("apple-ios") {
|
||||
stub_for_ios(&out_dir);
|
||||
}
|
||||
// See: https://github.com/zkmopro/chkstk_stub
|
||||
chkstk_stub::build();
|
||||
|
||||
// Try to list contents of the target directory
|
||||
let rapidsnark_path = Path::new(&out_dir).join(Path::new("rapidsnark"));
|
||||
@ -98,23 +96,3 @@ fn android() {
|
||||
fs::copy(lib_path, Path::new(&dest_dir).join("libc++_shared.so")).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
fn stub_for_ios(out_dir: &str) {
|
||||
let stub_path = Path::new(&out_dir).join("chkstk_stub.c");
|
||||
fs::write(
|
||||
&stub_path,
|
||||
r#"
|
||||
void __chkstk_darwin(void) {}
|
||||
"#,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// Compile the stub into a static lib
|
||||
cc::Build::new()
|
||||
.file(&stub_path)
|
||||
.out_dir(out_dir)
|
||||
.compile("chkstk_stub");
|
||||
|
||||
println!("cargo:rustc-link-search=native={out_dir}");
|
||||
println!("cargo:rustc-link-lib=static=chkstk_stub");
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user