1bf215546Sopenharmony_ci#!/bin/sh 2bf215546Sopenharmony_ci 3bf215546Sopenharmony_ciif test -f /etc/debian_version; then 4bf215546Sopenharmony_ci CCACHE_PATH=/usr/lib/ccache 5bf215546Sopenharmony_cielse 6bf215546Sopenharmony_ci CCACHE_PATH=/usr/lib64/ccache 7bf215546Sopenharmony_cifi 8bf215546Sopenharmony_ci 9bf215546Sopenharmony_ci# Common setup among container builds before we get to building code. 10bf215546Sopenharmony_ci 11bf215546Sopenharmony_ciexport CCACHE_COMPILERCHECK=content 12bf215546Sopenharmony_ciexport CCACHE_COMPRESS=true 13bf215546Sopenharmony_ciexport CCACHE_DIR=/cache/$CI_PROJECT_NAME/ccache 14bf215546Sopenharmony_ciexport PATH=$CCACHE_PATH:$PATH 15bf215546Sopenharmony_ci 16bf215546Sopenharmony_ci# CMake ignores $PATH, so we have to force CC/GCC to the ccache versions. 17bf215546Sopenharmony_ciexport CC="${CCACHE_PATH}/gcc" 18bf215546Sopenharmony_ciexport CXX="${CCACHE_PATH}/g++" 19bf215546Sopenharmony_ci 20bf215546Sopenharmony_ci# Force linkers to gold, since it's so much faster for building. We can't use 21bf215546Sopenharmony_ci# lld because we're on old debian and it's buggy. ming fails meson builds 22bf215546Sopenharmony_ci# with it with "meson.build:21:0: ERROR: Unable to determine dynamic linker" 23bf215546Sopenharmony_cifind /usr/bin -name \*-ld -o -name ld | \ 24bf215546Sopenharmony_ci grep -v mingw | \ 25bf215546Sopenharmony_ci xargs -n 1 -I '{}' ln -sf '{}.gold' '{}' 26bf215546Sopenharmony_ci 27bf215546Sopenharmony_ciccache --show-stats 28bf215546Sopenharmony_ci 29bf215546Sopenharmony_ci# Make a wrapper script for ninja to always include the -j flags 30bf215546Sopenharmony_ciecho '#!/bin/sh -x' > /usr/local/bin/ninja 31bf215546Sopenharmony_ciecho '/usr/bin/ninja -j${FDO_CI_CONCURRENT:-4} "$@"' >> /usr/local/bin/ninja 32bf215546Sopenharmony_cichmod +x /usr/local/bin/ninja 33bf215546Sopenharmony_ci 34bf215546Sopenharmony_ci# Set MAKEFLAGS so that all make invocations in container builds include the 35bf215546Sopenharmony_ci# flags (doesn't apply to non-container builds, but we don't run make there) 36bf215546Sopenharmony_ciexport MAKEFLAGS="-j${FDO_CI_CONCURRENT:-4}" 37bf215546Sopenharmony_ci 38bf215546Sopenharmony_ci# make wget to try more than once, when download fails or timeout 39bf215546Sopenharmony_ciecho -e "retry_connrefused = on\n" \ 40bf215546Sopenharmony_ci "read_timeout = 300\n" \ 41bf215546Sopenharmony_ci "tries = 4\n" \ 42bf215546Sopenharmony_ci "wait_retry = 32" >> /etc/wgetrc 43