blob: 95d88854e37e9af690d121d711113e35776e8661 [file] [log] [blame]
Alberto97c7f39f22015-02-15 00:28:23 +01001#!/bin/bash
2#
3# Squish a CM otapackage for distribution
4# cyanogen
5
6. $ANDROID_BUILD_TOP/vendor/aosp/utils/colors
7
8OUT_TARGET_HOST=`uname -s`
9if [ x"$OUT_TARGET_HOST" = x"Linux" ]
10then
11 OUT_TARGET_HOST=linux-x86
12 XARGS="xargs --max-args=1 --max-procs `grep 'processor' /proc/cpuinfo|wc -l`"
13elif [ x"$OUT_TARGET_HOST" = x"Darwin" ]
14then
15 OUT_TARGET_HOST=darwin-x86
16 XARGS="xargs -n 1 -P `sysctl hw.ncpu | awk '{print $2}'`"
17else
18 echo -e $${CL_RED}"ERROR: unknown/unsupported host OS!"${CL_RST}
19 exit 1
20fi
21
22if [ -z "$OUT" -o ! -d "$OUT" ]; then
23 echo -e ${CL_RED}"ERROR: $0 only works with a full build environment. $OUT should exist."${CL_RST}
24 exit 1
25fi
26
27OPTICHARGER=$ANDROID_BUILD_TOP/vendor/aosp/utils/opticharger
28QUIET=-q
29DELETE_BINS="applypatch applypatch_static check_prereq recovery updater"
30
31# Optimize PNG resources in APKs
32( cd $OUT/system; find framework/ app/ priv-app/ vendor/app/ -name \*.apk -print | $XARGS $OPTICHARGER; )
33
34exit 0