forked from spanner3003/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·106 lines (94 loc) · 2.18 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
#
# Script to build CM9 for Galaxy Tab (with Kernel)
# 2012 Chirayu Desai
# Common defines
txtrst='\e[0m' # Color off
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
echo -e "${txtblu}##########################################"
echo -e "${txtblu}# #"
echo -e "${txtblu}# GALAXYTAB BUILDSCRIPT #"
echo -e "${txtblu}# #"
echo -e "${txtblu}##########################################"
echo -e "\r\n ${txtrst}"
# Starting Timer
START=$(date +%s)
DEVICE="$1"
BUILDTYPE="$2"
THREADS=`cat /proc/cpuinfo | grep processor | wc -l`
case "$DEVICE" in
clean)
make clean
cd kernel/samsung/p1
./build.sh clean
exit
;;
p1|P1)
TARGET=P1
;;
p1c|P1C)
TARGET=P1C
;;
p1l|P1L)
TARGET=P1L
;;
p1n|P1N)
TARGET=P1N
;;
*)
echo -e "${txtred}Usage: $0 device"
echo -e "Example: ./build.sh p1"
echo -e "Default p1"
echo -e "Supported Devices: p1 p1c p1l p1n${txtrst}"
;;
esac
case "$BUILDTYPE" in
eng)
LUNCH=cm_galaxytab-eng
;;
userdebug)
LUNCH=cm_galaxytab-userdebug
;;
user)
LUNCH=cm_galaxytab-user
;;
*)
echo -e "${txtred} Choose a build type"
echo -e "Default : userdebug"
echo -e "Supported Buildtypes : eng userdebug user"
esac
if [ "$1" = "" ] ; then
TARGET=p1
fi
if [ "$2" = "" ] ; then
LUNCH=cm_galaxytab-userdebug
fi
# Check for Prebuilts
echo -e "${txtylw}Checking for Prebuilts...${txtrst}"
if [ ! -e vendor/cm/proprietary/RomManager.apk ] || [ ! -e vendor/cm/proprietary/Term.apk ] || [ ! -e vendor/cm/proprietary/lib/armeabi/libjackpal-androidterm3.so ]; then
echo -e "${txtred}Prebuilts not found, downloading now...${txtrst}"
cd vendor/cm
./get-prebuilts
cd ../..
else
echo -e "${txtgrn}Prebuilts found.${txtrst}"
fi
# Setup build environment and start the build
. build/envsetup.sh
lunch $LUNCH
# Kernel build
cd kernel/samsung/p1
./build.sh $TARGET
cd ../../..
# Android build
make -j$THREADS bacon
END=$(date +%s)
ELAPSED=$((END - START))
E_MIN=$((ELAPSED / 60))
E_SEC=$((ELAPSED - E_MIN * 60))
printf "Elapsed: "
[ $E_MIN != 0 ] && printf "%d min(s) " $E_MIN
printf "%d sec(s)\n" $E_SEC