mirror of
https://github.com/logos-blockchain/logos-blockchain-rust-rapidsnark.git
synced 2026-06-07 03:39:29 +00:00
feat: add iOS stub source file generation in build script
This commit is contained in:
parent
50d71afbd0
commit
8231d16df1
@ -11,6 +11,11 @@ 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);
|
||||
}
|
||||
|
||||
// Try to list contents of the target directory
|
||||
let rapidsnark_path = Path::new(&out_dir).join(Path::new("rapidsnark"));
|
||||
// If the rapidsnark repo is not downloaded, download it
|
||||
@ -93,3 +98,23 @@ 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