From f40afc89832d1faf19beb4d394956208a98462cc Mon Sep 17 00:00:00 2001 From: Mike Gelfand Date: Wed, 25 Jun 2025 02:32:00 +0100 Subject: [PATCH] .github: .gitlab-ci: add macos (xquartz) build job Signed-off-by: Mike Gelfand --- .github/scripts/conf.sh | 7 +++- .github/scripts/install-prereq.sh | 7 ++++ .github/scripts/macos/install-pkg.sh | 38 ++++++++++++++++++ .github/scripts/util.sh | 13 ++++++- .github/workflows/build-xserver.yml | 58 ++++++++++++++++++++++++++++ .gitlab-ci/check-ddx-build.sh | 1 + 6 files changed, 121 insertions(+), 3 deletions(-) create mode 100755 .github/scripts/macos/install-pkg.sh diff --git a/.github/scripts/conf.sh b/.github/scripts/conf.sh index 7a0576b7f..7cdab25d2 100644 --- a/.github/scripts/conf.sh +++ b/.github/scripts/conf.sh @@ -1,8 +1,13 @@ +export X11_OS=`uname -s` + export X11_PREFIX="${X11_PREFIX:-$HOME/x11}" export X11_BUILD_DIR="${X11_BUILD_DIR:-$HOME/build-deps}" export DRV_BUILD_DIR="${DRV_BUILD_DIR:-$HOME/build-drivers}" -export FDO_CI_CONCURRENT=`nproc` +case "$X11_OS" in +Darwin) export FDO_CI_CONCURRENT=`sysctl -n hw.logicalcpu` ;; +Linux) export FDO_CI_CONCURRENT=`nproc` ;; +esac export PATH="$X11_PREFIX/bin:$PATH" export PKG_CONFIG_PATH="$X11_PREFIX/lib/x86_64-linux-gnu/pkgconfig:$X11_PREFIX/lib/pkgconfig:$X11_PREFIX/share/pkgconfig:$PKG_CONFIG_PATH" diff --git a/.github/scripts/install-prereq.sh b/.github/scripts/install-prereq.sh index e201126a1..2bdbeb65a 100755 --- a/.github/scripts/install-prereq.sh +++ b/.github/scripts/install-prereq.sh @@ -8,10 +8,13 @@ mkdir -p $X11_BUILD_DIR cd $X11_BUILD_DIR build_meson rendercheck https://gitlab.freedesktop.org/xorg/test/rendercheck rendercheck-1.6 +if [ "$X11_OS" = "Linux" ]; then build_meson drm https://gitlab.freedesktop.org/mesa/drm libdrm-2.4.121 \ -Domap=enabled +fi build_meson libxcvt https://gitlab.freedesktop.org/xorg/lib/libxcvt libxcvt-0.1.0 build_ac xorgproto https://gitlab.freedesktop.org/xorg/proto/xorgproto xorgproto-2024.1 +if [ "$X11_OS" = "Linux" ]; then build_meson wayland https://gitlab.freedesktop.org/wayland/wayland 1.21.0 \ -Dtests=false -Ddocumentation=false -Ddtd_validation=false build_meson wayland-protocols https://gitlab.freedesktop.org/wayland/wayland-protocols 1.38 @@ -19,6 +22,10 @@ build_meson libdecor https://gitlab.freedesktop.org/libdecor/libdecor -D{demo,install_demo}=false build_meson libei https://gitlab.freedesktop.org/libinput/libei 1.0.0 \ -Dtests=disabled -Ddocumentation=[] -Dliboeffis=enabled +fi +if [ "$X11_OS" = "Darwin" ]; then +build_ac xset https://gitlab.freedesktop.org/xorg/app/xset xset-1.2.5 +fi build_ac_xts xts https://gitlab.freedesktop.org/xorg/test/xts master # dbbfa96c036e596346147081cbceda136e7c86c1 clone_source piglit https://gitlab.freedesktop.org/mesa/piglit main # 265896c86f90cb72e8f218ba6a3617fca8b9a1e3 diff --git a/.github/scripts/macos/install-pkg.sh b/.github/scripts/macos/install-pkg.sh new file mode 100755 index 000000000..56d2ef236 --- /dev/null +++ b/.github/scripts/macos/install-pkg.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +set -e + +brew update + +brew install \ + autoconf \ + automake \ + bdftopcf \ + libapplewm \ + libtool \ + libx11 \ + libxau \ + libxaw \ + libxcb \ + libxdmcp \ + libxext \ + libxfixes \ + libxfont2 \ + libxkbfile \ + libxi \ + libxmu \ + libxrender \ + libxt \ + libxtst \ + meson \ + mkfontscale \ + pkgconf \ + pixman \ + util-macros \ + xdpyinfo \ + xkbcomp \ + xkeyboard-config \ + xtrans + +pip3 install --break-system-packages \ + mako diff --git a/.github/scripts/util.sh b/.github/scripts/util.sh index 43bccfd24..29e87ff3d 100644 --- a/.github/scripts/util.sh +++ b/.github/scripts/util.sh @@ -82,8 +82,17 @@ build_ac_xts() { clone_source "$pkgname" "$url" "$ref" ( cd $pkgname - CFLAGS=-fcommon ./autogen.sh --prefix=$X11_PREFIX - xvfb-run make -j${FDO_CI_CONCURRENT:-4} install + CFLAGS='-fcommon' + if [ "$X11_OS" = "Darwin" ]; then + sed -E -i~ 's|(\[XTS\], \[)|\1xt xmu xaw7 |' configure.ac + sed -E -i~ -e 's|(XTextProperty)[[:space:]]+(text_prop_good)|\1 *\2|' -e 's|(style_good),[[:space:]]*&(text_prop_good)|\1,\2|' -e 's|text_prop_good\.|text_prop_good->|' xts5/Xlib14/X{mb,wc}TextListToTextProperty.m + CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0" + if cc -Werror=unknown-warning-option -Wincompatible-function-pointer-types -c -xc -o /dev/null /dev/null 2>/dev/null; then + CFLAGS="$CFLAGS -Wno-error=incompatible-function-pointer-types" + fi + fi + ./autogen.sh --prefix=$X11_PREFIX CFLAGS="$CFLAGS" + make -j${FDO_CI_CONCURRENT:-4} install ) touch $X11_PREFIX/$pkgname.DONE fi diff --git a/.github/workflows/build-xserver.yml b/.github/workflows/build-xserver.yml index 2a83db818..417db1bfd 100644 --- a/.github/workflows/build-xserver.yml +++ b/.github/workflows/build-xserver.yml @@ -119,3 +119,61 @@ jobs: - name: compile drivers run: .github/scripts/compile-drivers.sh + + xserver-build-macos: + env: + MESON_ARGS: -Dprefix=/tmp -Dglx=false -Dxnest=false + X11_PREFIX: /Users/runner/x11 + X11_BUILD_DIR: /Users/runner/build-deps + runs-on: macos-latest + steps: + - name: Check out repository code + uses: actions/checkout@v4 + + - name: prepare build environment + run: | + echo "PKG_CONFIG_PATH=$X11_PREFIX/share/pkgconfig:$X11_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH" >> "$GITHUB_ENV" + + - name: homebrew cache + uses: actions/cache@v4 + with: + path: /Users/runner/Library/Caches/Homebrew + key: ${{ runner.os }}-homebrew-cache-${{ hashFiles('.github/scripts/macos/install-pkg.sh') }} + restore-keys: ${{ runner.os }}-homebrew-cache- + + - name: pkg install + run: .github/scripts/macos/install-pkg.sh + + - name: X11 prereq cache + uses: actions/cache@v4 + with: + path: | + ${{ env.X11_PREFIX }} + ${{ env.X11_BUILD_DIR }}/xts + ${{ env.X11_BUILD_DIR }}/piglit + key: ${{ runner.os }}-x11-deps-${{ hashFiles('.github/scripts/install-prereq.sh') }} + restore-keys: ${{ runner.os }}-x11-deps- + + - name: generic prereq + run: .github/scripts/install-prereq.sh + + - name: build + run: .gitlab-ci/meson-build.sh + + - name: tests (may fail) + continue-on-error: true + run: meson test -C "${{ env.MESON_BUILDDIR }}" --print-errorlogs -j1 || true + env: + XTEST_DIR: ${{ env.X11_BUILD_DIR }}/xts + PIGLIT_DIR: ${{ env.X11_BUILD_DIR }}/piglit + + - name: archive build logs + uses: actions/upload-artifact@v4 + with: + name: build-logs-macos + path: | + build/meson-logs/* + - name: ddx build check + run: .gitlab-ci/check-ddx-build.sh + - name: manpage check + run: .gitlab-ci/manpages-check diff --git a/.gitlab-ci/check-ddx-build.sh b/.gitlab-ci/check-ddx-build.sh index 3b3a65f38..6361571ff 100755 --- a/.gitlab-ci/check-ddx-build.sh +++ b/.gitlab-ci/check-ddx-build.sh @@ -19,6 +19,7 @@ fi [[ "$BUILD_XEPHYR" == true ]] && check_executable "hw/kdrive/ephyr/Xephyr" [[ "$BUILD_XNEST" == true ]] && check_executable "hw/xnest/Xnest" [[ "$BUILD_XORG" == true ]] && check_executable "hw/xfree86/Xorg" +[[ "$BUILD_XQUARTZ" == true ]] && check_executable "hw/xquartz/mach-startup/Xquartz" [[ "$BUILD_XVFB" == true ]] && check_executable "hw/vfb/Xvfb" exit 0