diff --git a/Cargo.toml b/Cargo.toml index 54e57de..37bb584 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ description = "A tool that helps to build .msp file mod" readme = "README.md" license = "MIT" keywords = ["switch", "nintendo", "mod", "mods", "msp"] +build = "build.rs" [dependencies] diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..1559c09 --- /dev/null +++ b/build.rs @@ -0,0 +1,26 @@ +use std::process::Command; +use std::path::Path; + + +fn main() { + let switch_tools_dir = Path::new("switch-tools"); + + let autogen_status = Command::new("./autogen.sh") + .current_dir(switch_tools_dir) + .status() + .expect("Couldn't run autogen.sh"); + + let conf_status = Command::new("./configure") + .current_dir(switch_tools_dir) + .status(). + expect("Couldn't run configure"); + + let make_status = Command::new("make") + .current_dir(switch_tools_dir) + .status() + .expect("Couldn't run make"); + + if !autogen_status.success() || !conf_status.success() || !make_status.success() { + panic!("Something went wrong trying to build switch-tools"); + } +} \ No newline at end of file