Skip to content

Commit ba04de8

Browse files
committed
Build Scripts: Added Verbose Flag for debugged output (Fixes #61)
1 parent b8aa4b6 commit ba04de8

File tree

3 files changed

+56
-28
lines changed

3 files changed

+56
-28
lines changed

build-scripts/README.md

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,22 @@ You can run these bash scripts to manually compile any GCC toolchains version th
109109
* **Usage parameters:** This script requires a few command-line parameters, just run `./RTBuilder_32b` on terminal:
110110
111111
```shellsession
112-
Usage: ./RTBuilder_32b -g [GCC version] -r [Target Pi type] -o [Target Pi OS type]
113-
-g GCC version you want to compile?: (7.1.0|7.2.0|7.3.0|7.4.0|7.5.0|8.1.0|8.2.0|8.3.0|8.4.0|9.1.0|9.2.0|9.3.0|10.1.0|10.2.0)
114-
-r What's yours Raspberry Pi type?: (0-1|2-3|3+)
115-
-o What's yours Raspberry Pi OS type?: (stretch|buster)
112+
113+
Usage: ./RTBuilder_64b -g [GCC version] -o [Target Pi OS type] -V
114+
-g GCC version you want to compile?: (7.1.0|7.2.0|7.3.0|7.4.0|7.5.0|8.1.0|8.2.0|8.3.0|9.1.0|9.2.0|9.3.0|10.1.0|10.2.0)
115+
-o What's yours Target Raspberry Pi OS type?: (stretch|buster)
116+
-V Verbose output for debugging?
117+
116118
```
117119

118120
* **Usage:** Just pass _targeted [GCC version](#supported-gcc-versions)_ to `-g` parameter, _targeted raspberry pi type_ to `-r` parameter, and _targeted raspberry pi OS type_ to `-o` parameter of this script:
119121

120122
***:warning: You must NOT compile GCC version [less than GCC 8.3.0 for Buster OS](#supported-gcc-versions), otherwise script will automatically switch to build for Stretch OS.***
121123

122124
```shellsession
125+
123126
chmod +x RTBuilder_32b
124-
./RTBuilder_32b -g "9.3.0" -r "2-3" -o "buster"
127+
./RTBuilder_32b -g "9.3.0" -r "2-3" -o "buster" -V
125128

126129
```
127130

@@ -135,18 +138,21 @@ You can run these bash scripts to manually compile any GCC toolchains version th
135138
* **Usage parameters:** This script requires few command-line parameters, just run `./RTBuilder_64b`:
136139
137140
```shellsession
138-
Usage: ./RTBuilder_64b -g [GCC version] -t [OS Type]
139-
-g GCC version you want to compile?: (7.1.0|7.2.0|7.3.0|7.4.0|7.5.0|8.1.0|8.2.0|8.3.0|8.4.0|9.1.0|9.2.0|9.3.0|10.1.0|10.2.0)
140-
-t What's yours Raspberry Pi OS type?: (1|2) [default:1]
141+
142+
Usage: ./RTBuilder_64b -g [GCC version] -o [Target Pi OS type] -V
143+
-g GCC version you want to compile?: (7.1.0|7.2.0|7.3.0|7.4.0|7.5.0|8.1.0|8.2.0|8.3.0|9.1.0|9.2.0|9.3.0|10.1.0|10.2.0)
144+
-o What's yours Target Raspberry Pi OS type?: (stretch|buster)
145+
-V Verbose output for debugging?
141146

142147
```
143148

144149

145150
* **Usage:** Just pass _targeted [GCC version](#supported-gcc-versions)_ to `-g` parameter of this script:
146151

147152
```shellsession
153+
148154
chmod +x RTBuilder_64b
149-
./RTBuilder_64b -g "9.3.0"
155+
./RTBuilder_64b -g "9.3.0" -V
150156

151157
```
152158

@@ -180,22 +186,22 @@ These scripts provide a few additional environment variables to tweak Toolchain
180186

181187
These scripts only support newer GCC versions, those are as follows:
182188

183-
| GCC Version | Stretch OS build (32-bit) | Buster OS build (32-bit) | any 64-bit OS build |
189+
| GCC Version | Stretch OS build (32/64-bit) | Buster OS build (32/64-bit) |
184190
| :-----------: | :----------: | :---------: | :---------: |
185-
| 7.1.0 | supported | x | supported |
186-
| 7.2.0 | supported | x | supported |
187-
| 7.3.0 | supported | x | supported |
188-
| 7.4.0 | supported | x | supported |
189-
| 7.5.0 | supported | x | supported |
190-
| 8.1.0 | supported | x | supported |
191-
| 8.2.0 | supported | x | supported |
192-
| 8.3.0 | supported | supported | supported |
193-
| 8.4.0 | supported | supported | supported |
194-
| 9.1.0 | supported | supported | supported |
195-
| 9.2.0 | supported | supported | supported |
196-
| 9.3.0 | supported | supported | supported |
197-
| 10.1.0 | supported | supported | supported |
198-
| 10.2.0 | supported | supported | supported |
191+
| 7.1.0 | supported | x |
192+
| 7.2.0 | supported | x |
193+
| 7.3.0 | supported | x |
194+
| 7.4.0 | supported | x |
195+
| 7.5.0 | supported | x |
196+
| 8.1.0 | supported | x |
197+
| 8.2.0 | supported | x |
198+
| 8.3.0 | supported | supported |
199+
| 8.4.0 | supported | supported |
200+
| 9.1.0 | supported | supported |
201+
| 9.2.0 | supported | supported |
202+
| 9.3.0 | supported | supported |
203+
| 10.1.0 | supported | supported |
204+
| 10.2.0 | supported | supported |
199205

200206
 
201207

build-scripts/RTBuilder_32b

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,36 @@ helpfunction() {
3333
figlet -t -k -f /usr/share/figlet/term.flf "Copyright (c) 2020 abhiTronix"
3434
echo ""
3535
echo ""
36-
echo "Usage: $0 -g [GCC version] -r [Target Pi type] -o [Target Pi OS type]"
36+
echo "Usage: $0 -g [GCC version] -r [Target Pi type] -o [Target Pi OS type] -V"
3737
echo -e "\t-g GCC version you want to compile?: (7.1.0|7.2.0|7.3.0|7.4.0|7.5.0|8.1.0|8.2.0|8.3.0|9.1.0|9.2.0|9.3.0|10.1.0|10.2.0)"
3838
echo -e "\t-r What's yours Target Raspberry Pi type?: (0-1|2-3|3+)"
3939
echo -e "\t-o What's yours Target Raspberry Pi OS type?: (stretch|buster)"
40+
echo -e "\t-V Verbose output for debugging?"
4041
echo ""
4142
echo ""
4243
exit 1 # Exit script after printing help
4344
}
4445

4546
#input arguments handler
46-
while getopts "g:r:o:" opt; do
47+
while getopts "g:r:o:V" opt; do
4748
case "$opt" in
4849
g) GCC_VERSION="$OPTARG" ;;
4950
r) RPI_TYPE="$OPTARG" ;;
5051
o) RPIOS_TYPE="$OPTARG" ;;
52+
V)
53+
VERBOSE=1
54+
echo "Info: Activated verbose output!"
55+
echo ""
56+
set -eov pipefail # Set verbose mode.
57+
;;
5158
?) helpfunction ;; #prints help function for invalid parameter
5259
esac
5360
done
5461
#validates parameters and print usage helper function in case parameters are missing
62+
if [ -z "$VERBOSE" ]; then
63+
VERBOSE=0
64+
set -eo pipefail # stop the script and exit with return code != 0 if errored
65+
fi
5566
if [ -z "$GCC_VERSION" ] || [ -z "$RPI_TYPE" ] || [ -z "$RPIOS_TYPE" ]; then
5667
echo "Error: Required parameters are missing!"
5768
helpfunction

build-scripts/RTBuilder_64b

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,34 @@ helpfunction() {
3333
figlet -t -k -f /usr/share/figlet/term.flf "Copyright (c) 2020 abhiTronix"
3434
echo ""
3535
echo ""
36-
echo "Usage: $0 -g [GCC version] -o [Target Pi OS type]"
36+
echo "Usage: $0 -g [GCC version] -o [Target Pi OS type] -V"
3737
echo -e "\t-g GCC version you want to compile?: (7.1.0|7.2.0|7.3.0|7.4.0|7.5.0|8.1.0|8.2.0|8.3.0|9.1.0|9.2.0|9.3.0|10.1.0|10.2.0)"
3838
echo -e "\t-o What's yours Target Raspberry Pi OS type?: (stretch|buster)"
39+
echo -e "\t-V Verbose output for debugging?"
3940
echo ""
4041
echo ""
4142
exit 1 # Exits script after printing help
4243
}
4344

4445
#input arguments handler
45-
while getopts "g:o:" opt; do
46+
while getopts "g:o:V" opt; do
4647
case "$opt" in
4748
g) GCC_VERSION="$OPTARG" ;;
4849
o) RPIOS_TYPE="$OPTARG" ;;
50+
V)
51+
VERBOSE=1
52+
echo "Info: Activated verbose output!"
53+
echo ""
54+
set -eov pipefail # Set verbose mode.
55+
;;
4956
?) helpfunction ;; #prints help function for invalid parameter
5057
esac
5158
done
5259
#validates parameters and print usage helper function in case parameters are missing
60+
if [ -z "$VERBOSE" ]; then
61+
VERBOSE=0
62+
set -eo pipefail # stop the script and exit with return code != 0 if errored
63+
fi
5364
if [ -z "$GCC_VERSION" ] || [ -z "$RPIOS_TYPE" ]; then
5465
echo "Error: Required parameters are missing!"
5566
helpfunction

0 commit comments

Comments
 (0)