File rpm-macros.libpng-tools of Package libpng16
36
1
# macro: %png_fix path/to/name-of.png
2
# for given png, fixes 'IDAT: invalid distance too far back', etc.,
3
# see pngfix --help
4
#
5
# -q do not output if macro fixed something or find unrecoverable error
6
#
7
# this macro fails only if there is an unrecoverable error in the png
8
# -- pngfix returns nonzero and $png.fixed doesn't exist; run pngfix
9
# on that file, see return code and compare with pngfix --help output
10
%png_fix(q) \
11
if test "x%1" == "x%%1"; then \
12
echo "Missing argument in call to %%png_fix: path and name of png file." \
13
exit 1 \
14
fi \
15
/usr/bin/pngfix %{-q: -qq} --suffix='.fixed' "%1" || true \
16
mv "%1.fixed" "%1" \
17
%nil
18
#
19
# macro: %png_fix_dir
20
# for given directory, search *.png (recursively) and potentionaly
21
# fix 'IDAT: invalid distance too far back', etc., see pngfix --help
22
#
23
# -q do not output if pngfix fixed something or find unrecoverable error
24
#
25
%png_fix_dir(q) \
26
if test "x%1" == "x%%1"; then \
27
echo "Missing argument in call to %%png_fix_dir: dir where to search png files." \
28
exit 1 \
29
fi \
30
for png in `find "%1" -iname '*.png'`; do \
31
# -q will be propagated \
32
%png_fix $png \
33
done \
34
%nil
35
36