mirror of
https://github.com/logos-blockchain/logos-blockchain-rust-rapidsnark.git
synced 2026-06-07 03:39:29 +00:00
chore: remove binaries from repo to publish on crates
This commit is contained in:
parent
e2a33dc2bd
commit
b9321b9cac
@ -15,4 +15,4 @@ num-bigint = "0.4.6"
|
||||
num-traits = "0.2.19"
|
||||
|
||||
[build-dependencies]
|
||||
cc = "1.0"
|
||||
cc = "1.0"
|
||||
|
||||
@ -77,6 +77,10 @@ let valid = rust_rapidsnark::groth16_verify_wrapper(
|
||||
- aarch64-linux-android
|
||||
- x86_64-linux-android
|
||||
|
||||
## Uploaded binaries
|
||||
|
||||
- Rapidsnark artifacts are uploaded [here](https://github.com/vivianjeng/rapidsnark/actions/runs/13075683259)
|
||||
|
||||
## Community
|
||||
|
||||
- Website: [zkmopro.com](https://zkmopro.com)
|
||||
|
||||
@ -2,20 +2,34 @@ 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");
|
||||
|
||||
fn main() {
|
||||
let target = std::env::var("TARGET").unwrap();
|
||||
let target = env::var("TARGET").unwrap();
|
||||
let out_dir = env::var("OUT_DIR").expect("OUT_DIR not set");
|
||||
let arch = target.split('-').next().unwrap();
|
||||
|
||||
// Try to list contents of the target directory
|
||||
let manifest_dir = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
|
||||
let rapidsnark_dir = manifest_dir.join("rapidsnark");
|
||||
let absolute_lib_path = if rapidsnark_dir.join(&target).exists() {
|
||||
rapidsnark_dir.join(&target)
|
||||
let rapidsnark_path = Path::new(&out_dir).join(Path::new("rapidsnark"));
|
||||
// If the rapidsnark repo is not downloaded, download it
|
||||
if !rapidsnark_path.exists() {
|
||||
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")
|
||||
.arg(rapidsnark_script_path.to_str().unwrap())
|
||||
.spawn()
|
||||
.expect("Failed to spawn rapidsnark download")
|
||||
.wait()
|
||||
.expect("rapidsnark download errored");
|
||||
}
|
||||
let absolute_lib_path = if rapidsnark_path.join(&target).exists() {
|
||||
rapidsnark_path.join(&target)
|
||||
} else {
|
||||
rapidsnark_dir.join(arch)
|
||||
rapidsnark_path.join(arch)
|
||||
};
|
||||
|
||||
let compiler = cc::Build::new().get_compiler();
|
||||
let cpp_stdlib = if compiler.is_like_clang() {
|
||||
"c++"
|
||||
|
||||
31
crates/download_rapidsnark.sh
Executable file
31
crates/download_rapidsnark.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Exit on error
|
||||
set -e
|
||||
|
||||
# OUT_DIR is specified by the rust build environment
|
||||
if [ -z $OUT_DIR ]; then
|
||||
echo "OUT_DIR not specified"
|
||||
exit 1
|
||||
fi
|
||||
# TARGET is specified by the rust build environment
|
||||
if [ -z $TARGET ]; then
|
||||
echo "TARGET not specified"
|
||||
exit 1
|
||||
fi
|
||||
BUILD_DIR=$OUT_DIR/rapidsnark
|
||||
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
|
||||
}
|
||||
|
||||
download_and_unzip $TARGET
|
||||
# Check if curl was successful
|
||||
if [ $? -ne 0 ]; then
|
||||
arch=$(echo "$TARGET" | cut -d'-' -f1)
|
||||
download_and_unzip $arch
|
||||
fi
|
||||
@ -1,3 +0,0 @@
|
||||
Built from [here](https://github.com/chancehudson/rapidsnark/tree/rust-ffi). This is built into static libraries and then linked into the rust project. Importantly we need to compile static libraries for each platform we intend to support.
|
||||
|
||||
Linking static libraries instead of compiling from c++ source should make it easier to maintain the `build.rs` script.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user