cookutils diff cook @ rev 865

Split modules/compressor (~500 lines of code) from cook.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Wed Jan 11 11:53:04 2017 +0200 (2017-01-11)
parents e6307b60adc8
children 5f6be706ab4f
line diff
     1.1 --- a/cook	Wed Jan 11 00:31:18 2017 +0200
     1.2 +++ b/cook	Wed Jan 11 11:53:04 2017 +0200
     1.3 @@ -480,311 +480,6 @@
     1.4  }
     1.5  
     1.6  
     1.7 -# Get list of supported locales...
     1.8 -
     1.9 -get_supported_locales() {
    1.10 -	local lpc='/slitaz-i18n/stuff/locale-pack.conf' LOCALE_PACK
    1.11 -	if [ -e "$WOK$lpc" ]; then
    1.12 -		# ... from package in the local wok
    1.13 -		. "$WOK$lpc"
    1.14 -	else
    1.15 -		# ... from Hg
    1.16 -		temp_conf=$(mktemp)
    1.17 -		wget -q -O $temp_conf -T 10 "http://hg.slitaz.org/wok/raw-file/tip$lpc"
    1.18 -		if [ -s $temp_conf ]; then
    1.19 -			. $temp_conf
    1.20 -		else
    1.21 -			# Give up and use hardcoded list
    1.22 -			LOCALE_PACK="ar ca cs da de el en es fi fr hr hu id is it ja nb nl nn pl pt \
    1.23 -			pt_BR ro ru sl sv tr uk zh_CN zh_TW"
    1.24 -		fi
    1.25 -		rm $temp_conf
    1.26 -	fi
    1.27 -	echo $LOCALE_PACK
    1.28 -}
    1.29 -
    1.30 -
    1.31 -# Fix common errors and warnings in the .desktop files
    1.32 -# Fixing can be disabled with COOKOPTS="!fixdesktops"
    1.33 -
    1.34 -fix_desktop_files() {
    1.35 -	[ "${COOKOPTS/!fixdesktops/}" != "$COOKOPTS" ] && return
    1.36 -	[ -z "$(find $install -type f -name '*.desktop')" ] && return
    1.37 -
    1.38 -	local size0=$(find $install -type f -name '*.desktop' -exec ls -l \{\} \; | awk '{s+=$5}END{print s}')
    1.39 -	local time0=$(date +%s)
    1.40 -
    1.41 -	if [ -n "$QA" -a -z "$(which desktop-file-validate)" ]; then
    1.42 -		tazpkg -gi desktop-file-utils-extra --quiet
    1.43 -	fi
    1.44 -
    1.45 -	# The variable $LOCALE is set in cook.conf and may be overridden in the receipt.
    1.46 -	# Default value is "" (empty). That means for us that we'll use the full
    1.47 -	# list of supported locales here.
    1.48 -	[ -z "$LOCALE" ] && LOCALE=$(get_supported_locales)
    1.49 -
    1.50 -	for desktop in $(find $install -type f -name '*.desktop'); do
    1.51 -		cp "$desktop" "$desktop.orig"
    1.52 -
    1.53 -		# Sort out .desktop file (is prerequisite to correct working of `fix-desktop-file`)
    1.54 -		sdft "$desktop" -i
    1.55 -
    1.56 -		# Fix common errors in .desktop file
    1.57 -		fix-desktop-file "$desktop"
    1.58 -
    1.59 -		# Strip unsupported locales from .desktop file
    1.60 -		[ "${COOKOPTS/!i18nz/}" == "$COOKOPTS" ] &&
    1.61 -			sdft "$desktop" -i -k "$LOCALE"
    1.62 -
    1.63 -		# Extra-strip
    1.64 -		[ "${COOKOPTS/!extradesktops/}" == "$COOKOPTS" ] &&
    1.65 -			sdft "$desktop" -i -g -x -tf -r 'Keywords*' -o
    1.66 -
    1.67 -		if [ -n "$QA" ]; then
    1.68 -			# Check the rest of errors, warnings and tips
    1.69 -			_ 'QA: Checking %s...' "$(basename $desktop)"
    1.70 -			diff "$desktop.orig" "$desktop"
    1.71 -			desktop-file-validate "$desktop" | busybox fold -s
    1.72 -			echo
    1.73 -		fi
    1.74 -
    1.75 -		rm "$desktop.orig"
    1.76 -	done
    1.77 -
    1.78 -	local size1=$(find $install -type f -name '*.desktop' -exec ls -l \{\} \; | awk '{s+=$5}END{print s}')
    1.79 -	local time1=$(date +%s)
    1.80 -	comp_summary "$time0" "$time1" "$size0" "$size1"
    1.81 -}
    1.82 -
    1.83 -
    1.84 -# Compressor mini summary
    1.85 -
    1.86 -comp_summary() {
    1.87 -	[ "$3" -eq 0 ] && return
    1.88 -	local time=$(($2 - $1))
    1.89 -	local saving=$(( ($3 - $4) / 1024 ))
    1.90 -	_ '  Time: %s. Size: %s B -> %s B. Save: %s KB' "$(disp_time $time)" "$3" "$4" "$saving"
    1.91 -}
    1.92 -
    1.93 -
    1.94 -# Find and strip: --strip-all (-s) or --strip-debug on static libs as well
    1.95 -# as removing unneeded files like in Python packages. Cross compiled binaries
    1.96 -# must be stripped with cross-tools aka $ARCH-slitaz-*-strip
    1.97 -# Stripping can be disabled with COOKOPTS="!strip"
    1.98 -
    1.99 -strip_package() {
   1.100 -	[ "${COOKOPTS/!strip/}" != "$COOKOPTS" ] && return
   1.101 -
   1.102 -	case "$ARCH" in
   1.103 -		arm*|x86_64) export STRIP="$HOST_SYSTEM-strip" ;;
   1.104 -		*)           export STRIP='strip' ;;
   1.105 -	esac
   1.106 -	action 'Executing strip on all files...'
   1.107 -	local size0=0 size1=0 oldsize newsize
   1.108 -	local time0=$(date +%s)
   1.109 -
   1.110 -	# Strip executable files
   1.111 -	for dir in $fs/bin $fs/sbin $fs/usr/bin $fs/usr/sbin $fs/usr/games; do
   1.112 -		if [ -d "$dir" ]; then
   1.113 -			oldsize=$(find $dir -type f -exec ls -l '{}' \; | awk '{s+=$5}END{print s}')
   1.114 -			find $dir -type f -exec $STRIP -s '{}' 2>/dev/null \;
   1.115 -			newsize=$(find $dir -type f -exec ls -l '{}' \; | awk '{s+=$5}END{print s}')
   1.116 -			size0=$((size0 + oldsize)); size1=$((size1 + newsize))
   1.117 -		fi
   1.118 -	done
   1.119 -
   1.120 -	# Strip shared and static libraries
   1.121 -	# Remove Python *.pyc and *.pyo, Perl perllocal.pod and .packlist
   1.122 -	oldsize=$(find $fs -type f \( \
   1.123 -		-name '*.so*' -o -name '*.a' -o \
   1.124 -		-name '*.pyc' -o -name '*.pyo' -o \
   1.125 -		-name 'perllocal.pod' -o -name '.packlist' \) -exec ls -l '{}' \; | awk '{s+=$5}END{print s}')
   1.126 -
   1.127 -	find $fs -name '*.so*' -exec $STRIP -s '{}' 2>/dev/null \;
   1.128 -	find $fs -name '*.a' -exec $STRIP --strip-debug '{}' 2>/dev/null \;
   1.129 -	find $fs -type f \( -name '*.pyc' -o -name '*.pyo' \) -delete 2>/dev/null
   1.130 -	find $fs -type f \( -name 'perllocal.pod' -o -name '.packlist' \) -delete 2>/dev/null
   1.131 -
   1.132 -	newsize=$(find $fs -type f \( \
   1.133 -		-name '*.so*' -o -name '*.a' -o \) -exec ls -l '{}' \; | awk '{s+=$5}END{print s}')
   1.134 -
   1.135 -	size0=$((size0 + oldsize)); size1=$((size1 + newsize))
   1.136 -
   1.137 -	local time1=$(date +%s)
   1.138 -	status
   1.139 -	comp_summary "$time0" "$time1" "$size0" "$size1"
   1.140 -}
   1.141 -
   1.142 -
   1.143 -# Strip unsupported locales (.mo files)
   1.144 -
   1.145 -strip_mo_i18n() {
   1.146 -	[ "${COOKOPTS/!i18nz/}" != "$COOKOPTS" ] && return
   1.147 -
   1.148 -	[ ! -d "$fs/usr/share/locale" ] && return
   1.149 -	[ -z "$(find $fs/usr/share/locale -type f -name '*.mo')" ] && return
   1.150 -
   1.151 -	action 'Thin out translation files...'
   1.152 -	local size0=$(find $fs/usr/share/locale -type f -name '*.mo' -exec ls -l \{\} \; | awk '{s+=$5}END{print s}')
   1.153 -	local time0=$(date +%s)
   1.154 -
   1.155 -	# The variable $LOCALE is set in cook.conf and may be overridden in the receipt.
   1.156 -	# Default value is "" (empty). That means for us that we'll use the full
   1.157 -	# list of supported locales here.
   1.158 -	[ -z "$LOCALE" ] && LOCALE=$(get_supported_locales)
   1.159 -
   1.160 -	# Existing locales
   1.161 -	elocales=" $(ls -1 "$fs/usr/share/locale" | tr '\n' ' ') "
   1.162 -
   1.163 -	# Thin out the list of existing locales. At the end there will be only locales that need
   1.164 -	# deleting (and the garbage like '_AU', _US', '_BR' leaving from 'en_AU', 'en_US', 'pt_BR'...)
   1.165 -	for keep_locale in $LOCALE; do
   1.166 -		elocales=${elocales//$keep_locale}
   1.167 -	done
   1.168 -
   1.169 -	# Remove the unsupported locales
   1.170 -	for rem_locale in $elocales; do
   1.171 -		[ -d "$fs/usr/share/locale/$rem_locale" ] &&
   1.172 -			rm -r "$fs/usr/share/locale/$rem_locale"
   1.173 -	done
   1.174 -
   1.175 -	local size1=$(find $fs -type f -name '*.mo' -exec ls -l \{\} \; | awk '{s+=$5}END{print s}')
   1.176 -	local time1=$(date +%s)
   1.177 -	status
   1.178 -	comp_summary "$time0" "$time1" "$size0" "$size1"
   1.179 -}
   1.180 -
   1.181 -
   1.182 -# Normalize all *.mo files: unconditionally convert to UTF-8; remove strings that are not really added
   1.183 -# to the translation (msgid = msgstr)
   1.184 -# Normalization can be disabled with COOKOPTS="!monorm"
   1.185 -
   1.186 -normalize_mo() {
   1.187 -	[ "${COOKOPTS/!monorm/}" != "$COOKOPTS" ] && return
   1.188 -	[ -z "$(find $install -type f -name '*.mo')" ] && return
   1.189 -
   1.190 -	action 'Normalizing mo files...'
   1.191 -	local size0=$(find $install -type f -name '*.mo' -exec ls -l \{\} \; | awk '{s+=$5}END{print s}')
   1.192 -	local time0=$(date +%s)
   1.193 -
   1.194 -	# Gettext functions: msgunfmt, msguniq, msgconv, msgfmt
   1.195 -	tazpkg -gi gettext      --quiet
   1.196 -	# Gconv modules (convert to UTF-8)
   1.197 -	tazpkg -gi glibc-locale --quiet
   1.198 -
   1.199 -	# Process all existing *.mo files
   1.200 -	for mo in $(find "$install" -type f -name '*.mo'); do
   1.201 -		tmpfile="$(mktemp)"
   1.202 -
   1.203 -		msgunfmt "$mo" | msguniq | msgconv -o "$tmpfile" -t 'UTF-8'
   1.204 -		# add newline
   1.205 -		echo >> "$tmpfile"
   1.206 -
   1.207 -		# get Plural-Forms
   1.208 -		awk '
   1.209 -		BEGIN { skip = ""; }
   1.210 -		{
   1.211 -			if (! skip) {
   1.212 -				s = $0;
   1.213 -				gsub(/^[^\"]*\"/, "", s);
   1.214 -				gsub(/\"$/, "", s);
   1.215 -				printf("%s", s);
   1.216 -			}
   1.217 -			if (! $0) skip = "yes";
   1.218 -		}
   1.219 -		' "$tmpfile" | sed 's|\\n|\n|g' | grep "^Plural-Forms:" > "$tmpfile.pf"
   1.220 -
   1.221 -		if ! grep -q 'msgid_plural' "$tmpfile"; then
   1.222 -			echo > "$tmpfile.pf"
   1.223 -		fi
   1.224 -
   1.225 -		# main
   1.226 -		awk -v pf="$(cat "$tmpfile.pf")" '
   1.227 -		function clean() {
   1.228 -			mode = msgctxt = msgid = msgid_plural = msgstr = msgstr0 = msgstr1 = msgstr2 = msgstr3 = msgstr4 = msgstr5 = "";
   1.229 -		}
   1.230 -
   1.231 -		function getstring() {
   1.232 -			# Skip unquoted words at the beginning (msgid, msgstr...) and get string from inside quotes
   1.233 -			s = $0;
   1.234 -			gsub(/^[^\"]*\"/, "", s);
   1.235 -			gsub(/\"$/, "", s);
   1.236 -			return s;
   1.237 -		}
   1.238 -
   1.239 -		BEGIN {
   1.240 -			printf("msgid \"\"\nmsgstr \"\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n");
   1.241 -			if (pf)
   1.242 -				printf("\"%s\\n\"\n", pf);
   1.243 -			printf("\n");
   1.244 -			skip = 1;
   1.245 -			clean();
   1.246 -		}
   1.247 -
   1.248 -		{
   1.249 -			# Skip the entire header
   1.250 -			if (!skip) {
   1.251 -				if ($1 == "msgctxt" || $1 == "msgid" || $1 == "msgstr" || $1 == "msgid_plural")
   1.252 -					mode = $1;
   1.253 -				if ($1 == "msgstr[0]") mode = "msgstr0";
   1.254 -				if ($1 == "msgstr[1]") mode = "msgstr1";
   1.255 -				if ($1 == "msgstr[2]") mode = "msgstr2";
   1.256 -				if ($1 == "msgstr[3]") mode = "msgstr3";
   1.257 -				if ($1 == "msgstr[4]") mode = "msgstr4";
   1.258 -				if ($1 == "msgstr[5]") mode = "msgstr5";
   1.259 -
   1.260 -				if (mode == "msgctxt")      msgctxt      = msgctxt      getstring();
   1.261 -				if (mode == "msgid")        msgid        = msgid        getstring();
   1.262 -				if (mode == "msgstr")       msgstr       = msgstr       getstring();
   1.263 -				if (mode == "msgid_plural") msgid_plural = msgid_plural getstring();
   1.264 -				if (mode == "msgstr0")      msgstr0      = msgstr0      getstring();
   1.265 -				if (mode == "msgstr1")      msgstr1      = msgstr1      getstring();
   1.266 -				if (mode == "msgstr2")      msgstr2      = msgstr2      getstring();
   1.267 -				if (mode == "msgstr3")      msgstr3      = msgstr3      getstring();
   1.268 -				if (mode == "msgstr4")      msgstr4      = msgstr4      getstring();
   1.269 -				if (mode == "msgstr5")      msgstr5      = msgstr5      getstring();
   1.270 -
   1.271 -				if (! $0) {
   1.272 -					if (msgid != msgstr) {
   1.273 -						if (msgctxt)      printf("msgctxt \"%s\"\n",      msgctxt);
   1.274 -						                  printf("msgid \"%s\"\n",        msgid);
   1.275 -						if (msgid_plural) printf("msgid_plural \"%s\"\n", msgid_plural);
   1.276 -						if (msgstr)       printf("msgstr \"%s\"\n",       msgstr);
   1.277 -						if (msgstr0)      printf("msgstr[0] \"%s\"\n",    msgstr0);
   1.278 -						if (msgstr1)      printf("msgstr[1] \"%s\"\n",    msgstr1);
   1.279 -						if (msgstr2)      printf("msgstr[2] \"%s\"\n",    msgstr2);
   1.280 -						if (msgstr3)      printf("msgstr[3] \"%s\"\n",    msgstr3);
   1.281 -						if (msgstr4)      printf("msgstr[4] \"%s\"\n",    msgstr4);
   1.282 -						if (msgstr5)      printf("msgstr[5] \"%s\"\n",    msgstr5);
   1.283 -						                  printf("\n");
   1.284 -					}
   1.285 -					clean();
   1.286 -				}
   1.287 -			}
   1.288 -			if ($0 == "") skip = "";
   1.289 -		}
   1.290 -		' "$tmpfile" > "$tmpfile.awk"
   1.291 -
   1.292 -		msgfmt "$tmpfile.awk" -o "$tmpfile.mo"
   1.293 -
   1.294 -		if [ -s "$tmpfile.mo" ]; then
   1.295 -			rm "$mo"; mv "$tmpfile.mo" "$mo"
   1.296 -		else
   1.297 -			_ 'Error processing %s' "$mo"
   1.298 -			[ -e "$tmpfile.mo" ] && rm "$tmpfile.mo"
   1.299 -		fi
   1.300 -
   1.301 -		# Clean
   1.302 -		rm "$tmpfile" "$tmpfile.pf" "$tmpfile.awk"
   1.303 -	done
   1.304 -
   1.305 -	local size1=$(find $install -type f -name '*.mo' -exec ls -l \{\} \; | awk '{s+=$5}END{print s}')
   1.306 -	local time1=$(date +%s)
   1.307 -	status
   1.308 -	comp_summary "$time0" "$time1" "$size0" "$size1"
   1.309 -}
   1.310 -
   1.311 -
   1.312  # Remove files provided by split packages
   1.313  # For example:
   1.314  #   1. Package "pkg-main":
   1.315 @@ -841,147 +536,6 @@
   1.316  }
   1.317  
   1.318  
   1.319 -# Function to compress all man pages
   1.320 -# Compressing can be disabled with COOKOPTS="!manz"
   1.321 -
   1.322 -compress_manpages() {
   1.323 -	[ "${COOKOPTS/!manz/}" != "$COOKOPTS" ] && return
   1.324 -
   1.325 -	case "$ARCH" in
   1.326 -		arm*) return;; # While SliTaz-arm miss `advancecomp`
   1.327 -	esac
   1.328 -	local manpath="$install/usr/share/man" dest link
   1.329 -	[ -d "$manpath" ] || return
   1.330 -
   1.331 -	action 'Compressing man pages...'
   1.332 -
   1.333 -	local size0=$(find $install/usr/share/man -type f -exec ls -l \{\} \; | awk '{s+=$5}END{print s}')
   1.334 -	local time0=$(date +%s)
   1.335 -	# We'll use only Gzip compression, so decompress other formats first
   1.336 -	find $manpath -type f -name '*.bz2' -exec bunzip2 \{\} \;
   1.337 -	find $manpath -type f -name '*.xz'  -exec unxz    \{\} \;
   1.338 -
   1.339 -	# Fast compress with gzip
   1.340 -	find $manpath -type f -name '*.[1-9]*' -exec gzip \{\} \;
   1.341 -
   1.342 -	# Fix symlinks
   1.343 -	for i in $(find $install/usr/share/man -type l); do
   1.344 -		dest=$(readlink $i | sed 's|\.[gbx]z2*$||')
   1.345 -		link=$(echo $i | sed 's|\.[gbx]z2*$||')
   1.346 -		rm $i; ln -s $dest.gz $link.gz
   1.347 -	done
   1.348 -
   1.349 -	# Recompress with advdef (it can't compress, only recompress)
   1.350 -	tazpkg -gi advancecomp --quiet
   1.351 -	for i in $(find $install/usr/share/man -type f); do
   1.352 -		advdef -z4q $i
   1.353 -	done
   1.354 -
   1.355 -	local size1=$(find $install/usr/share/man -type f -exec ls -l \{\} \; | awk '{s+=$5}END{print s}')
   1.356 -	local time1=$(date +%s)
   1.357 -	status
   1.358 -	comp_summary "$time0" "$time1" "$size0" "$size1"
   1.359 -}
   1.360 -
   1.361 -
   1.362 -# Function used after compile_rules() to compress all png images
   1.363 -# Compressing can be disabled with COOKOPTS="!pngz"
   1.364 -
   1.365 -compress_png() {
   1.366 -	[ "${COOKOPTS/!pngz/}" != "$COOKOPTS" ] && return
   1.367 -	case "$ARCH" in
   1.368 -		arm*) return;; # While SliTaz-arm miss `pngquant` and `optipng`
   1.369 -	esac
   1.370 -	[ -z "$(find $install -type f -name '*.png')" ] && return
   1.371 -
   1.372 -	action 'Compressing png images...'
   1.373 -	local size0=$(find $install -type f -name '*.png' -exec ls -l \{\} \; | awk '{s+=$5}END{print s}')
   1.374 -	local time0=$(date +%s)
   1.375 -
   1.376 -	local use_pq=true use_op=true
   1.377 -	[ "${COOKOPTS/!pngquant/}" != "$COOKOPTS" ] && use_pq=false
   1.378 -	[ "${COOKOPTS/!optipng/}"  != "$COOKOPTS" ] && use_op=false
   1.379 -
   1.380 -	$use_pq && tazpkg -gi pngquant --quiet
   1.381 -	$use_op && tazpkg -gi optipng --quiet
   1.382 -
   1.383 -	local oplevel=$(echo $COOKOPTS | grep 'op[0-8]' | sed 's|.*op\([0-8]\).*|\1|')
   1.384 -	[ -z "$oplevel" ]     && oplevel='2'
   1.385 -	[ "$oplevel" == '8' ] && oplevel='7 -zm1-9'
   1.386 -
   1.387 -	for i in $(find $install -type f -name '*.png'); do
   1.388 -		$use_pq && pngquant -f --skip-if-larger --ext .png --speed 1 "$i"
   1.389 -		$use_op && optipng -quiet -strip all -o$oplevel "$i"
   1.390 -	done
   1.391 -
   1.392 -	local size1=$(find $install -type f -name '*.png' -exec ls -l \{\} \; | awk '{s+=$5}END{print s}')
   1.393 -	local time1=$(date +%s)
   1.394 -	status
   1.395 -	comp_summary "$time0" "$time1" "$size0" "$size1"
   1.396 -}
   1.397 -
   1.398 -
   1.399 -# Function used after compile_rules() to compress all svg images
   1.400 -# Compressing can be disabled with COOKOPTS="!svgz"
   1.401 -
   1.402 -compress_svg() {
   1.403 -	[ "${COOKOPTS/!svgz/}" != "$COOKOPTS" ] && return
   1.404 -	case "$ARCH" in
   1.405 -		arm*) return;; # While SliTaz-arm miss `svgcleaner`
   1.406 -	esac
   1.407 -	[ -z "$(find $install -type f -name '*.svg')" ] && return
   1.408 -
   1.409 -	action 'Compressing svg images...'
   1.410 -	local size0=$(find $install -type f -name '*.svg' -exec ls -l \{\} \; | awk '{s+=$5}END{print s}')
   1.411 -	local time0=$(date +%s)
   1.412 -	tazpkg -gi svgcleaner --quiet
   1.413 -	cleaner_log="$(mktemp)"
   1.414 -	for i in $(find $install -type f -name '*.svg'); do
   1.415 -		echo -n "$i: " >> "$cleaner_log"
   1.416 -		svgcleaner "$i" "$i" --remove-unresolved-classes false --quiet true >> "$cleaner_log"
   1.417 -	done
   1.418 -	local size1=$(find $install -type f -name '*.svg' -exec ls -l \{\} \; | awk '{s+=$5}END{print s}')
   1.419 -	local time1=$(date +%s)
   1.420 -	status
   1.421 -	comp_summary "$time0" "$time1" "$size0" "$size1"
   1.422 -	sed -i '/: $/d' "$cleaner_log"
   1.423 -	if [ -s "$cleaner_log" ]; then
   1.424 -		_ 'Cleaner warnings and errors:'
   1.425 -		awk '{printf "  %s\n", $0;}' "$cleaner_log"
   1.426 -		echo
   1.427 -	fi
   1.428 -	rm "$cleaner_log"
   1.429 -}
   1.430 -
   1.431 -
   1.432 -# Function used after compile_rules() to shrink all *.ui and *.glade files:
   1.433 -# remove insignificant spaces and comments
   1.434 -# Compressing can be disabled with COOKOPTS="!uiz"
   1.435 -
   1.436 -compress_ui() {
   1.437 -	[ "${COOKOPTS/!uiz/}" != "$COOKOPTS" ] && return
   1.438 -	case "$ARCH" in
   1.439 -		arm*) return;; # While SliTaz-arm miss `xmlstarlet`
   1.440 -	esac
   1.441 -	[ -z "$(find $install -type f \( -name '*.ui' -o -name '*.glade' \) )" ] && return
   1.442 -
   1.443 -	action 'Compressing ui files...'
   1.444 -	local size0=$(find $install -type f \( -name '*.ui' -o -name '*.glade' \) -exec ls -l \{\} \; | awk '{s+=$5}END{print s}')
   1.445 -	local time0=$(date +%s)
   1.446 -	tazpkg -gi xmlstarlet --quiet
   1.447 -	temp_ui="$(mktemp)"
   1.448 -	for ui in $(find $install -type f \( -name '*.ui' -o -name '*.glade' \) ); do
   1.449 -		xmlstarlet c14n --without-comments "$ui" | xmlstarlet sel -B -t -c '*' > "$temp_ui"
   1.450 -		cat "$temp_ui" > "$ui"
   1.451 -	done
   1.452 -	local size1=$(find $install -type f \( -name '*.ui' -o -name '*.glade' \) -exec ls -l \{\} \; | awk '{s+=$5}END{print s}')
   1.453 -	local time1=$(date +%s)
   1.454 -	status
   1.455 -	comp_summary "$time0" "$time1" "$size0" "$size1"
   1.456 -	rm "$temp_ui"
   1.457 -}
   1.458 -
   1.459 -
   1.460  # The main cook function.
   1.461  
   1.462  cookit() {
   1.463 @@ -1199,12 +753,7 @@
   1.464  	# Skip all for split packages (already done in main package)
   1.465  	if [ -z "$WANTED" ]; then
   1.466  		footer
   1.467 -		compress_manpages
   1.468 -		compress_png
   1.469 -		compress_svg
   1.470 -		compress_ui
   1.471 -		fix_desktop_files
   1.472 -		normalize_mo
   1.473 +		export COOKOPTS ARCH install; @@PREFIX@@/libexec/cookutils/compressor install
   1.474  	fi
   1.475  	footer
   1.476  
   1.477 @@ -1286,8 +835,7 @@
   1.478  	copy_generic_files
   1.479  
   1.480  	# Strip and stuff files.
   1.481 -	strip_package
   1.482 -	strip_mo_i18n
   1.483 +	export COOKOPTS ARCH HOST_SYSTEM LOCALE fs; @@PREFIX@@/libexec/cookutils/compressor fs
   1.484  
   1.485  	# Create files.list with redirecting find output.
   1.486  	action 'Creating the list of files...'