From b141bb2deb37d68ec6965347a9b34259ff910c2d Mon Sep 17 00:00:00 2001 From: cinerea0 Date: Thu, 9 Jun 2022 17:48:27 -0400 Subject: [PATCH] scryer-prolog: update to 0.9.0 --- .../patches/remove-rustfmt-dep.patch | 74 +++++++++++++++++++ srcpkgs/scryer-prolog/template | 8 +- 2 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 srcpkgs/scryer-prolog/patches/remove-rustfmt-dep.patch diff --git a/srcpkgs/scryer-prolog/patches/remove-rustfmt-dep.patch b/srcpkgs/scryer-prolog/patches/remove-rustfmt-dep.patch new file mode 100644 index 000000000000..477509e22e57 --- /dev/null +++ b/srcpkgs/scryer-prolog/patches/remove-rustfmt-dep.patch @@ -0,0 +1,74 @@ +# https://github.com/mthom/scryer-prolog/commit/11ba7e47fdf6332d5096af9b3083627d9fc6cc94 +diff --git a/build.rs b/build.rs +index e0f1d16ea2..0f457629a0 100644 +--- a/build.rs ++++ b/build.rs +@@ -6,7 +6,7 @@ use std::fs; + use std::fs::File; + use std::io::Write; + use std::path::Path; +-use std::process::Command; ++use std::process::{Command, Stdio}; + + fn find_prolog_files(libraries: &mut File, prefix: &str, current_dir: &Path) { + let entries = match current_dir.read_dir() { +@@ -39,6 +39,16 @@ fn find_prolog_files(libraries: &mut File, prefix: &str, current_dir: &Path) { + } + + fn main() { ++ let has_rustfmt = Command::new("rustfmt") ++ .arg("--version") ++ .stdin(Stdio::inherit()) ++ .status() ++ .is_ok(); ++ ++ if !has_rustfmt { ++ println!("Failed to run rustfmt, will skip formatting generated files.") ++ } ++ + let out_dir = env::var("OUT_DIR").unwrap(); + let dest_path = Path::new(&out_dir).join("libraries.rs"); + +@@ -65,10 +75,9 @@ fn main() { + .write_all(quoted_output.to_string().as_bytes()) + .unwrap(); + +- Command::new("rustfmt") +- .arg(instructions_path.as_os_str()) +- .spawn().unwrap() +- .wait().unwrap(); ++ if has_rustfmt { ++ format_generated_file(instructions_path.as_path()); ++ } + + let static_atoms_path = Path::new(&out_dir).join("static_atoms.rs"); + let mut static_atoms_file = File::create(&static_atoms_path).unwrap(); +@@ -79,10 +88,24 @@ fn main() { + .write_all(quoted_output.to_string().as_bytes()) + .unwrap(); + +- Command::new("rustfmt") +- .arg(static_atoms_path.as_os_str()) +- .spawn().unwrap() +- .wait().unwrap(); ++ if has_rustfmt { ++ format_generated_file(static_atoms_path.as_path()); ++ } + + println!("cargo:rerun-if-changed=src/"); + } ++ ++fn format_generated_file(path: &Path) { ++ Command::new("rustfmt") ++ .arg(path.as_os_str()) ++ .spawn() ++ .unwrap_or_else(|err| { ++ panic!( ++ "{}: rustfmt was detected as available, but failed to format generated file '{}'", ++ err, ++ path.display() ++ ); ++ }) ++ .wait() ++ .unwrap(); ++} diff --git a/srcpkgs/scryer-prolog/template b/srcpkgs/scryer-prolog/template index 3868993d0dd8..c6ae5520be58 100644 --- a/srcpkgs/scryer-prolog/template +++ b/srcpkgs/scryer-prolog/template @@ -1,16 +1,16 @@ # Template file for 'scryer-prolog' pkgname=scryer-prolog -version=0.8.123 -revision=2 +version=0.9.0 +revision=1 build_style=cargo hostmakedepends="m4 pkg-config" -makedepends="gmp-devel mpfr-devel libmpc-devel" +makedepends="gmp-devel libmpc-devel libsodium-devel mpfr-devel openssl-devel" short_desc="Modern Prolog implementation written mostly in Rust" maintainer="Hans-J. Schmid " license="BSD-3-Clause" homepage="https://github.com/mthom/scryer-prolog" distfiles="https://github.com/mthom/scryer-prolog/archive/v${version}.tar.gz" -checksum=4370bc2200e3e56d411326801219bc5fc37a422febdb6cd3548ed3f65b5a44aa +checksum=163ceb97e0fefc12b1144e5244b8b436ab4293432d281c371d61c7498111a930 nocross="executes gmp header https://gitlab.com/tspiteri/gmp-mpfr-sys/-/blob/v1.2.2/build.rs#L1278" export CARGO_FEATURE_USE_SYSTEM_LIBS=1