Build with vendored crates on EPEL 8

Signed-off-by: Michel Alexandre Salim <salimma@fedoraproject.org>
This commit is contained in:
Michel Alexandre Salim 2022-11-18 09:58:07 -05:00
parent baeab99834
commit 2ff29170be
No known key found for this signature in database
GPG Key ID: 8B229D2F7CCC04F2

View File

@ -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