summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--contrib/PKGBUILD.vim2
-rw-r--r--doc/PKGBUILD.5.txt3
-rw-r--r--doc/makepkg.conf.5.txt6
-rw-r--r--etc/makepkg.conf.in5
-rw-r--r--scripts/makepkg.sh.in21
5 files changed, 32 insertions, 5 deletions
diff --git a/contrib/PKGBUILD.vim b/contrib/PKGBUILD.vim
index cf264f93..35ca6bd9 100644
--- a/contrib/PKGBUILD.vim
+++ b/contrib/PKGBUILD.vim
@@ -211,7 +211,7 @@ hi def link pbValidSha512sums Number
" options
syn keyword pb_k_options options contained
-syn match pbOptions /\(no\)\?\(strip\|docs\|libtool\|emptydirs\|zipman\|purge\|upx\|distcc\|color\|ccache\|check\|sign\|makeflags\|buildflags\)/ contained
+syn match pbOptions /\(no\)\?\(strip\|docs\|libtool\|emptydirs\|zipman\|purge\|upx\|optipng\|distcc\|color\|ccache\|check\|sign\|makeflags\|buildflags\)/ contained
syn match pbOptionsNeg /\!/ contained
syn match pbOptionsDeprec /no/ contained
syn region pbOptionsGroup start=/^options=(/ end=/)/ contains=pb_k_options,pbOptions,pbOptionsNeg,pbOptionsDeprec,pbIllegalOption
diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt
index c95c41d8..10980aba 100644
--- a/doc/PKGBUILD.5.txt
+++ b/doc/PKGBUILD.5.txt
@@ -296,6 +296,9 @@ underscore and the architecture name e.g., 'replaces_x86_64=()'.
*upx*;;
Compress binary executable files using UPX.
+ *optipng*;;
+ Optimize PNG images with optipng.
+
*ccache*;;
Allow the use of ccache during build. More useful in its negative
form `!ccache` with select packages that have problems building
diff --git a/doc/makepkg.conf.5.txt b/doc/makepkg.conf.5.txt
index 5e34b916..ac5791fd 100644
--- a/doc/makepkg.conf.5.txt
+++ b/doc/makepkg.conf.5.txt
@@ -140,7 +140,7 @@ Options
Specify a key to use for GPG signing instead of the default key in the
keyring. Can be overridden with makepkg's '\--key' option.
-**OPTIONS=(**strip docs libtool staticlibs emptydirs zipman purge !upx**)**::
+**OPTIONS=(**strip docs libtool staticlibs emptydirs zipman purge !upx !optipng**)**::
This array contains options that affect default packaging. They are
equivalent to options that can be placed in the PKGBUILD; the defaults are
shown here. All options should always be left in the array; to enable or
@@ -181,6 +181,10 @@ Options
Compress binary executable files using UPX. Additional options
can be passed to UPX by specifying the `UPXFLAGS` array variable.
+ *optipng*;;
+ Optimize PNG images with optipng. Additional options can be passed
+ to optipng by specifying the `OPTIPNGFLAGS` array variable.
+
*debug*;;
Add the user-specified debug flags as specified in DEBUG_CFLAGS and
DEBUG_CXXFLAGS to their counterpart buildflags. Creates a separate
diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in
index 19f673d1..71ec624b 100644
--- a/etc/makepkg.conf.in
+++ b/etc/makepkg.conf.in
@@ -71,7 +71,7 @@ BUILDENV=(!distcc color !ccache check !sign)
# These are default values for the options=() settings
#########################################################################
#
-# Default: OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !upx !debug)
+# Default: OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !upx !optipng !debug)
# A negated option will do the opposite of the comments below.
#
#-- strip: Strip symbols from binaries/libraries
@@ -82,9 +82,10 @@ BUILDENV=(!distcc color !ccache check !sign)
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
#-- purge: Remove files specified by PURGE_TARGETS
#-- upx: Compress binary executable files using UPX
+#-- optipng: Optimize PNG images with optipng
#-- debug: Add debugging flags as specified in DEBUG_* variables
#
-OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !upx !debug)
+OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !upx !optipng !debug)
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
INTEGRITY_CHECK=(md5)
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