ci: Make ccache optional
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21781>
This commit is contained in:
15
.gitlab-ci/build/g++-link-werror.sh
Executable file
15
.gitlab-ci/build/g++-link-werror.sh
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
if [ "$(ps -p $(ps -p $PPID -o ppid --no-headers) -o comm --no-headers)" != ninja ]; then
|
||||||
|
# Not invoked by ninja (e.g. for a meson feature check)
|
||||||
|
exec g++ "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$(eval printf "'%s'" "\"\${$(($#-1))}\"")" = "-c" ]; then
|
||||||
|
# Not invoked for linking
|
||||||
|
exec g++ "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Compiler invoked by ninja for linking. Add -Werror to turn compiler warnings into errors
|
||||||
|
# with LTO. (meson's werror should arguably do this, but meanwhile we need to)
|
||||||
|
exec g++ "$@" -Werror
|
15
.gitlab-ci/build/gcc-link-werror.sh
Executable file
15
.gitlab-ci/build/gcc-link-werror.sh
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
if [ "$(ps -p $(ps -p $PPID -o ppid --no-headers) -o comm --no-headers)" != ninja ]; then
|
||||||
|
# Not invoked by ninja (e.g. for a meson feature check)
|
||||||
|
exec gcc "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$(eval printf "'%s'" "\"\${$(($#-1))}\"")" = "-c" ]; then
|
||||||
|
# Not invoked for linking
|
||||||
|
exec gcc "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Compiler invoked by ninja for linking. Add -Werror to turn compiler warnings into errors
|
||||||
|
# with LTO. (meson's werror should arguably do this, but meanwhile we need to)
|
||||||
|
exec gcc "$@" -Werror
|
@@ -25,11 +25,13 @@
|
|||||||
- |
|
- |
|
||||||
export PATH="/usr/lib/ccache:$PATH"
|
export PATH="/usr/lib/ccache:$PATH"
|
||||||
export CCACHE_BASEDIR="$PWD"
|
export CCACHE_BASEDIR="$PWD"
|
||||||
section_start ccache_before "ccache stats before build"
|
if test -x /usr/bin/ccache; then
|
||||||
ccache --show-stats
|
section_start ccache_before "ccache stats before build"
|
||||||
section_end ccache_before
|
ccache --show-stats
|
||||||
|
section_end ccache_before
|
||||||
|
fi
|
||||||
after_script:
|
after_script:
|
||||||
- ccache --show-stats | grep "cache hit rate"
|
- if test -x /usr/bin/ccache; then ccache --show-stats | grep "cache hit rate"; fi
|
||||||
- !reference [default, after_script]
|
- !reference [default, after_script]
|
||||||
|
|
||||||
.build-windows:
|
.build-windows:
|
||||||
@@ -182,7 +184,7 @@ debian-build-testing:
|
|||||||
GALLIUM_DRIVERS: "iris,nouveau,kmsro,r300,r600,freedreno,swrast,svga,v3d,vc4,virgl,etnaviv,panfrost,lima,zink,d3d12,asahi,crocus"
|
GALLIUM_DRIVERS: "iris,nouveau,kmsro,r300,r600,freedreno,swrast,svga,v3d,vc4,virgl,etnaviv,panfrost,lima,zink,d3d12,asahi,crocus"
|
||||||
VULKAN_DRIVERS: swrast
|
VULKAN_DRIVERS: swrast
|
||||||
EXTRA_OPTION: >
|
EXTRA_OPTION: >
|
||||||
--native-file .gitlab-ci/build/meson-native-lto-wrappers.txt
|
--native-file .gitlab-ci/build/meson-native-lto-wrappers-ccache.txt
|
||||||
-D spirv-to-dxil=true
|
-D spirv-to-dxil=true
|
||||||
-D osmesa=true
|
-D osmesa=true
|
||||||
-D tools=drm-shim,etnaviv,freedreno,glsl,intel,intel-ui,nir,nouveau,lima,panfrost,asahi
|
-D tools=drm-shim,etnaviv,freedreno,glsl,intel,intel-ui,nir,nouveau,lima,panfrost,asahi
|
||||||
|
3
.gitlab-ci/build/meson-native-lto-wrappers-ccache.txt
Normal file
3
.gitlab-ci/build/meson-native-lto-wrappers-ccache.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[binaries]
|
||||||
|
c = 'ccache-gcc-link-werror.sh'
|
||||||
|
cpp = 'ccache-g++-link-werror.sh'
|
@@ -1,3 +1,3 @@
|
|||||||
[binaries]
|
[binaries]
|
||||||
c = 'ccache-gcc-link-werror.sh'
|
c = 'gcc-link-werror.sh'
|
||||||
cpp = 'ccache-g++-link-werror.sh'
|
cpp = 'g++-link-werror.sh'
|
||||||
|
@@ -7,4 +7,6 @@ fi
|
|||||||
# Clean up any build cache for rust.
|
# Clean up any build cache for rust.
|
||||||
rm -rf /.cargo
|
rm -rf /.cargo
|
||||||
|
|
||||||
ccache --show-stats
|
if test -x /usr/bin/ccache; then
|
||||||
|
ccache --show-stats
|
||||||
|
fi
|
||||||
|
@@ -1,24 +1,28 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if test -f /etc/debian_version; then
|
if test -x /usr/bin/ccache; then
|
||||||
CCACHE_PATH=/usr/lib/ccache
|
if test -f /etc/debian_version; then
|
||||||
elif test -f /etc/alpine-release; then
|
CCACHE_PATH=/usr/lib/ccache
|
||||||
CCACHE_PATH=/usr/lib/ccache/bin
|
elif test -f /etc/alpine-release; then
|
||||||
else
|
CCACHE_PATH=/usr/lib/ccache/bin
|
||||||
CCACHE_PATH=/usr/lib64/ccache
|
else
|
||||||
|
CCACHE_PATH=/usr/lib64/ccache
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Common setup among container builds before we get to building code.
|
||||||
|
|
||||||
|
export CCACHE_COMPILERCHECK=content
|
||||||
|
export CCACHE_COMPRESS=true
|
||||||
|
export CCACHE_DIR=/cache/$CI_PROJECT_NAME/ccache
|
||||||
|
export PATH=$CCACHE_PATH:$PATH
|
||||||
|
|
||||||
|
# CMake ignores $PATH, so we have to force CC/GCC to the ccache versions.
|
||||||
|
export CC="${CCACHE_PATH}/gcc"
|
||||||
|
export CXX="${CCACHE_PATH}/g++"
|
||||||
|
|
||||||
|
ccache --show-stats
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Common setup among container builds before we get to building code.
|
|
||||||
|
|
||||||
export CCACHE_COMPILERCHECK=content
|
|
||||||
export CCACHE_COMPRESS=true
|
|
||||||
export CCACHE_DIR=/cache/$CI_PROJECT_NAME/ccache
|
|
||||||
export PATH=$CCACHE_PATH:$PATH
|
|
||||||
|
|
||||||
# CMake ignores $PATH, so we have to force CC/GCC to the ccache versions.
|
|
||||||
export CC="${CCACHE_PATH}/gcc"
|
|
||||||
export CXX="${CCACHE_PATH}/g++"
|
|
||||||
|
|
||||||
# When not using the mold linker (e.g. unsupported architecture), force
|
# When not using the mold linker (e.g. unsupported architecture), force
|
||||||
# linkers to gold, since it's so much faster for building. We can't use
|
# linkers to gold, since it's so much faster for building. We can't use
|
||||||
# lld because we're on old debian and it's buggy. ming fails meson builds
|
# lld because we're on old debian and it's buggy. ming fails meson builds
|
||||||
@@ -27,8 +31,6 @@ find /usr/bin -name \*-ld -o -name ld | \
|
|||||||
grep -v mingw | \
|
grep -v mingw | \
|
||||||
xargs -n 1 -I '{}' ln -sf '{}.gold' '{}'
|
xargs -n 1 -I '{}' ln -sf '{}.gold' '{}'
|
||||||
|
|
||||||
ccache --show-stats
|
|
||||||
|
|
||||||
# Make a wrapper script for ninja to always include the -j flags
|
# Make a wrapper script for ninja to always include the -j flags
|
||||||
{
|
{
|
||||||
echo '#!/bin/sh -x'
|
echo '#!/bin/sh -x'
|
||||||
|
Reference in New Issue
Block a user