From: Ralf Habacker Date: Tue, 1 Mar 2022 12:25:01 +0000 (+0100) Subject: On CI add build support for openSUSE distributions X-Git-Tag: dbus-1.15.0~82^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=acdf5a7a185d67f3a62c4be1af5fa18b299ce8a9;p=thirdparty%2Fdbus.git On CI add build support for openSUSE distributions The mingw related jobs are running the whole test suite which is an extension to the available jobs. The environment variable ci_suite is not used on openSUSE distributions, as it is determined from the installed image. Signed-off-by: Ralf Habacker --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4e8b7b5f1..d38e63cc1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -70,9 +70,8 @@ windows amd64 docker: Exit 1 } -.debian-build: +.unix-host-build: stage: build - image: "debian:bullseye-slim" cache: key: ${CI_JOB_NAME} paths: @@ -89,6 +88,10 @@ windows amd64 docker: - chown -R user . - runuser -u user ./tools/ci-build.sh +.debian-build: + extends: .unix-host-build + image: "debian:bullseye-slim" + debian autotools production: extends: .debian-build variables: @@ -148,6 +151,34 @@ debian buster autotools: variables: ci_suite: "buster" +.suse-build: + extends: .unix-host-build + image: "opensuse/leap:15" + variables: + ci_distro: "opensuse" + +opensuse cmake: + extends: .suse-build + variables: + ci_buildsys: "cmake" + ci_local_packages: "no" + +opensuse mingw32 cmake: + extends: .suse-build + when: manual + variables: + ci_buildsys: "cmake" + ci_host: "i686-w64-mingw32" + ci_local_packages: "no" + +opensuse mingw64 cmake debug: + extends: .suse-build + variables: + ci_buildsys: "cmake" + ci_host: "x86_64-w64-mingw32" + ci_local_packages: "no" + ci_variant: "debug" + .win-build: image: $WINDOWS_IMAGE stage: build diff --git a/tools/ci-build.sh b/tools/ci-build.sh index f3c194151..d6951cb81 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -358,12 +358,22 @@ case "$ci_buildsys" in (cmake|cmake-dist) cmdwrapper= + cmake=cmake case "$ci_host" in (*-w64-mingw32) # CFLAGS and CXXFLAGS does do work, checked with cmake 3.15 export LDFLAGS="-${ci_runtime}-libgcc" # enable tests if supported if [ "$ci_test" = yes ]; then + # choose correct wine architecture + if [ "${ci_distro}" = opensuse ]; then + if [ "${ci_host%%-*}" = x86_64 ]; then + export WINEARCH=win64 + cmake=mingw64-cmake + else + cmake=mingw32-cmake + fi + fi libgcc_path= if [ "$ci_runtime" = "shared" ]; then libgcc_path=$(dirname "$("${ci_host}-gcc" -print-libgcc-file-name)") @@ -372,7 +382,9 @@ case "$ci_buildsys" in cmdwrapper="xvfb-run -a" fi set _ "$@" - set "$@" -D CMAKE_TOOLCHAIN_FILE="${srcdir}/cmake/${ci_host}.cmake" + if [ "$ci_distro" != "opensuse" ]; then + set "$@" -D CMAKE_TOOLCHAIN_FILE="${srcdir}/cmake/${ci_host}.cmake" + fi set "$@" -D CMAKE_PREFIX_PATH="${dep_prefix}" if [ "$ci_local_packages" = yes ]; then set "$@" -D CMAKE_INCLUDE_PATH="${dep_prefix}/include" @@ -389,7 +401,7 @@ case "$ci_buildsys" in ;; esac - cmake "$@" -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_WERROR=ON .. + $cmake "$@" -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_WERROR=ON .. ${make} # The test coverage for OOM-safety is too verbose to be useful on diff --git a/tools/ci-install.sh b/tools/ci-install.sh index bc1f72e45..a331f931d 100755 --- a/tools/ci-install.sh +++ b/tools/ci-install.sh @@ -176,6 +176,117 @@ case "$ci_distro" in echo "user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/nopasswd chmod 0440 /etc/sudoers.d/nopasswd fi + ;; + + (opensuse) + zypper="/usr/bin/zypper --non-interactive" + # system + packages=( + sudo + ) + + # build system + packages=( + "${packages[@]}" + autoconf + autoconf-archive + automake + cmake + libtool + ) + + # docs + packages=( + "${packages[@]}" + docbook_4 + docbook-xsl-stylesheets + doxygen + libqt5-qttools + libxslt-tools + yelp-tools + ) + + # dbus (autogen.sh) + packages=( + "${packages[@]}" + which + ) + + case "$ci_host" in + (*-w64-mingw32) + # cross + packages=( + "${packages[@]}" + wine + xvfb-run + ) + + # choose distribution + id=$(. /etc/os-release; echo ${ID} | sed 's, ,_,g') + case "$id" in + (opensuse-leap) + version=$(. /etc/os-release; echo ${VERSION_ID} | sed 's, ,_,g') + repo="openSUSE_Leap_$version" + ;; + (opensuse-tumbleweed) + repo="openSUSE_Tumbleweed" + ;; + (*) + echo "ci_suite not specified, please choose one from 'leap' or 'tumbleweed'" + exit 1 + ;; + esac + + # add required repos + if [ "${ci_host%%-*}" = x86_64 ]; then + bits="64" + else + bits="32" + fi + ( + p=$(zypper lr | grep "windows_mingw_win${bits}" || true) + if [ -z "$p" ]; then + $zypper ar --refresh --no-gpgcheck \ + "https://download.opensuse.org/repositories/windows:/mingw:/win${bits}/$repo/windows:mingw:win${bits}.repo" + fi + ) + packages=( + "${packages[@]}" + mingw${bits}-cross-gcc-c++ + mingw${bits}-libexpat-devel + mingw${bits}-glib2-devel + ) + ;; + + (*) + packages=( + "${packages[@]}" + gcc-c++ + libexpat-devel + glib2-devel + libX11-devel + systemd-devel + ) + ;; + esac + $zypper install "${packages[@]}" + + if [ "$ci_in_docker" = yes ]; then + # Add the user that we will use to do the build inside the + # Docker container, and let them use sudo + useradd -m user + passwd -ud user + echo "user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/nopasswd + chmod 0440 /etc/sudoers.d/nopasswd + fi + ;; +esac + +# +# manual package setup +# +case "$ci_distro" in + (debian|ubuntu) # Make sure we have a messagebus user, even if the dbus package # isn't installed @@ -183,6 +294,11 @@ case "$ci_distro" in --disabled-password --group messagebus ;; + (opensuse) + # test-bus depends on group 'bin' + $sudo getent group bin >/dev/null || /usr/sbin/groupadd -r bin + ;; + (*) echo "Don't know how to set up ${ci_distro}" >&2 exit 1