mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 07:26:15 +01:00
96652e7def
We want to build GLib against a matched version of gobject-introspection, and this version will probably be bumped quite often as the two are developed in tandem. However, if the CI system provides a newer version, we should probably use that, otherwise we’re essentially downgrading part of the OS on the CI system, and that probably will result in issues. In particular, gobject-introspection <1.82 has a bug on MSYS2 which means it doesn’t build (see issue #3464). So, build gobject-introspection manually if the CI system version is too old, otherwise use the system version. Do this programmatically so we don’t have to repeatedly add and remove the gobject-introspection build commands from the CI configuration as versions are bumped. Fixes: #3464
90 lines
3.0 KiB
Bash
Executable File
90 lines
3.0 KiB
Bash
Executable File
#!/bin/bash
|
||
|
||
set -ex
|
||
|
||
export PATH="/c/msys64/$MSYSTEM/bin:$PATH"
|
||
|
||
pacman --noconfirm -Suy
|
||
|
||
pacman --noconfirm -S --needed \
|
||
base-devel \
|
||
lcov \
|
||
"${MINGW_PACKAGE_PREFIX}"-ccache \
|
||
"${MINGW_PACKAGE_PREFIX}"-gettext \
|
||
"${MINGW_PACKAGE_PREFIX}"-gi-docgen \
|
||
"${MINGW_PACKAGE_PREFIX}"-gobject-introspection \
|
||
"${MINGW_PACKAGE_PREFIX}"-libffi \
|
||
"${MINGW_PACKAGE_PREFIX}"-meson \
|
||
"${MINGW_PACKAGE_PREFIX}"-pcre2 \
|
||
"${MINGW_PACKAGE_PREFIX}"-python3 \
|
||
"${MINGW_PACKAGE_PREFIX}"-python-docutils \
|
||
"${MINGW_PACKAGE_PREFIX}"-python-pip \
|
||
"${MINGW_PACKAGE_PREFIX}"-toolchain \
|
||
"${MINGW_PACKAGE_PREFIX}"-zlib \
|
||
"${MINGW_PACKAGE_PREFIX}"-libelf \
|
||
"${MINGW_PACKAGE_PREFIX}"-gdb
|
||
|
||
mkdir -p _coverage
|
||
mkdir -p _ccache
|
||
CCACHE_BASEDIR="$(pwd)"
|
||
CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
|
||
export CCACHE_BASEDIR CCACHE_DIR
|
||
|
||
PATH="$(cygpath "$USERPROFILE")/.local/bin:$HOME/.local/bin:$PATH"
|
||
DIR="$(pwd)"
|
||
export PATH CFLAGS
|
||
|
||
# If msys2 doesn’t provide a new enough gobject-introspection package, build it
|
||
# ourselves.
|
||
# See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3746#note_2161354
|
||
if [[ $(vercmp "$(pacman -Qi "${MINGW_PACKAGE_PREFIX}"-gobject-introspection | grep -Po '^Version\s*: \K.+')" "${GOBJECT_INTROSPECTION_TAG}") -lt 0 ]]; then
|
||
mkdir -p gobject-introspection
|
||
git clone --branch "${GOBJECT_INTROSPECTION_TAG}" https://gitlab.gnome.org/GNOME/gobject-introspection.git gobject-introspection
|
||
meson gobject-introspection gobject-introspection/build --prefix "/c/msys64/${MSYSTEM}/usr"
|
||
meson install -C gobject-introspection/build
|
||
fi
|
||
|
||
# FIXME: We can’t use ${MESON_COMMON_OPTIONS} here because this script installs
|
||
# Meson 1.3. See the comment in .gitlab-ci.yml about the same problem on
|
||
# FreeBSD.
|
||
# shellcheck disable=SC2086
|
||
meson setup \
|
||
--buildtype=debug \
|
||
--wrap-mode=nodownload \
|
||
--werror \
|
||
-Ddocumentation=true \
|
||
-Dintrospection=enabled \
|
||
-Dman-pages=enabled \
|
||
_build
|
||
|
||
meson compile -C _build
|
||
|
||
if [[ "$CFLAGS" == *"-coverage"* ]]; then
|
||
lcov \
|
||
--quiet \
|
||
--config-file "${DIR}"/.lcovrc \
|
||
--directory "${DIR}/_build" \
|
||
--capture \
|
||
--initial \
|
||
--output-file "${DIR}/_coverage/${CI_JOB_NAME}-baseline.lcov"
|
||
fi
|
||
|
||
meson test -C _build -v --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}"
|
||
meson test -C _build -v --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
|
||
--setup=unstable_tests --suite=failing --suite=flaky || true
|
||
|
||
if [[ "$CFLAGS" == *"-coverage"* ]]; then
|
||
lcov \
|
||
--quiet \
|
||
--config-file "${DIR}"/.lcovrc \
|
||
--directory "${DIR}/_build" \
|
||
--capture \
|
||
--output-file "${DIR}/_coverage/${CI_JOB_NAME}.lcov"
|
||
fi
|
||
|
||
# Copy the built documentation to an artifact directory. The build for docs.gtk.org
|
||
# can then pull it from there — see https://gitlab.gnome.org/GNOME/gtk/-/blob/docs-gtk-org/README.md
|
||
mkdir -p _reference/
|
||
mv _build/docs/reference/glib/glib-win32-2.0/ _reference/glib-win32/
|
||
mv _build/docs/reference/gio/gio-win32-2.0/ _reference/gio-win32/
|