Remove the Monero build (#64)

* Remove the Monero CMake and make

* Download the Monero daemon instead of building it

* Cache the Monero daemon

Prevents hammering the Monero servers, should reduce CI time.

* Correct YAML

* Add back sodium-dev

* Create an independent job for downloading the Monero daemon

Improves parallelism while decreasing the amount of work re-done if 
build fails. Also increases modularity.

* Correct Monero job definition

* Correct skipping the Monero download on cache hit
This commit is contained in:
Luke Parker
2022-07-23 03:35:32 -05:00
committed by GitHub
parent b80c1bec4c
commit 42d62c38b9
3 changed files with 39 additions and 113 deletions

View File

@@ -1,4 +1,4 @@
use std::{env, path::Path, process::Command};
use std::process::Command;
fn main() {
if !Command::new("git")
@@ -10,71 +10,6 @@ fn main() {
panic!("git failed to init submodules");
}
if !Command::new("mkdir")
.args(&["-p", ".build"])
.current_dir(&Path::new("c"))
.status()
.unwrap()
.success()
{
panic!("failed to create a directory to track build progress");
}
let out_dir = &env::var("OUT_DIR").unwrap();
// Use a file to signal if Monero was already built, as that should never be rebuilt
// If the signaling file was deleted, run this script again to rebuild Monero though
println!("cargo:rerun-if-changed=c/.build/monero");
if !Path::new("c/.build/monero").exists() {
if !Command::new("mkdir")
.args(&["-p", "build/release"])
.current_dir(&Path::new("c/monero"))
.status()
.unwrap()
.success()
{
panic!("failed to mkdir");
}
if !Command::new("cmake")
.args(&[
"-D",
&format!("ARCH={}", &env::var("ARCH").unwrap_or_else(|_| "native".to_string())),
"-D",
"BUILD_TESTS=OFF",
"-D",
"CMAKE_BUILD_TYPE=Release",
"../..",
])
.current_dir(&Path::new("c/monero/build/release"))
.status()
.unwrap()
.success()
{
panic!("failed to call cmake. Please check your dependencies");
}
if !Command::new("make")
.arg(format!("-j{}", &env::var("THREADS").unwrap_or_else(|_| "2".to_string())))
.current_dir(&Path::new("c/monero/build/release"))
.status()
.unwrap()
.success()
{
panic!("make failed to build Monero. Please check your dependencies");
}
if !Command::new("touch")
.arg("monero")
.current_dir(&Path::new("c/.build"))
.status()
.unwrap()
.success()
{
panic!("failed to create a file to label Monero as built");
}
}
println!("cargo:rerun-if-changed=c/wrapper.cpp");
#[rustfmt::skip]
cc::Build::new()
@@ -101,9 +36,6 @@ fn main() {
.file("c/monero/src/crypto/keccak.c")
.file("c/monero/src/crypto/hash.c")
.include("c/monero/src/device")
.file("c/monero/src/device/device_default.cpp")
.include("c/monero/src/ringct")
.file("c/monero/src/ringct/rctCryptoOps.c")
.file("c/monero/src/ringct/rctTypes.cpp")
@@ -115,7 +47,6 @@ fn main() {
.file("c/wrapper.cpp")
.compile("wrapper");
println!("cargo:rustc-link-search={}", out_dir);
println!("cargo:rustc-link-lib=wrapper");
println!("cargo:rustc-link-lib=stdc++");
}