ci: Switch to using gold as the linker.
[mesa.git] / .gitlab-ci / container / container_pre_build.sh
1 #!/bin/sh
2
3 # Common setup among container builds before we get to building code.
4
5 export CCACHE_COMPILERCHECK=content
6 export CCACHE_COMPRESS=true
7 export CCACHE_DIR=/cache/mesa/ccache
8 export 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.
12 export CC="/usr/lib/ccache/gcc"
13 export 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"
18 find /usr/bin -name \*-ld -o -name ld | \
19 grep -v mingw | \
20 xargs -n 1 -I '{}' ln -sf '{}.gold' '{}'
21
22 ccache --show-stats
23
24 # Make a wrapper script for ninja to always include the -j flags
25 echo '#!/bin/sh -x' > /usr/local/bin/ninja
26 echo '/usr/bin/ninja -j${FDO_CI_CONCURRENT:-4} "$@"' >> /usr/local/bin/ninja
27 chmod +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)
31 export MAKEFLAGS="-j${FDO_CI_CONCURRENT:-4}"