summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2010-12-14 18:40:38 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2011-01-01 14:32:08 -0800
commit7fc0298900fd912b962229f23d090fc422320019 (patch)
tree4913d7d3fce4c9d318d3456a559fd63d36873c48
parent91107ccf316c36dc964e1cdf6c74d216fbce4aa4 (diff)
Use pngcrush to crush the images as we build the package.
-rw-r--r--makefile2
-rwxr-xr-xpngcrush.sh40
2 files changed, 42 insertions, 0 deletions
diff --git a/makefile b/makefile
index 5fbff17..9a1145d 100644
--- a/makefile
+++ b/makefile
@@ -100,6 +100,8 @@ package: MobileCydia
mkdir -p _/DEBIAN
./control.sh _ >_/DEBIAN/control
+ find _ -name '*.png' -exec ./pngcrush.sh '{}' ';'
+
sudo chown -R 0 _
sudo chgrp -R 0 _
sudo chmod 6755 _/Applications/Cydia.app/MobileCydia
diff --git a/pngcrush.sh b/pngcrush.sh
new file mode 100755
index 0000000..69715fb
--- /dev/null
+++ b/pngcrush.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+png=$1
+steps=()
+
+function step() {
+ "$@"
+ mv -f {_,}_.png
+ steps+=($(stat -f "%z" _.png))
+}
+
+pngcrush=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush
+
+grep CgBI "${png}" &>/dev/null && exit 0
+
+step cp -fa "${png}" __.png
+
+#step "${pngcrush}" -q -rem alla -reduce -brute -iphone {,_}_.png
+
+#step "${pngcrush}" -q -rem alla -reduce -brute {,_}_.png
+#step pincrush {,_}_.png
+
+step "${pngcrush}" -q -rem alla -reduce -iphone {,_}_.png
+
+#"${pngcrush}" -q -rem alla -reduce -brute -iphone "${png}" 1.png
+#"${pngcrush}" -q -iphone _.png 2.png
+#ls -la 1.png 2.png
+
+mv -f _.png "${png}"
+
+echo -n "${png##*/} "
+for ((i = 0; i != ${#steps[@]}; ++i)); do
+ if [[ $i != 0 ]]; then
+ echo -n " "
+ fi
+
+ echo -n "${steps[i]}"
+done
+
+printf $' %.0f%%\n' "$((steps[${#steps[@]}-1] * 100 / steps[0]))"