Dark Eyes | 4345054 | 2015-12-11 22:15:28 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # BlissPop Compilation Script |
| 4 | # |
| 5 | # Copyright (C) 2015 Team Bliss |
| 6 | # |
| 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by |
| 9 | # the Free Software Foundation, either version 3 of the License, or |
| 10 | # any later version. |
| 11 | # |
| 12 | # This program is distributed in the hope that it will be useful, |
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | # GNU General Public License for more details. |
| 16 | # |
| 17 | # You should have received a copy of the GNU General Public License |
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | |
| 20 | |
| 21 | # No scrollback buffer |
| 22 | echo -e '\0033\0143' |
| 23 | |
| 24 | |
| 25 | |
| 26 | # Get intial time of script startup |
| 27 | res1=$(date +%s.%N) |
| 28 | |
| 29 | |
| 30 | |
| 31 | # Specify colors for shell |
| 32 | red='tput setaf 1' # red |
| 33 | green='tput setaf 2' # green |
| 34 | yellow='tput setaf 3' # yellow |
| 35 | blue='tput setaf 4' # blue |
| 36 | violet='tput setaf 5' # violet |
| 37 | cyan='tput setaf 6' # cyan |
| 38 | white='tput setaf 7' # white |
| 39 | txtbld=$(tput bold) # Bold |
| 40 | bldred=${txtbld}$(tput setaf 1) # Bold red |
| 41 | bldgrn=${txtbld}$(tput setaf 2) # Bold green |
| 42 | bldblu=${txtbld}$(tput setaf 4) # Bold blue |
| 43 | bldcya=${txtbld}$(tput setaf 6) # Bold cyan |
| 44 | normal='tput sgr0' |
| 45 | |
| 46 | |
| 47 | tput bold |
| 48 | tput setaf 1 |
| 49 | clear |
| 50 | echo -e "" |
| 51 | echo -e " ___ ___ ___ ___ " |
| 52 | echo -e " /\ \ /\__\ ___ /\ \ /\ \ " |
| 53 | echo -e " /::\ \ /:/ / /\ \ /::\ \ /::\ \ " |
| 54 | echo -e " /:/\:\ \ /:/ / \:\ \ /:/\ \ \ /:/\ \ \ " |
| 55 | echo -e " /::\~\:\__\ /:/ / /::\__\ _\:\~\ \ \ _\:\~\ \ \ " |
| 56 | echo -e " /:/\:\ \:|__| /:/__/ __/:/\/__/ /\ \:\ \ \__\ /\ \:\ \ \__\ " |
| 57 | echo -e " \:\~\:\/:/ / \:\ \ /\/:/ / \:\ \:\ \/__/ \:\ \:\ \/__/ " |
| 58 | echo -e " \:\ \::/ / \:\ \ \::/__/ \:\ \:\__\ \:\ \:\__\ " |
| 59 | echo -e " \:\/:/ / \:\ \ \:\__\ \:\/:/ / \:\/:/ / " |
| 60 | echo -e " \::/__/ \:\__\ \/__/ \::/ / \::/ / " |
| 61 | echo -e " ~~ \/__/ \/__/ \/__/ " |
| 62 | echo -e "" |
| 63 | echo -e "" |
| 64 | echo -e "" |
| 65 | echo -e "" |
| 66 | echo -e "" |
| 67 | |
| 68 | sleep 3s |
| 69 | |
| 70 | |
| 71 | # Confirm 'repo sync' |
| 72 | echo -e "\n\n${bldgrn} Do you want to repo sync before proceeding?\n" |
| 73 | echo "" |
| 74 | echo -e "${bldblu} 1. Yes" |
| 75 | echo -e "${bldblu} 2. No" |
| 76 | echo "" |
| 77 | echo "" |
| 78 | $normal |
| 79 | read askreposync |
| 80 | |
| 81 | # Confirm 'make clean' |
| 82 | echo -e "\n\n${bldgrn} Do you want to make clean?\n" |
| 83 | echo "" |
| 84 | echo -e "${bldblu} 1. Yes" |
| 85 | echo -e "${bldblu} 2. No" |
| 86 | echo "" |
| 87 | echo "" |
| 88 | $normal |
| 89 | read askClean |
| 90 | |
| 91 | echo "" |
| 92 | echo "" |
| 93 | if [ "$askreposync" == "1" ] |
| 94 | then |
| 95 | echo -e "${bldred} Will repo sync before starting the build... " |
| 96 | else |
| 97 | echo -e "${bldred} Will continue without repo syncing... " |
| 98 | fi |
| 99 | echo "" |
| 100 | echo "" |
| 101 | |
| 102 | echo "" |
| 103 | echo "" |
| 104 | |
| 105 | if [ "$askClean" == "1" ] |
| 106 | then |
| 107 | echo -e "${bldred} Compilation will continue after cleaning previous build files... " |
| 108 | else |
| 109 | echo -e "${bldred} ROM will be compiled without cleaning previous build files... " |
| 110 | fi |
| 111 | echo "" |
| 112 | echo "" |
| 113 | |
| 114 | echo "" |
| 115 | echo "" |
| 116 | |
| 117 | |
| 118 | sleep 2s |
| 119 | |
| 120 | |
| 121 | if [ "$askreposync" == "1" ] |
| 122 | then |
| 123 | echo "" |
| 124 | echo "" |
| 125 | echo -e "${bldgrn} syncing... " |
| 126 | echo "" |
| 127 | echo "" |
| 128 | $normal |
| 129 | repo sync -j250 |
| 130 | fi |
| 131 | |
| 132 | if [ "$askClean" == "1" ] |
| 133 | then |
| 134 | echo "" |
| 135 | echo "" |
| 136 | echo -e "${bldgrn} Cleaning before starting build... " |
| 137 | echo "" |
| 138 | echo "" |
| 139 | $normal |
| 140 | rm -rf out |
| 141 | fi |
| 142 | |
| 143 | # Setup environment |
| 144 | echo -e "" |
| 145 | echo -e "" |
| 146 | echo -e "${bldgrn} Setting up build environment..." |
| 147 | echo -e "" |
| 148 | echo -e "" |
| 149 | $normal |
| 150 | . build/envsetup.sh |
| 151 | |
| 152 | |
| 153 | # Lunch device |
| 154 | echo -e "" |
| 155 | echo -e "" |
| 156 | echo -e "${bldcya} Choose your device from the lunch menu..." |
| 157 | echo -e "" |
| 158 | echo -e "" |
| 159 | $normal |
| 160 | $green |
| 161 | lunch |
| 162 | |
| 163 | # Start compilation |
| 164 | echo -e "" |
| 165 | echo -e "" |
| 166 | echo -e "${bldcya} Starting compilation BlissPop..." |
| 167 | echo -e "" |
| 168 | echo -e "" |
| 169 | $normal |
| 170 | mka bacon |
| 171 | echo -e "" |
| 172 | |
| 173 | |
| 174 | |
| 175 | # Compilation complete |
| 176 | tput bold |
| 177 | tput setaf 1 |
| 178 | echo -e "" |
| 179 | echo -e "The build process has finished" |
| 180 | echo -e "" |
| 181 | echo -e "" |