diff --git a/rust-hyperfine.spec b/rust-hyperfine.spec index ccb95b9..e06bd9c 100644 --- a/rust-hyperfine.spec +++ b/rust-hyperfine.spec @@ -3,6 +3,13 @@ %global crate hyperfine +%if 0%{?el8} +# el8 doesn't have these macros +%global __crates_url https://crates.io/api/v1/crates/ +%global crates_source %{__crates_url}%{crate}/%{version}/download#/%{crate}-%{version}.crate +%global version_no_tilde %{version} +%endif + Name: rust-hyperfine Version: 1.14.0 Release: %autorelease @@ -13,12 +20,18 @@ License: MIT OR Apache-2.0 URL: https://crates.io/crates/hyperfine Source0: %{crates_source} Source1: LICENSE.dependencies +# vendored dependencies for EPEL +Source100: %{crate}-%{version}-vendor.tar.xz # Automatically generated patch to strip foreign dependencies Patch: hyperfine-fix-metadata-auto.diff ExclusiveArch: %{rust_arches} +%if 0%{?el8} +BuildRequires: rust-toolset +%else BuildRequires: rust-packaging >= 21 +%endif %global _description %{expand: Command-line benchmarking tool.} @@ -59,10 +72,14 @@ License: MIT AND MPL-2.0 AND (Apache-2.0 OR BSL-1.0) %prep %autosetup -n %{crate}-%{version_no_tilde} -p1 cp %{SOURCE1} . +%if 0%{?el8} +%cargo_prep -V 100 +%else %cargo_prep %generate_buildrequires %cargo_generate_buildrequires +%endif %build %cargo_build