From 79f39c443347167087339d22ea5fb2c6a9d3246f Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Tue, 26 Apr 2022 22:59:20 -0400 Subject: [PATCH] Simplify Monero build script --- sign/monero/build.rs | 60 +++++++++++++------------------------------- 1 file changed, 18 insertions(+), 42 deletions(-) diff --git a/sign/monero/build.rs b/sign/monero/build.rs index b2e6c802..618373c7 100644 --- a/sign/monero/build.rs +++ b/sign/monero/build.rs @@ -43,48 +43,24 @@ fn main() { &env::consts::DLL_EXTENSION ) ).exists() { - if !Command::new("cp").args(&[ - &format!( - "c/monero/src/crypto/{}cncrypto.{}", - &env::consts::DLL_PREFIX, - &env::consts::DLL_EXTENSION - ), - out_dir - ]).status().unwrap().success() { - panic!("Failed to cp cncrypto"); - } - - if !Command::new("cp").args(&[ - &format!( - "c/monero/src/device/{}device.{}", - &env::consts::DLL_PREFIX, - &env::consts::DLL_EXTENSION - ), - out_dir - ]).status().unwrap().success() { - panic!("Failed to cp device"); - } - - if !Command::new("cp").args(&[ - &format!( - "c/monero/src/ringct/{}ringct_basic.{}", - &env::consts::DLL_PREFIX, - &env::consts::DLL_EXTENSION - ), - out_dir - ]).status().unwrap().success() { - panic!("Failed to cp ringct_basic"); - } - - if !Command::new("cp").args(&[ - &format!( - "c/monero/src/ringct/{}ringct.{}", - &env::consts::DLL_PREFIX, - &env::consts::DLL_EXTENSION - ), - out_dir - ]).status().unwrap().success() { - panic!("Failed to cp ringct"); + for (folder, lib) in [ + ("crypto", "cncrypto"), + ("device", "device"), + ("ringct", "ringct_basic"), + ("ringct", "ringct") + ] { + if !Command::new("cp").args(&[ + &format!( + "c/monero/src/{}/{}{}.{}", + folder, + &env::consts::DLL_PREFIX, + lib, + &env::consts::DLL_EXTENSION + ), + out_dir + ]).status().unwrap().success() { + panic!("Failed to cp {}", lib); + } } println!("cargo:rerun-if-changed=c/wrapper.c");