perf: use ccache and parallel make, and skip already-built newer-R candidates in bulk (#240)
Some checks failed
ci/crow/cron/process-updates/2 Pipeline was successful
ci/crow/cron/process-updates/11 Pipeline was successful
ci/crow/cron/process-updates/9 Pipeline was successful
ci/crow/cron/process-updates/16 Pipeline was successful
ci/crow/cron/process-updates/8 Pipeline was successful
ci/crow/cron/process-updates/15 Pipeline was successful
ci/crow/cron/process-updates/13 Pipeline was successful
ci/crow/cron/process-updates/10 Pipeline was successful
ci/crow/cron/process-updates/12 Pipeline was successful
ci/crow/cron/process-updates/4 Pipeline was successful
ci/crow/cron/process-updates/14 Pipeline was successful
ci/crow/cron/process-updates/3 Pipeline was successful
ci/crow/cron/process-updates/6 Pipeline is running
ci/crow/cron/process-updates/5 Pipeline failed
ci/crow/cron/process-updates/7 Pipeline was successful
ci/crow/cron/process-updates/1 Pipeline was successful
Some checks failed
ci/crow/cron/process-updates/2 Pipeline was successful
ci/crow/cron/process-updates/11 Pipeline was successful
ci/crow/cron/process-updates/9 Pipeline was successful
ci/crow/cron/process-updates/16 Pipeline was successful
ci/crow/cron/process-updates/8 Pipeline was successful
ci/crow/cron/process-updates/15 Pipeline was successful
ci/crow/cron/process-updates/13 Pipeline was successful
ci/crow/cron/process-updates/10 Pipeline was successful
ci/crow/cron/process-updates/12 Pipeline was successful
ci/crow/cron/process-updates/4 Pipeline was successful
ci/crow/cron/process-updates/14 Pipeline was successful
ci/crow/cron/process-updates/3 Pipeline was successful
ci/crow/cron/process-updates/6 Pipeline is running
ci/crow/cron/process-updates/5 Pipeline failed
ci/crow/cron/process-updates/7 Pipeline was successful
ci/crow/cron/process-updates/1 Pipeline was successful
This commit is contained in:
parent
e7821a75d5
commit
773add042c
1 changed files with 234 additions and 0 deletions
32
local/compiler-cache.sh
Normal file
32
local/compiler-cache.sh
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# Sourced (`. local/compiler-cache.sh`) by the build pipelines before any
|
||||
# package is compiled. POSIX sh: the Alpine images run steps under busybox.
|
||||
#
|
||||
# Routes gcc/g++ through ccache. The images name their compilers by bare
|
||||
# `gcc`/`g++` in both R's Makeconf and /root/.R/Makevars, so prepending ccache's
|
||||
# masquerade dir catches every compile, CMake-driven vendored builds included.
|
||||
# Wrapping CC in a Makevars instead would need R_MAKEVARS_USER, which replaces
|
||||
# the images' /root/.R/Makevars (CXX_STD, the musl defines) rather than adding
|
||||
# to it. The dir differs per distro: Alpine, RHEL, Debian/Ubuntu.
|
||||
for dir in /usr/lib/ccache/bin /usr/lib64/ccache /usr/lib/ccache; do
|
||||
if [ -x "$dir/gcc" ]; then
|
||||
PATH="$dir:$PATH"
|
||||
break
|
||||
fi
|
||||
done
|
||||
export PATH
|
||||
|
||||
# R compiles every package in a fresh /tmp/RtmpXXXXXX/<pkg> dir. R's default
|
||||
# flags include -g, which makes ccache hash the working directory, and the line
|
||||
# markers carry the absolute source path, so without these two settings no
|
||||
# compile ever hits the cache across runs.
|
||||
export CCACHE_BASEDIR="${CCACHE_BASEDIR:-/tmp}"
|
||||
export CCACHE_NOHASHDIR=1
|
||||
# The images are rebuilt regularly, which changes the compiler's mtime but not
|
||||
# its content. ccache's default mtime check would discard the cache each time.
|
||||
export CCACHE_COMPILERCHECK=content
|
||||
|
||||
# Parallel make inside a single package build. Match it to the step's CPU limit
|
||||
# via MAKE_JOBS; an explicit MAKEFLAGS wins.
|
||||
export MAKEFLAGS="${MAKEFLAGS:--j${MAKE_JOBS:-2}}"
|
||||
|
||||
echo "compiler-cache: $(command -v gcc), CCACHE_DIR=${CCACHE_DIR:-unset}, MAKEFLAGS=$MAKEFLAGS"
|
||||
Loading…
Reference in a new issue