[pacman-dev] [PATCH 1/1] add option to optimize PNG images with optipng

Allan McRae allan at archlinux.org
Sat Jan 24 06:17:24 UTC 2015


On 24/01/15 00:40, Florian Pritz wrote:
> On 22.01.2015 09:36, Christian Hesse wrote:
>> --- a/scripts/makepkg.sh.in
>> +++ b/scripts/makepkg.sh.in
>> @@ -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 -bi "$png") = *'image/png'* ]]; then
> 
> Better use "file -b --mime-type" and get rid of the globs.
> 

hrm...   is there a reason why we don't use this elsewhere in makepkg?

>> +				optipng "$png" &>/dev/null ||

Do this:

optipng $OPTIPNGFLAGS "$png" &>/dev/null ||

then people can specify options they want to pass to optipng - see the
upx option.

A


>> +					warning "$(gettext "Could not optimize PNG image : %s")" "${png/$pkgdir\//}"
>> +			fi
>> +		done
>> +	fi
>>  }
>>  
>>  find_libdepends() {
> 
> 


More information about the pacman-dev mailing list