1#!/bin/sh
2
3# Common setup among container builds before we get to building code.
4
5export CCACHE_COMPILERCHECK=content
6export CCACHE_COMPRESS=true
7export CCACHE_DIR=/cache/mesa/ccache
8export PATH=/usr/lib/ccache:$PATH
9
10# CMake ignores $PATH, so we have to force CC/GCC to the ccache versions.
11# Watch out, you can't have spaces in here because the renderdoc build fails.
12export CC="/usr/lib/ccache/gcc"
13export CXX="/usr/lib/ccache/g++"
14
15# Force linkers to gold, since it's so much faster for building.  We can't use
16# lld because we're on old debian and it's buggy.  ming fails meson builds
17# with it with "meson.build:21:0: ERROR: Unable to determine dynamic linker"
18find /usr/bin -name \*-ld -o -name ld | \
19    grep -v mingw | \
20    xargs -n 1 -I '{}' ln -sf '{}.gold' '{}'
21
22ccache --show-stats
23
24# Make a wrapper script for ninja to always include the -j flags
25echo '#!/bin/sh -x' > /usr/local/bin/ninja
26echo '/usr/bin/ninja -j${FDO_CI_CONCURRENT:-4} "$@"' >> /usr/local/bin/ninja
27chmod +x /usr/local/bin/ninja
28
29# Set MAKEFLAGS so that all make invocations in container builds include the
30# flags (doesn't apply to non-container builds, but we don't run make there)
31export MAKEFLAGS="-j${FDO_CI_CONCURRENT:-4}"
32