···11# SPDX-License-Identifier: CC0-1.0
22-# SPDX-FileCopyrightText: 2018-2022 Collabora, Ltd. and the Monado contributors
22+# SPDX-FileCopyrightText: 2018-2023 Collabora, Ltd. and the Monado contributors
3344{# ignore the warning, this is actually the template to edit. #}
55######################################
···8080 {# Needed to be a mapping so it could be "merged" #}
8181 FDO_DISTRIBUTION_PACKAGES: '{{image.packages | sort | join(" ")}}'
8282{% if "script" in image %}
8383- FDO_DISTRIBUTION_EXEC: 'bash .gitlab-ci/{{image["script"]}}'
8383+ FDO_DISTRIBUTION_EXEC: 'env FDO_CI_CONCURRENT=${FDO_CI_CONCURRENT} bash .gitlab-ci/{{image["script"]}}'
8484{% endif %}
8585{% endfor -%} {%- endfor %}
8686···166166167167 script:
168168169169+ - .gitlab-ci/prebuild.sh
169170{#- regular or NDK cmake builds -#}
170171{%- if "cmake" in job.name or "ndk" in job.name %}
171172172172- - rm -rf build
173173- - cmake -GNinja -B build -S . {{- make_cmake_args(job.cmake_defines) }}
174174- - echo "Build Options:"; grep "^XRT_" build/CMakeCache.txt
175175- - ninja -C build
173173+ - .gitlab-ci/ci-cmake-build.sh {{- make_cmake_args(job.cmake_defines) }}
176174177175{#- gradle builds -#}
178176{%- elif "android" in job.name %}
179177180180- - cp .gitlab-ci/local.properties .
181181- - ./gradlew clean
182182- - ./gradlew {{ job.target }}
178178+ - .gitlab-ci/ci-gradle-build.sh {{ job.target }}
183179184180{%- else %}
185181···247243 - git config --global user.name {{packaging.name}}
248244 - git config --global user.email {{packaging.email}}
249245 script:
246246+ - .gitlab-ci/prebuild.sh
250247 # Prep the source tree
251248 - git clean -dfx
252249 # Call this script to build binary and source packages.
+22
.gitlab-ci/prebuild.sh
···11+#!/bin/sh
22+# Copyright 2020-2023, Mesa contributors
33+# Copyright 2020, Collabora, Ltd.
44+# SPDX-License-Identifier: MIT
55+66+# From https://gitlab.freedesktop.org/mesa/mesa/-/blob/999b956ebc4c26fa0c407369e630c687ece02209/.gitlab-ci/container/container_pre_build.sh
77+88+set -e
99+1010+# Make a wrapper script for ninja to always include the -j flags
1111+# to avoid oversubscribing/DOS'ing the shared runners
1212+{
1313+ echo '#!/bin/sh -x'
1414+ # shellcheck disable=SC2016
1515+ echo '/usr/bin/ninja -j${FDO_CI_CONCURRENT:-4} "$@"'
1616+} > /usr/local/bin/ninja
1717+chmod +x /usr/local/bin/ninja
1818+1919+2020+# Set MAKEFLAGS so that all make invocations in container builds include the
2121+# flags (doesn't apply to non-container builds, but we don't run make there)
2222+export MAKEFLAGS="-j${FDO_CI_CONCURRENT:-4}"