-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·83 lines (65 loc) · 2.03 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
export LC_ALL=C
export RELEASE_TYPE=RELEASE
SCRIPTDIR="$(readlink -f "$0")"
SCRIPTDIR="$(dirname "$SCRIPTDIR")"
cd "$SCRIPTDIR"
. build/envsetup.sh
# Clean everything
if [ "$1" = "clean" ]; then
make clean
exit 0
fi
# Boot image build:
if [ "$1" = "bootimage" ]; then
# remove old kernel components
rm -f $SCRIPTDIR/out/target/product/chagalllte/boot.img
rm -f $SCRIPTDIR/out/target/product/chagalllte/ramdisk.img
rm -f $SCRIPTDIR/out/target/product/chagalllte/recovery.img
rm -f $SCRIPTDIR/out/target/product/chagalllte/recovery.id
rm -f $SCRIPTDIR/out/target/product/chagalllte/kernel
rm -f $SCRIPTDIR/out/target/product/chagalllte/recovery-ramdisk.cpio
rm -rf $SCRIPTDIR/out/target/product/chagalllte/obj/KERNEL_OBJ
# load chagalllte device tree
breakfast chagalllte
# build boot image
make bootimage
exit $?
fi
# Single module build:
if [ ! -z "$1" ]; then
# load chagalllte device tree
breakfast chagalllte
# build module
mmma "$1"
exit $?
fi
# Normal build:
# configure jack
export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4G"
# delete old falshable zips and object files
rm -f $SCRIPTDIR/out/dist/*chagalllte*.zip
rm -f $SCRIPTDIR/out/target/product/chagalllte/*.img
rm -f $SCRIPTDIR/out/target/product/chagalllte/*.zip*
rm -f $SCRIPTDIR/out/target/product/chagalllte/kernel
rm -f $SCRIPTDIR/out/target/product/chagalllte/recovery-ramdisk.cpio
rm -rf $SCRIPTDIR/out/target/product/chagalllte/obj/PACKAGING
rm -rf $SCRIPTDIR/out/target/product/chagalllte/obj/KERNEL_OBJ
# load chagallte device tree
breakfast chagalllte
# check for newest tzdata
python -B external/icu/tools/update-tzdata.py
# build the distribution
mka target-files-package dist
RET=$?
# kill all jack instances
JACK_PIDS=$(ps aux | grep -v grep | grep "bin/jack" 2>/dev/null)
if [ ! -z "$JACK_PIDS" ]; then
kill $JACK_PIDS
fi
JACK_PIDS=$(ps aux | grep -v grep | grep "java" | grep "jack" | awk '{print $2}' 2>/dev/null)
if [ ! -z "$JACK_PIDS" ]; then
kill $JACK_PIDS
fi
# Report success
exit $RET