]> git.saurik.com Git - cydia.git/commitdiff
Use pngcrush to crush the images as we build the package.
authorJay Freeman (saurik) <saurik@saurik.com>
Wed, 15 Dec 2010 02:40:38 +0000 (18:40 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Sat, 1 Jan 2011 22:32:08 +0000 (14:32 -0800)
makefile
pngcrush.sh [new file with mode: 0755]

index 5fbff179384a49a54c33b66f3e472d5948b58fad..9a1145dcf42b5ccd2466cf6f8457c7af8af4ba9f 100644 (file)
--- a/makefile
+++ b/makefile
@@ -100,6 +100,8 @@ package: MobileCydia
        mkdir -p _/DEBIAN
        ./control.sh _ >_/DEBIAN/control
        
        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
        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 (executable)
index 0000000..69715fb
--- /dev/null
@@ -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]))"