aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2019-08-05 14:50:29 +0200
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2020-09-09 15:44:41 +0200
commit50990c33b1bb15469eff5e898adc75b24731de8b (patch)
treef9591805f04bdc5ba2b1a4318dabd42e8cff0de4
parent90cad2909700d170a0c6fb4e3866f28ca8feba42 (diff)
downloadvendor_replicant-replicant-4.2.tar.gz
vendor_replicant-replicant-4.2.tar.bz2
vendor_replicant-replicant-4.2.zip
Add build script to simplify the build procedure.replicant-4.2
Once the source code is downloaded and the dependencies are installed, it makes it easier for people to build Replicant. It also saves the builds logs, to enable to later look at why the build failed without needing to re-run the build. However users still have to take care of running repo --sync if necessary. This ensure that the local modifications are not lost and also simplifies the procedure for testing patches. This script is adapted from the script in Replicant 6.0 in the vendor_replicant repository which currently is touched by the following commits: adf29f66 build.sh: create missing log directory adf29f667693147583a082c7df7440bbf1b7bb09 And: 79c21f1b Add build script to simplify the build procedure. 79c21f1b9242ac02f6860280c29f966b1ba318b2 Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rwxr-xr-xbuild.sh80
1 files changed, 80 insertions, 0 deletions
diff --git a/build.sh b/build.sh
new file mode 100755
index 00000000..8dc98ab5
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,80 @@
+#!/bin/bash
+# Copyright (C) 2019 Denis 'GNUtoo' Carikli' <GNUtoo@cyberdimension.org>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+set -e
+
+supported_machines=" \
+ crespo \
+ galaxysmtd \
+ gta04 \
+ i9100 \
+ i9300 \
+ maguro \
+ n7000 \
+ n7100 \
+ p3100 \
+ p3110 \
+ p5100 \
+ p5110 \
+"
+
+usage()
+{
+ printf "%s [" "$0"
+ for machine in ${supported_machines} ; do
+ printf "${machine}|"
+ done
+ printf "\b]\n"
+ printf "%s all # build all machines\n" "$0"
+ exit 1
+}
+
+build()
+{
+ machine="$1"
+ parallel_tasks=$(echo "$(grep 'processor' /proc/cpuinfo | wc -l ) + 1" | bc)
+ mkdir -p logs
+ log="logs/build_${machine}_$(date '+%s').log"
+
+ echo "starting to building for ${machine}: ${log}"
+ source build/envsetup.sh
+ lunch "replicant_${machine}-userdebug"
+ time make -j$parallel_tasks bacon 2>&1 | tee "${log}"
+ echo "${machine} DONE: ${log}"
+}
+
+if [ $# -ne 1 ] ; then
+ usage
+fi
+
+if [ "$1" = "all" ] ; then
+ for machine in ${supported_machines} ; do
+ build "${machine}"
+ done
+else
+ found=0
+ for machine in ${supported_machines} ; do
+ if [ "${machine}" = "$1" ] ; then
+ found=1
+ fi
+ done
+
+ if [ ${found} -eq 0 ] ; then
+ printf "machine %s not supported\n" "$1"
+ usage
+ fi
+
+ build "$1"
+fi