-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrom
More file actions
executable file
·184 lines (152 loc) · 3.35 KB
/
rom
File metadata and controls
executable file
·184 lines (152 loc) · 3.35 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#!/usr/bin/env bash
# Build script to compile Android ROMs
function sendHelp() {
echo -e "Usage";
echo -e "bash $0 <rom> -d <device> [NEEDED] [ROM can be aosip|caf|rr, device oneplus3|kenzo]"
echo -e "Optional flags: <sync|nosync> <clean|noclean> <user|userdebug|eng> <rmccache> <-j X|--jobs X> <bootimage|recoveryimage>";
exit 1;
}
function rr() {
export LUNCH="rr";
if [[ -z "${RR_BUILDTYPE}" ]]; then
export RR_BUILDTYPE="Experimental";
fi
if [[ -z "${days_to_log}" ]]; then
export days_to_log="0";
fi
export ZIPNAME="RR-O";
}
function caf() {
export LUNCH="aosp";
export ZIPNAME="aosp-caf";
}
function aosip() {
export LUNCH="aosip";
if [[ -z "${AOSIP_BUILDTYPE}" ]]; then
export AOSIP_BUILDTYPE="DerpFest";
fi
export ZIPNAME="AOSiP";
export MAKE="kronic"
}
while [[ $# -gt 0 ]]; do
case "$1" in
"aosip"|"caf"|"rr")
ROM="$1";
echo -e "ROM: ${ROM}";
;;
"-d"|"--device")
shift;
if [[ "$#" -gt 0 ]]; then
DEVICE="$1";
else
echo -e "Please specify device!";
exit 1;
fi
echo -e "DEVICE: ${DEVICE}";
;;
"sync"|"nosync")
SYNC="$1";
echo -e "SYNC: ${SYNC}";
;;
"clean"|"noclean")
CLEAN="$1";
echo -e "CLEAN: ${CLEAN}";
;;
"user"|"userdebug"|"eng")
VARIANT="$1";
echo -e "VARIANT: ${VARIANT}";
;;
"rmccache")
NUKECCACHE="true";
;;
"-j"|"--jobs")
shift;
if [[ $# -gt 0 ]]; then
JOBS="$1";
else
echo -e "Please specify as value for jobs";
exit 1;
fi
;;
"bootimage"|"recoveryimage")
TARGET="$1";
;;
"-h"|"--help")
sendHelp;
;;
*)
echo -e "Invalid input!";
sendHelp;
;;
esac
shift
done
[[ -z "${DEVICE}" ]] && DEVICE="kenzo"
[[ -z "${ROM}" ]] && ROM="aosip"
[[ -z "${VARIANT}" ]] && VARIANT="userdebug"
${ROM};
ROM_SOURCE_DIR="${HOME}/${DIR}";
if [[ ! -d "${ROM_SOURCE_DIR}" ]]; then
echo -e "${ROM_SOURCE_DIR} dosen't exist, please sync up in the correct folder and rerun";
exit 1;
fi
cd "${ROM_SOURCE_DIR}";
if [[ ! -d ".repo" ]]; then
echo -e ".repo folder not found - not in a properly synced android tree - please sync properly";
exit 1;
fi
venv;
source build/envsetup.sh;
lunch "${LUNCH}_${DEVICE}-${VARIANT}"
if [[ "${CLEAN}" == "clean" ]]; then
make clobber;
fi
if [[ "${NUKECCACHE}" == "true" ]]; then
ccache -C;
fi
if [[ -z "${MAKE}" ]]; then
if [[ "$(grep '^bacon:' 'build/core/Makefile')" ]]; then
MAKE="bacon"
else
MAKE="otapackage"
fi
fi
if [[ -z "${TARGET}" ]]; then
TARGET="${MAKE}";
fi
if [[ -z "${JOBS}" ]];then
JOBS="$(nproc)";
fi
export USE_CCACHE=1;
export CCACHE_DIR="${HOME}/.ccache";
ccache -M 200;
if [[ "${SYNC}" == "sync" ]]; then
syncc -j${JOBS}
fi
if [[ "$(command -v 'mka')" ]]; then
MAKE="mka ${TARGET}";
else
MAKE="make -j${JOBS} ${TARGET}";
fi
LOG="${HOME}/logs/${ROM}_${DEVICE}_$(date +%Y%m%d-%H%M).log"
START="$(date +%s)";
eval "${MAKE}" 2>&1 | tee ${LOG}
END="$(date +%s)";
format_time ${END} ${START};
if [[ "${TARGET}" == "bootimage" ]]; then
OUTPUT="boot.img";
elif [[ "{TARGET"} == "recoveryimage" ]]; then
OUTPUT="recovery.img";
else
OUTPUT="${ZIPNAME}";
fi
if [[ "$(ls ${OUT}/${OUTPUT}*)" ]]; then
echo -e "Build succeeded";
else
echo -e "Build failed, check ${LOG}";
fi
if [[ -d "/tmp/venv" ]]; then
rmvenv;
fi
echo -e "Stopping jack server";
./prebuilts/sdk/tools/jack-admin stop-server;