libpng16/rpm-macros.libpng-tools

42 lines
1.2 KiB
Plaintext

# macro: %png_fix_too_far_back path/to/name-of.png
# for given png, fixes 'IDAT: invalid distance too far back'
#
# -v output if macro fixed something or find unrecoverable error
#
%png_fix_too_far_back(v) \
if test "x%1" == "x%%1"; then \
echo "Missing argument in call to %%png_fix_too_far_back: path and name of png file." \
exit 1 \
fi \
/usr/bin/png-fix-too-far-back "%1" \
case $? in \
0) # no need to fix \
;; \
1) /usr/bin/png-fix-too-far-back -i "%1" \
%{-v: echo "fixed: %1" } \
;; \
2) %{-v: echo "unrecoverable error: %1" } \
;; \
3) echo "%1 not found" \
;; \
esac \
%nil
#
# macro: %png_fix_too_far_back dir
# for given directory, search *.png (recursively) and potentionaly
# fix 'IDAT: invalid distance too far back'
#
# -v output if macro fixed something or find unrecoverable error
#
%png_fix_too_far_back_dir(v) \
if test "x%1" == "x%%1"; then \
echo "Missing argument in call to %%png_fix_too_far_back_dir: dir where to search png files." \
exit 1 \
fi \
for png in `find "%1" -iname '*.png'`; do \
# -v will be propagated \
%png_fix_too_far_back $png \
done \
%nil