rust-rpm-sequoia/rust-rpm-sequoia.spec
2023-06-28 00:02:48 +02:00

112 lines
2.9 KiB
RPMSpec

# Generated by rust2rpm 24
%bcond_without check
# RHEL does not have packages for Rust dependencies
%if 0%{?rhel}
%global bundled_rust_deps 1
%else
%global bundled_rust_deps 0
%endif
%global crate rpm-sequoia
Name: rust-rpm-sequoia
Version: 1.4.1
Release: %autorelease
Summary: Implementation of the RPM PGP interface using Sequoia
License: LGPL-2.0-or-later
URL: https://crates.io/crates/rpm-sequoia
Source: %{crates_source}
# To create the vendor tarball:
# tar xf %%{crate}-%%{version}.crate ; pushd %%{crate}-%%{version} ; \
# patch -p1 < ../rpm-sequoia-fix-metadata.diff ; \
# cargo vendor && tar Jcvf ../%%{crate}-%%{version}-vendor.tar.xz vendor/ ; popd
Source1: %{crate}-%{version}-vendor.tar.xz
# Manually created patch for downstream crate metadata changes
# * default to the OpenSSL crypto backend of sequoia-openpgp
Patch: rpm-sequoia-fix-metadata.diff
%if 0%{?bundled_rust_deps}
BuildRequires: rust-toolset
# vendored openssl-sys
BuildRequires: openssl-devel
%else
BuildRequires: rust-packaging >= 23
%endif
%global _description %{expand:
An implementation of the RPM PGP interface using Sequoia.}
%description %{_description}
%package -n %{crate}
Summary: %{summary}
# (MIT OR Apache-2.0) AND Unicode-DFS-2016
# Apache-2.0
# Apache-2.0 OR MIT
# BSL-1.0
# LGPL-2.0-or-later
# MIT
# MIT OR Apache-2.0
# MIT OR Apache-2.0 OR Zlib
# Unlicense OR MIT
# Zlib OR Apache-2.0 OR MIT
License: LGPL-2.0-or-later AND Apache-2.0 AND BSL-1.0 AND MIT AND Unicode-DFS-2016 AND (Apache-2.0 OR MIT) AND (MIT OR Apache-2.0 OR Zlib) AND (Unlicense OR MIT)
# LICENSE.dependencies contains a full license breakdown
%description -n %{crate} %{_description}
%files -n %{crate}
%license LICENSE.txt
%license LICENSE.dependencies
%doc README.md
%{_libdir}/librpm_sequoia.so.1
%package -n %{crate}-devel
Summary: %{summary}
Requires: %{crate}%{?_isa} = %{version}-%{release}
%description -n %{crate}-devel %{_description}
%files -n %{crate}-devel
%{_libdir}/librpm_sequoia.so
%{_libdir}/pkgconfig/rpm-sequoia.pc
%prep
%autosetup -n %{crate}-%{version_no_tilde} -p1
%if 0%{?bundled_rust_deps}
%cargo_prep -V 1
%else
%cargo_prep
%generate_buildrequires
%cargo_generate_buildrequires
%endif
%build
# build script uses environment variables to populate the pkgconfig file
export PREFIX="%{_prefix}"
export LIBDIR="%{_libdir}"
%cargo_build
%{?cargo_license_summary}
%{?cargo_license} > LICENSE.dependencies
%install
# install shared library
mkdir -p %{buildroot}/%{_libdir}
cp -pav target/release/librpm_sequoia.so %{buildroot}/%{_libdir}/librpm_sequoia.so.1
# create unversioned symlink
ln -s librpm_sequoia.so.1 %{buildroot}/%{_libdir}/librpm_sequoia.so
# install pkg-config file
mkdir -p %{buildroot}/%{_libdir}/pkgconfig
cp -pav target/release/rpm-sequoia.pc %{buildroot}/%{_libdir}/pkgconfig/
%if %{with check}
%check
%cargo_test
%endif
%changelog
%autochangelog