mirror of
https://github.com/logos-blockchain/logos-blockchain-rust-rapidsnark.git
synced 2026-06-07 03:39:29 +00:00
commit
6247daf719
@ -18,12 +18,18 @@ fn main() {
|
||||
let rapidsnark_script_path = Path::new(&out_dir).join(Path::new("download_rapidsnark.sh"));
|
||||
fs::write(&rapidsnark_script_path, RAPIDSNARK_DOWNLOAD_SCRIPT)
|
||||
.expect("Failed to write build script");
|
||||
Command::new("sh")
|
||||
let child_process = Command::new("sh")
|
||||
.arg(rapidsnark_script_path.to_str().unwrap())
|
||||
.spawn()
|
||||
.expect("Failed to spawn rapidsnark download")
|
||||
.wait()
|
||||
.expect("rapidsnark download errored");
|
||||
.spawn();
|
||||
if let Err(e) = child_process {
|
||||
panic!("Failed to spawn rapidsnark download: {}", e);
|
||||
}
|
||||
let status = child_process.unwrap().wait();
|
||||
if let Err(e) = status {
|
||||
panic!("Failed to wait for rapidsnark download: {}", e);
|
||||
} else if !status.unwrap().success() {
|
||||
panic!("Failed to wait for rapidsnark download");
|
||||
}
|
||||
}
|
||||
let absolute_lib_path = if rapidsnark_path.join(&target).exists() {
|
||||
rapidsnark_path.join(&target)
|
||||
|
||||
@ -19,13 +19,34 @@ mkdir -p $BUILD_DIR
|
||||
download_and_unzip() {
|
||||
local target="$1"
|
||||
local zip_file="$BUILD_DIR/$target.zip"
|
||||
curl -L -o $zip_file https://rapidsnark.zkmopro.org/$target.zip
|
||||
unzip $zip_file -d $BUILD_DIR
|
||||
|
||||
echo "Downloading $target..."
|
||||
|
||||
# Download file with error handling
|
||||
if ! curl -L -o "$zip_file" "https://rapidsnark.zkmopro.org/$target.zip"; then
|
||||
echo "Failed to download $target.zip"
|
||||
return 1 # Return failure status
|
||||
fi
|
||||
|
||||
echo "Unzipping $zip_file..."
|
||||
|
||||
# Unzip with error handling
|
||||
if ! unzip "$zip_file" -d "$BUILD_DIR"; then
|
||||
echo "Failed to unzip $zip_file"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "✅ Successfully downloaded and extracted $target.zip"
|
||||
}
|
||||
|
||||
download_and_unzip $TARGET
|
||||
# Check if curl was successful
|
||||
if [ $? -ne 0 ]; then
|
||||
arch=$(echo "$TARGET" | cut -d'-' -f1)
|
||||
download_and_unzip $arch
|
||||
# Try downloading the full target
|
||||
if ! download_and_unzip "$TARGET"; then
|
||||
echo "Retrying with local architecture..."
|
||||
|
||||
local_arch=$(echo "$TARGET" | cut -d'-' -f1)
|
||||
|
||||
if ! download_and_unzip "$local_arch"; then
|
||||
echo "Download failed for both $TARGET and $local_arch"
|
||||
exit 1 # Exit the script with failure
|
||||
fi
|
||||
fi
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user