1
0
Fork 0
mirror of synced 2025-09-23 12:18:44 +00:00

remove git2

This commit is contained in:
dark64 2022-03-15 20:32:54 +01:00
parent 2a9a6cd596
commit 92d84a869e
3 changed files with 29 additions and 183 deletions

162
Cargo.lock generated
View file

@ -974,16 +974,6 @@ dependencies = [
"syn 1.0.80",
]
[[package]]
name = "form_urlencoded"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191"
dependencies = [
"matches",
"percent-encoding",
]
[[package]]
name = "from-pest"
version = "0.3.1"
@ -1136,21 +1126,6 @@ version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7"
[[package]]
name = "git2"
version = "0.13.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f29229cc1b24c0e6062f6e742aa3e256492a5323365e5ed3413599f8a5eff7d6"
dependencies = [
"bitflags",
"libc",
"libgit2-sys",
"log",
"openssl-probe",
"openssl-sys",
"url",
]
[[package]]
name = "glob"
version = "0.2.11"
@ -1205,17 +1180,6 @@ version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "idna"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
dependencies = [
"matches",
"unicode-bidi",
"unicode-normalization",
]
[[package]]
name = "itertools"
version = "0.7.11"
@ -1261,46 +1225,6 @@ version = "0.2.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b2f96d100e1cf1929e7719b7edb3b90ab5298072638fccd77be9ce942ecdfce"
[[package]]
name = "libgit2-sys"
version = "0.12.26+1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19e1c899248e606fbfe68dcb31d8b0176ebab833b103824af31bddf4b7457494"
dependencies = [
"cc",
"libc",
"libssh2-sys",
"libz-sys",
"openssl-sys",
"pkg-config",
]
[[package]]
name = "libssh2-sys"
version = "0.2.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b094a36eb4b8b8c8a7b4b8ae43b2944502be3e59cd87687595cf6b0a71b3f4ca"
dependencies = [
"cc",
"libc",
"libz-sys",
"openssl-sys",
"pkg-config",
"vcpkg",
]
[[package]]
name = "libz-sys"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66"
dependencies = [
"cc",
"libc",
"pkg-config",
"vcpkg",
]
[[package]]
name = "log"
version = "0.4.14"
@ -1316,12 +1240,6 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
[[package]]
name = "matches"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
[[package]]
name = "maybe-uninit"
version = "2.0.0"
@ -1469,25 +1387,6 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "openssl-probe"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a"
[[package]]
name = "openssl-sys"
version = "0.9.67"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69df2d8dfc6ce3aaf44b40dec6f487d5a886516cf6879c49e98e0710f310a058"
dependencies = [
"autocfg",
"cc",
"libc",
"pkg-config",
"vcpkg",
]
[[package]]
name = "output_vt100"
version = "0.1.2"
@ -1508,12 +1407,6 @@ dependencies = [
"rand 0.4.6",
]
[[package]]
name = "percent-encoding"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
[[package]]
name = "pest"
version = "2.1.3"
@ -1598,12 +1491,6 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkg-config"
version = "0.3.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c9b1041b4387893b91ee6746cddfc28516aff326a3519fb2adf820932c5e6cb"
[[package]]
name = "ppv-lite86"
version = "0.2.14"
@ -2184,21 +2071,6 @@ dependencies = [
"crunchy",
]
[[package]]
name = "tinyvec"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f83b2a3d4d9091d0abd7eba4dc2710b1718583bd4d8992e2190720ea38f391f7"
dependencies = [
"tinyvec_macros",
]
[[package]]
name = "tinyvec_macros"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tracing"
version = "0.1.29"
@ -2261,21 +2133,6 @@ dependencies = [
"version_check",
]
[[package]]
name = "unicode-bidi"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f"
[[package]]
name = "unicode-normalization"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9"
dependencies = [
"tinyvec",
]
[[package]]
name = "unicode-width"
version = "0.1.9"
@ -2294,30 +2151,12 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]]
name = "url"
version = "2.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c"
dependencies = [
"form_urlencoded",
"idna",
"matches",
"percent-encoding",
]
[[package]]
name = "utf8-ranges"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba"
[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "vec_map"
version = "0.8.2"
@ -2580,7 +2419,6 @@ dependencies = [
"csv",
"ff_ce 0.9.0",
"getrandom 0.2.3",
"git2",
"hex 0.4.3",
"lazy_static",
"log",

View file

@ -9,7 +9,7 @@ build = "build.rs"
[features]
default = ["bellman", "ark"]
libsnark = ["cc", "cmake", "git2"]
libsnark = ["cc", "cmake"]
bellman = ["bellman_ce", "pairing_ce", "ff_ce", "zokrates_field/bellman"]
wasm = ["bellman_ce/nolog", "bellman_ce/wasm"]
multicore = ["bellman_ce/multicore", "phase2/multicore"]
@ -68,4 +68,3 @@ zokrates_fs_resolver = { version = "0.5", path = "../zokrates_fs_resolver"}
[build-dependencies]
cc = { version = "1.0", features = ["parallel"], optional = true }
cmake = { version = "=0.1.45", optional = true }
git2 = { version = "0.13", optional = true }

View file

@ -2,15 +2,13 @@
extern crate cc;
#[cfg(feature = "libsnark")]
extern crate cmake;
#[cfg(feature = "libsnark")]
extern crate git2;
use std::process::Command;
fn main() {
#[cfg(feature = "libsnark")]
{
use git2::Repository;
use std::env;
use std::fs::remove_dir;
use std::path::PathBuf;
// fetch libsnark source
@ -20,25 +18,36 @@ fn main() {
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
let libsnark_source_path = &out_path.join("libsnark");
let repo = Repository::open(libsnark_source_path).unwrap_or_else(|_| {
remove_dir(libsnark_source_path).ok();
Repository::clone(LIBSNARK_URL, libsnark_source_path).unwrap()
});
if !libsnark_source_path.exists() {
// Clone the repository
let _ = Command::new("git")
.current_dir(out_path)
.args(&["clone", "--no-checkout", LIBSNARK_URL])
.status()
.unwrap();
// Unencrypted `git://` protocol is no longer supported on GitHub
// so we replace all submodule urls to use `https://`
let gitmodules_path = libsnark_source_path.join(".gitmodules");
let gitmodules = std::fs::read_to_string(&gitmodules_path)
.unwrap()
.replace("git://", "https://");
// Checkout the specific commit
let _ = Command::new("git")
.current_dir(libsnark_source_path)
.args(&["checkout", "-f", LIBSNARK_COMMIT])
.status()
.unwrap();
std::fs::write(&gitmodules_path, gitmodules).unwrap();
// Unencrypted `git://` protocol is no longer supported on GitHub
// so we replace all submodule urls to use `https://`
let gitmodules_path = libsnark_source_path.join(".gitmodules");
let gitmodules = std::fs::read_to_string(&gitmodules_path)
.unwrap()
.replace("git://", "https://");
let object = repo.revparse_single(LIBSNARK_COMMIT).unwrap();
repo.checkout_tree(&object, None).unwrap();
std::fs::write(&gitmodules_path, gitmodules).unwrap();
for mut s in repo.submodules().unwrap() {
s.update(true, None).unwrap();
// Update all submodules recursively
let _ = Command::new("git")
.current_dir(libsnark_source_path)
.args(&["submodule", "update", "--init", "--recursive"])
.status()
.unwrap();
}
// build libsnark