• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2
3if test -x /usr/bin/ccache; then
4    if test -f /etc/debian_version; then
5        CCACHE_PATH=/usr/lib/ccache
6    elif test -f /etc/alpine-release; then
7        CCACHE_PATH=/usr/lib/ccache/bin
8    else
9        CCACHE_PATH=/usr/lib64/ccache
10    fi
11
12    # Common setup among container builds before we get to building code.
13
14    export CCACHE_COMPILERCHECK=content
15    export CCACHE_COMPRESS=true
16    export CCACHE_DIR="/cache/$CI_PROJECT_NAME/ccache"
17    export PATH="$CCACHE_PATH:$PATH"
18
19    # CMake ignores $PATH, so we have to force CC/GCC to the ccache versions.
20    export CC="${CCACHE_PATH}/gcc"
21    export CXX="${CCACHE_PATH}/g++"
22
23    ccache --show-stats
24fi
25
26# Make a wrapper script for ninja to always include the -j flags
27{
28    echo '#!/bin/sh -x'
29    # shellcheck disable=SC2016
30    echo '/usr/bin/ninja -j${FDO_CI_CONCURRENT:-4} "$@"'
31} > /usr/local/bin/ninja
32chmod +x /usr/local/bin/ninja
33
34# Set MAKEFLAGS so that all make invocations in container builds include the
35# flags (doesn't apply to non-container builds, but we don't run make there)
36export MAKEFLAGS="-j${FDO_CI_CONCURRENT:-4}"
37
38# make wget to try more than once, when download fails or timeout
39echo -e "retry_connrefused = on\n" \
40        "read_timeout = 300\n" \
41        "tries = 4\n" \
42	"retry_on_host_error = on\n" \
43	"retry_on_http_error = 429,500,502,503,504\n" \
44        "wait_retry = 32" >> /etc/wgetrc
45