mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-01-06 05:44:48 +08:00
c1e7e83d52
Our shared runners are set up for concurrent jobs ~= CPUs / 4 (x86) or 8 (ARM). If you use more build processes than that, then jobs may be fighting each other for shared system resources, possibly to the point of failure (we've seen one of the runners OOM on some jobs before, though I'm not sure if this was the cause). To try to systematically prevent the problem, we make a ninja wrapper in the containers that passes the -j flags, and set MAKEFLAGS in the container builds. This doesn't cover make in non-container builds, but I believe we don't have any of those. Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3782> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3782>
30 lines
905 B
Bash
Executable File
30 lines
905 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Common setup among container builds before we get to building code.
|
|
|
|
export CCACHE_COMPILERCHECK=content
|
|
export CCACHE_COMPRESS=true
|
|
export CCACHE_DIR=/cache/mesa/ccache
|
|
export PATH=/usr/lib/ccache:$PATH
|
|
|
|
# CMake ignores $PATH, so we have to force CC/GCC to the ccache versions.
|
|
# Watch out, you can't have spaces in here because the renderdoc build fails.
|
|
export CC="/usr/lib/ccache/gcc"
|
|
export CXX="/usr/lib/ccache/g++"
|
|
|
|
ccache --show-stats
|
|
|
|
if uname -m | grep -q arm || uname -m | grep -q aarch64; then
|
|
export JFLAGS=-j8
|
|
else
|
|
export JFLAGS=-j4
|
|
fi
|
|
|
|
# Make a wrapper script for ninja to always include the -j flags
|
|
echo /usr/bin/ninja $JFLAGS '"$@"' > /usr/local/bin/ninja
|
|
chmod +x /usr/local/bin/ninja
|
|
|
|
# Set MAKEFLAGS so that all make invocations in container builds include the
|
|
# flags (doesn't apply to non-container builds, but we don't run make there)
|
|
export MAKEFLAGS=$JFLAGS
|