|
|
[package]
|
|
|
extra-files = [
|
|
|
"%{_mandir}/man1/oxipng.1*",
|
|
|
]
|
|
|
|
|
|
[[package.extra-sources]]
|
|
|
number = 10
|
|
|
file = "https://github.com/shssoichiro/oxipng/archive/v%{version}/oxipng-%{version}-filtered.tar.gz"
|
|
|
comments = [
|
|
|
"""\
|
|
|
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.\
|
|
|
""",
|
|
|
]
|
|
|
[[package.extra-sources]]
|
|
|
number = 11
|
|
|
file = "get_source"
|
|
|
comments = [
|
|
|
"Script used to obtain Source10: ./get_source %%{version}",
|
|
|
]
|
|
|
|
|
|
[[package.extra-patches]]
|
|
|
number = 10
|
|
|
file = "https://github.com/shssoichiro/oxipng/pull/653.patch"
|
|
|
comments = [
|
|
|
"Fix manpage for --zi",
|
|
|
]
|
|
|
|
|
|
[scripts.prep]
|
|
|
pre = [
|
|
|
"""\
|
|
|
# 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 can’t respect upstream’s 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}\
|
|
|
"""
|
|
|
]
|
|
|
|
|
|
[scripts.build]
|
|
|
post = [
|
|
|
"# Generate the man page",
|
|
|
"%{__cargo} run --manifest-path xtask/Cargo.toml -- mangen",
|
|
|
]
|
|
|
|
|
|
[scripts.install]
|
|
|
post = [
|
|
|
"mansrc='target/xtask/mangen/manpages/oxipng.1'",
|
|
|
"mandest='%{buildroot}%{_mandir}/man1'",
|
|
|
"install -t \"${mandest}\" -D -p -m 0644 \"${mansrc}\"",
|
|
|
]
|