You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rust-oxipng/rust-oxipng.spec

211 lines
6.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# Generated by rust2rpm 27
%bcond check 1
%global crate oxipng
Name: rust-oxipng
Version: 9.1.3
Release: %autorelease
Summary: Lossless PNG compression optimizer
License: MIT
URL: https://crates.io/crates/oxipng
Source: %{crates_source}
# * We need the GitHub archive, in addition to the .crate from crates.io,
# because the crate does not contain the xtask/ directory required for
# generating a man page. However, because of some dubiously-licensed test
# files (https://github.com/shssoichiro/oxipng/issues/655), we must use a
# filtered version of the GitHub archive, obtained by running the script in
# Source11. We have asked upstream to simply include the contents of xtask/ in
# the published crates, https://github.com/shssoichiro/oxipng/issues/654.
Source10: https://github.com/shssoichiro/oxipng/archive/v%{version}/oxipng-%{version}-filtered.tar.gz
# * Script used to obtain Source10: ./get_source %%{version}
Source11: get_source
# Automatically generated patch to strip dependencies and normalize metadata
Patch: oxipng-fix-metadata-auto.diff
# * Fix manpage for --zi
Patch10: https://github.com/shssoichiro/oxipng/pull/653.patch
BuildRequires: cargo-rpm-macros >= 24
%global _description %{expand:
A lossless PNG compression optimizer.}
%description %{_description}
%package -n %{crate}
Summary: %{summary}
# Apache-2.0
# Apache-2.0 OR MIT
# Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
# BSL-1.0
# MIT
# MIT OR Apache-2.0 (duplicate)
# Zlib OR Apache-2.0 OR MIT
License: %{shrink:
Apache-2.0 AND
(Apache-2.0 OR MIT) AND
(Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND
BSL-1.0 AND
MIT AND
(Zlib OR Apache-2.0 OR MIT)
}
# LICENSE.dependencies contains a full license breakdown
%description -n %{crate} %{_description}
%files -n %{crate}
%license LICENSE
%license LICENSE.dependencies
%doc CHANGELOG.md
%doc MANUAL.txt
%doc README.md
%{_bindir}/oxipng
%{_mandir}/man1/oxipng.1*
%package devel
Summary: %{summary}
BuildArch: noarch
%description devel %{_description}
This package contains library source intended for building other packages which
use the "%{crate}" crate.
%files devel
%license %{crate_instdir}/LICENSE
%doc %{crate_instdir}/CHANGELOG.md
%doc %{crate_instdir}/MANUAL.txt
%doc %{crate_instdir}/README.md
%{crate_instdir}/
%package -n %{name}+default-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+default-devel %{_description}
This package contains library source intended for building other packages which
use the "default" feature of the "%{crate}" crate.
%files -n %{name}+default-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+binary-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+binary-devel %{_description}
This package contains library source intended for building other packages which
use the "binary" feature of the "%{crate}" crate.
%files -n %{name}+binary-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+filetime-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+filetime-devel %{_description}
This package contains library source intended for building other packages which
use the "filetime" feature of the "%{crate}" crate.
%files -n %{name}+filetime-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+freestanding-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+freestanding-devel %{_description}
This package contains library source intended for building other packages which
use the "freestanding" feature of the "%{crate}" crate.
%files -n %{name}+freestanding-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+parallel-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+parallel-devel %{_description}
This package contains library source intended for building other packages which
use the "parallel" feature of the "%{crate}" crate.
%files -n %{name}+parallel-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+sanity-checks-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+sanity-checks-devel %{_description}
This package contains library source intended for building other packages which
use the "sanity-checks" feature of the "%{crate}" crate.
%files -n %{name}+sanity-checks-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+zopfli-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+zopfli-devel %{_description}
This package contains library source intended for building other packages which
use the "zopfli" feature of the "%{crate}" crate.
%files -n %{name}+zopfli-devel
%ghost %{crate_instdir}/Cargo.toml
%prep
%autosetup -n %{crate}-%{version} -p1
# Unpacks to oxipng-%%{version}/, *inside* the extracted crate
%setup -q -T -D -a 10 -c -n %{crate}-%{version}
# Required for generating the man page:
#
# Note that the mangen xtask has its own dependencies, so we must run
# %%cargo_generate_buildrequires in the xtask directory if we are to invoke it
# in the build.
mv -v oxipng-%{version}/xtask ./
# We cant respect upstreams lock file, though:
rm xtask/Cargo.lock
# Demonstrate that sources from GitHub are not used to build the executable:
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Rust/#_package_sources
rm -r -v oxipng-%{version}
%cargo_prep
%generate_buildrequires
%cargo_generate_buildrequires
pushd xtask >/dev/null
%cargo_generate_buildrequires
popd >/dev/null
%build
%cargo_build
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies
# Generate the man page
%{__cargo} run --manifest-path xtask/Cargo.toml -- mangen
%install
%cargo_install
mansrc='target/xtask/mangen/manpages/oxipng.1'
mandest='%{buildroot}%{_mandir}/man1'
install -t "${mandest}" -D -p -m 0644 "${mansrc}"
%if %{with check}
%check
%cargo_test
%endif
%changelog
%autochangelog