forked from iiD4x/AOSPAL_vendor_psd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
146 lines (135 loc) · 4.7 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
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
#!/bin/bash
#
# Created by Michael S Corigliano for Team AOSPAL ([email protected])
# Parts of the original AOSPA build script have also been implemented in this script,
# it can be found here: https://www.github.com/AOSPA/android_vendor_pa/build.sh
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Get build version
# PA_MAJOR=$(cat $DIR/vendor/pa/vendor.mk | grep 'ROM_VERSION_MAJOR := *' | sed 's/ROM_VERSION_MAJOR := //g')
# PA_MINOR=$(cat $DIR/vendor/pa/vendor.mk | grep 'ROM_VERSION_MINOR := *' | sed 's/ROM_VERSION_MINOR := //g')
# PA_MAINTENANCE=$(cat $DIR/vendor/pa/vendor.mk | grep 'ROM_VERSION_MAINTENANCE := *' | sed 's/ROM_VERSION_MAINTENANCE := //g')
# PA_TAG=$(cat $DIR/vendor/pa/vendor.mk | grep 'ROM_VERSION_TAG := *' | sed 's/ROM_VERSION_TAG := //g')
#
# PSD_MAJOR=$(cat $DIR/vendor/psd/vendor.mk | grep 'PSD_VERSION_MAJOR := *' | sed 's/PSD_VERSION_MAJOR := //g')
# PSD_MINOR=$(cat $DIR/vendor/psd/vendor.mk | grep 'PSD_VERSION_MINOR := *' | sed 's/PSD_VERSION_MINOR := //g')
# PSD_MAINTENANCE=$(cat $DIR/vendor/psd/vendor.mk | grep 'PSD_VERSION_MAINTENANCE := *' | sed 's/PSD_VERSION_MAINTENANCE := //g')
# PSD_TAG=$(cat $DIR/vendor/psd/vendor.mk | grep 'PSD_TYPE := *' | sed 's/PSD_TYPE := //g')
#
# if [ -n "$PA_TAG" ]; then
# VERSION=$MAJOR.$MINOR$MAINTENANCE-$TAG
# else
# VERSION=$MAJOR.$MINOR$MAINTENANCE
# fi
#
# if [ -n "$PSD_TAG" ]; then
# PSD_VERSION=$PSD_MAINTENANCE-$PSD_TAG-$PSD_MAJOR.$PSD_MINOR
# else
# PSD_VERSION=$PSD_MAINTENANCE-$PSD_MAJOR.$PSD_MINOR
# fi
DEVICE="$1"
timestamp="$(date +%s)"
# start
echo -e "Building Paranoid SaberDroid for $DEVICE";
# echo -e "$PA_TAG $PA_MAJOR.$PA_MINOR";
# echo -e "$PSD_TAG $PSD_MAJOR.$PSD_MINOR for $DEVICE";
echo -e "";
echo -e ""
# make 'build-logs' directory if it doesn't already exist
echo -e "Making a 'build-logs' directory if you haven't already...";
mkdir -p build-logs
# fetch latest sources
echo -e "Fetching latest sources...";
echo "Please select how many threads you would like to use to sync source:
1) -j4
2) -j8
3) -j16
4) -j32
5) Don't sync"
read n
case $n in
1) repo sync -j4
;;
2) repo sync -j8
;;
3) repo sync -j16
;;
4) repo sync -j32
;;
5) echo -e "Not syncing"
;;
*) invalid option
;;
esac
clear
# Decide whether to build clean or dirty
echo "Build clean or dirty:
1) clean
2) dirty"
read n
case $n in
1) make clean
;;
2) echo -e "Building dirty..."
;;
*) invalid option
;;
esac
clear
# invoke the environment setup script to start the building process
echo -e "Setting up build environment..."
. build/envsetup.sh
clear
# decide to build odex or deodex
echo -e "";
echo -e "";
echo "Build odex or deodex:
1) odex
2) deodex"
read n
case $n in
1) lunch psd_$DEVICE-user
;;
2) lunch psd_$DEVICE-userdebug
;;
*) invalid option
;;
esac
clear
# execute the build while sending a log to 'build-logs'
echo -e "Starting build...";
echo "Please select how many threads you would like to use to build:
1) -j4
2) -j8
3) -j18
4) -j32"
read n
case $n in
1) make -j4 bacon 2>&1 | tee build-logs/psd_$DEVICE-$timestamp.txt
;;
2) make -j8 bacon 2>&1 | tee build-logs/psd_$DEVICE-$timestamp.txt
;;
3) make -j18 bacon 2>&1 | tee build-logs/psd_$DEVICE-$timestamp.txt
;;
4) make -j32 bacon 2>&1 | tee build-logs/psd_$DEVICE-$timestamp.txt
;;
*) invalid option
;;
esac
# we're done
echo -e "Finished building Paranoid SaberDroid.";
echo -e "If for some reason your build failed,";
echo -e "please check the 'build-logs' directory to figure out why.";
echo -e "";
echo -e ""