diff --git a/j9-sys/Cargo.toml b/j9-sys/Cargo.toml index 832858d..1ccb118 100644 --- a/j9-sys/Cargo.toml +++ b/j9-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "j9-sys" -version = "0.1.2" +version = "0.1.3" authors = ["ynqa "] edition = "2021" description = "Rust bindings for jq" diff --git a/j9-sys/build.rs b/j9-sys/build.rs index d29e349..8bb2879 100644 --- a/j9-sys/build.rs +++ b/j9-sys/build.rs @@ -4,9 +4,37 @@ extern crate bindgen; use std::{ env, fs, path::{Path, PathBuf}, + process::Command, }; +fn check_installed(name: &str) -> anyhow::Result<()> { + let check = Command::new(name).arg("--version").output(); + + match check { + Ok(output) => { + if !output.status.success() { + return Err(anyhow::anyhow!( + "{} is required, but it's not installed or not in PATH.", + name + )); + } + } + Err(_) => { + return Err(anyhow::anyhow!( + "{} is required, but it's not installed or not in PATH.", + name + )); + } + } + + Ok(()) +} + fn main() -> anyhow::Result<()> { + // Check if autoconf is installed + check_installed("autoconf")?; + check_installed("automake")?; + let out_dir = env::var("OUT_DIR").map(PathBuf::from)?; let src_dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("jq"); let build_dir = out_dir.join("jq_build"); diff --git a/j9/Cargo.toml b/j9/Cargo.toml index af5e23e..49cde86 100644 --- a/j9/Cargo.toml +++ b/j9/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "j9" -version = "0.1.2" +version = "0.1.3" authors = ["ynqa "] edition = "2021" description = "Rust interface for jq-based JSON processing" @@ -12,7 +12,7 @@ name = "j9" path = "src/lib.rs" [dependencies] -j9-sys = { path = "../j9-sys", version = "0.1.2" } +j9-sys = { path = "../j9-sys", version = "0.1.3" } thiserror = "1.0.57" [dev-dependencies] diff --git a/j9/README.md b/j9/README.md index efd221c..26bbe6e 100644 --- a/j9/README.md +++ b/j9/README.md @@ -9,7 +9,7 @@ To use j9, add it as a dependency in your Cargo.toml: ```toml [dependencies] -j9 = "0.1.1" +j9 = "0.1.3" ``` ## Example