1
1
#! /bin/bash
2
2
3
3
if ! [ -x " $( command -v python3) " ]; then
4
- echo " ERROR: python is not installed! Please install python first."
4
+ echo " ERROR: python is not installed or not in PATH ! Please install python first."
5
5
exit 1
6
6
fi
7
7
8
8
if ! [ -x " $( command -v git) " ]; then
9
- echo " ERROR: git is not installed! Please install git first."
9
+ echo " ERROR: git is not installed or not in PATH! Please install git first."
10
+ exit 1
11
+ fi
12
+
13
+ if ! [ -x " $( command -v ninja) " ]; then
14
+ echo " ERROR: ninja is not installed or not in PATH! Please install ninja first."
10
15
exit 1
11
16
fi
12
17
13
18
# Fixes building some components. See https://github.com/espressif/arduino-esp32/issues/10167
14
19
export IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS=1
15
20
21
+ CCACHE_ENABLE=1
22
+
16
23
export TARGET=" esp32"
17
24
BUILD_TYPE=" all"
18
25
SKIP_ENV=0
@@ -21,8 +28,9 @@ ARCHIVE_OUT=1
21
28
DEPLOY_OUT=0
22
29
23
30
function print_help() {
24
- echo " Usage: build.sh [-s] [-A <arduino_branch>] [-I <idf_branch>] [-i <idf_commit>] [-c <path>] [-t <target>] [-b <build|menuconfig|reconfigure|idf-libs|copy-bootloader|mem-variant>] [config ...]"
31
+ echo " Usage: build.sh [-s] [-n] [- A <arduino_branch>] [-I <idf_branch>] [-i <idf_commit>] [-c <path>] [-t <target>] [-b <build|menuconfig|reconfigure|idf-libs|copy-bootloader|mem-variant>] [config ...]"
25
32
echo " -s Skip installing/updating of ESP-IDF and all components"
33
+ echo " -n Disable ccache"
26
34
echo " -A Set which branch of arduino-esp32 to be used for compilation"
27
35
echo " -I Set which branch of ESP-IDF to be used for compilation"
28
36
echo " -i Set which commit of ESP-IDF to be used for compilation"
@@ -38,6 +46,9 @@ while getopts ":A:I:i:c:t:b:sde" opt; do
38
46
s )
39
47
SKIP_ENV=1
40
48
;;
49
+ n )
50
+ CCACHE_ENABLE=0
51
+ ;;
41
52
e )
42
53
ARCHIVE_OUT=1
43
54
;;
78
89
shift $(( OPTIND - 1 ))
79
90
CONFIGS=$@
80
91
92
+ export IDF_CCACHE_ENABLE=$CCACHE_ENABLE
93
+
81
94
# Output the TARGET array
82
95
echo " TARGET(s): ${TARGET[@]} "
83
96
84
97
mkdir -p dist
85
98
rm -rf dependencies.lock
86
99
87
100
if [ $SKIP_ENV -eq 0 ]; then
88
- echo " * Installing ESP-IDF/Arduino and all components..."
101
+ echo " * Installing/Updating Arduino and ESP-IDF."
102
+
89
103
# install arduino component
90
104
./tools/install-arduino.sh
91
105
if [ $? -ne 0 ]; then exit 1; fi
@@ -137,7 +151,7 @@ if [ "$BUILD_TYPE" != "all" ]; then
137
151
138
152
echo " idf.py -DIDF_TARGET=\" $target \" -DSDKCONFIG_DEFAULTS=\" $configs \" $BUILD_TYPE "
139
153
rm -rf build sdkconfig
140
- idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $configs " $BUILD_TYPE
154
+ COMPONENTS_SUBSET=full idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $configs " $BUILD_TYPE
141
155
if [ $? -ne 0 ]; then exit 1; fi
142
156
done
143
157
exit 0
@@ -200,7 +214,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
200
214
201
215
echo " * Build IDF-Libs: $idf_libs_configs "
202
216
rm -rf build sdkconfig
203
- idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $idf_libs_configs " idf-libs
217
+ COMPONENTS_SUBSET=full idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $idf_libs_configs " idf-libs
204
218
if [ $? -ne 0 ]; then exit 1; fi
205
219
206
220
# Build Bootloaders
@@ -212,7 +226,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
212
226
213
227
echo " * Build BootLoader: $bootloader_configs "
214
228
rm -rf build sdkconfig
215
- idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $bootloader_configs " copy-bootloader
229
+ COMPONENTS_SUBSET=none idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $bootloader_configs " copy-bootloader
216
230
if [ $? -ne 0 ]; then exit 1; fi
217
231
done
218
232
@@ -225,7 +239,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
225
239
226
240
echo " * Build Memory Variant: $mem_configs "
227
241
rm -rf build sdkconfig
228
- idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $mem_configs " mem-variant
242
+ COMPONENTS_SUBSET=none idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $mem_configs " mem-variant
229
243
if [ $? -ne 0 ]; then exit 1; fi
230
244
done
231
245
done
0 commit comments