24
24
# - wget
25
25
26
26
set -e
27
+ set -o xtrace
27
28
28
29
WD=$( cd $( dirname $0 ) && pwd)
29
30
WORKSPACE=$( cd $WD /.. && pwd -P)
@@ -36,12 +37,12 @@ EXTRA_PATH=
36
37
37
38
case $os in
38
39
Darwin)
39
- install=" python-tools u-boot-tools discoteq-flock elf-toolchain gen-romfs kconfig-frontends bloaty arm-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain avr-gcc-toolchain"
40
+ install=" python-tools u-boot-tools discoteq-flock elf-toolchain gen-romfs kconfig-frontends arm-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain avr-gcc-toolchain c-cache "
40
41
mkdir -p ${prebuilt} /homebrew
41
42
export HOMEBREW_CACHE=${prebuilt} /homebrew
42
43
;;
43
44
Linux)
44
- install=" python-tools gen-romfs gperf kconfig-frontends bloaty arm-gcc-toolchain mips-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain rx-gcc-toolchain c-cache"
45
+ install=" python-tools gen-romfs gperf kconfig-frontends arm-gcc-toolchain mips-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain rx-gcc-toolchain c-cache"
45
46
;;
46
47
esac
47
48
@@ -289,21 +290,39 @@ function rx-gcc-toolchain {
289
290
function c-cache {
290
291
add_path $prebuilt /ccache/bin
291
292
292
- if [ ! -f " $prebuilt / ccache/bin/ccache " ] ; then
293
- cd $prebuilt ;
294
- wget --quiet https://github.com/ccache/ccache/releases/download/v3.7.7/ccache-3.7.7.tar.gz
295
- tar zxf ccache-3.7.7.tar.gz
296
- cd ccache-3.7.7 ; ./configure --prefix= $prebuilt /ccache ; make ; make install
297
- cd $prebuilt ; rm -rf ccache-3.7.7 ; rm ccache-3.7.7.tar.gz
298
- ln -sf $prebuilt /ccache/bin/ccache $prebuilt /ccache/bin/gcc
299
- ln -sf $prebuilt /ccache/bin /ccache $prebuilt /ccache/bin/g++
300
- ln -sf $prebuilt /ccache/bin/ccache $prebuilt / ccache/bin/arm-none-eabi-gcc
301
- ln -sf $prebuilt /ccache/bin/ccache $prebuilt /ccache/bin/arm-none-eabi-g++
302
- ln -sf $prebuilt / ccache/bin/ccache $prebuilt / ccache/bin/p32-gcc
303
- ln -sf $prebuilt /ccache/bin/ccache $prebuilt /ccache/bin/riscv64-unknown-elf-gcc
304
- ln -sf $prebuilt /ccache/bin/ccache $prebuilt /ccache/bin/riscv64-unknown-elf-g++
293
+ if ! type ccache > /dev/null ; then
294
+ case $os in
295
+ Darwin)
296
+ brew install ccache
297
+ ;;
298
+ Linux)
299
+ cd $prebuilt ;
300
+ wget https://github.com /ccache/ccache/releases/download/v3.7.7/ccache-3.7.7.tar.gz
301
+ tar zxf ccache-3.7.7.tar.gz
302
+ cd ccache-3.7.7 ; ./configure --prefix= $prebuilt /ccache; make ; make install
303
+ cd $prebuilt ; rm -rf ccache-3.7.7 ; rm ccache-3.7.7.tar.gz
304
+ ;;
305
+ esac
305
306
fi
307
+
306
308
ccache --version
309
+ mkdir -p $prebuilt /ccache/bin/
310
+ ln -sf ` which ccache` $prebuilt /ccache/bin/x86_64-elf-gcc
311
+ ln -sf ` which ccache` $prebuilt /ccache/bin/x86_64-elf-g++
312
+ ln -sf ` which ccache` $prebuilt /ccache/bin/cc
313
+ ln -sf ` which ccache` $prebuilt /ccache/bin/c++
314
+ ln -sf ` which ccache` $prebuilt /ccache/bin/clang
315
+ ln -sf ` which ccache` $prebuilt /ccache/bin/clang++
316
+ ln -sf ` which ccache` $prebuilt /ccache/bin/gcc
317
+ ln -sf ` which ccache` $prebuilt /ccache/bin/g++
318
+ ln -sf ` which ccache` $prebuilt /ccache/bin/arm-none-eabi-gcc
319
+ ln -sf ` which ccache` $prebuilt /ccache/bin/arm-none-eabi-g++
320
+ ln -sf ` which ccache` $prebuilt /ccache/bin/p32-gcc
321
+ ln -sf ` which ccache` $prebuilt /ccache/bin/riscv64-unknown-elf-gcc
322
+ ln -sf ` which ccache` $prebuilt /ccache/bin/riscv64-unknown-elf-g++
323
+ ln -sf ` which ccache` $prebuilt /ccache/bin/xtensa-esp32-elf-gcc
324
+ ln -sf ` which ccache` $prebuilt /ccache/bin/avr-gcc
325
+ ln -sf ` which ccache` $prebuilt /ccache/bin/avr-g++
307
326
}
308
327
309
328
function usage {
@@ -324,8 +343,7 @@ function usage {
324
343
325
344
function enable_ccache {
326
345
export USE_CCACHE=1;
327
- export CCACHE_DIR=$prebuilt /ccache/.ccache;
328
- ccache -c
346
+ ccache -z
329
347
ccache -M 5G;
330
348
ccache -s
331
349
}
0 commit comments