diff options
Diffstat (limited to 'scripts/makepkg.sh.in')
-rw-r--r-- | scripts/makepkg.sh.in | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 4640f033..40913c5e 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -49,7 +49,7 @@ declare -r startdir="$PWD" LIBRARY=${LIBRARY:-'@libmakepkgdir@'} packaging_options=('strip' 'docs' 'libtool' 'staticlibs' 'emptydirs' 'zipman' - 'purge' 'upx' 'debug') + 'purge' 'upx' 'optipng' 'debug') other_options=('ccache' 'distcc' 'buildflags' 'makeflags') splitpkg_overrides=('pkgdesc' 'arch' 'url' 'license' 'groups' 'depends' 'optdepends' 'provides' 'conflicts' 'replaces' 'backup' @@ -1918,6 +1918,17 @@ tidy_install() { fi done fi + + if check_option "optipng" "y"; then + msg2 "$(gettext "Optimizing PNG images...")" + local png + find . -type f -iname "*.png" 2>/dev/null | while read -r png ; do + if [[ $(file --brief --mime-type "$png") = 'image/png' ]]; then + optipng "${OPTIPNGFLAGS[@]}" "$png" &>/dev/null || + warning "$(gettext "Could not optimize PNG image : %s")" "${png/$pkgdir\//}" + fi + done + fi } find_libdepends() { @@ -3008,6 +3019,14 @@ check_software() { fi fi + # optipng - PNG image optimization + if check_option "optipng" "y"; then + if ! type -p optipng >/dev/null; then + error "$(gettext "Cannot find the %s binary required for optimizing PNG images.")" "optipng" + ret=1 + fi + fi + # distcc - compilation with distcc if check_buildenv "distcc" "y" && ! check_option "distcc" "n"; then if ! type -p distcc >/dev/null; then |