diff --git a/.github/workflows/build-check.yml b/.github/workflows/build-check.yml index 1a4143ca472..d81032b651b 100644 --- a/.github/workflows/build-check.yml +++ b/.github/workflows/build-check.yml @@ -115,6 +115,112 @@ jobs: ~/mesa-for-android-container/sha256sums.txt retention-days: 90 + debian-testing: + runs-on: ubuntu-26.04-arm + container: + image: debian:testing + options: --privileged --user root + + steps: + - name: Install dependencies + run: | + sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/debian.sources + apt update + apt build-dep -y mesa + apt install -y git ccache libxfixes-dev libarchive-dev + + - name: Cache ccache + uses: actions/cache@v5 + with: + path: /root/.ccache + key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ github.run_attempt }} + restore-keys: | + ccache-${{ runner.os }}-${{ runner.arch }}- + + - name: Configure ccache + run: | + export CCACHE_DIR=/root/.ccache + ccache --max-size=2G + ccache --show-config + ccache --zero-stats + ccache --show-stats + + - name: Clone repository + run: | + cd ~ + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + git clone -b ${{ github.event.pull_request.head.ref }} --depth 1 ${{ github.event.pull_request.head.repo.html_url }}.git mesa-for-android-container + + - name: Set release name suffix + shell: bash + run: | + cd ~/mesa-for-android-container + version=$(grep -v '^[[:space:]]*$' VERSION | head -n1) + short_hash=$(git rev-parse --short HEAD) + echo "MESA_RELEASE_NAME_SUFFIX=${version}-${short_hash}_debian_testing_arm64" >> "$GITHUB_ENV" + + - name: Build Mesa + shell: bash + run: | + export CCACHE_DIR=/root/.ccache + echo "Building Mesa..." + cd ~/mesa-for-android-container + meson setup build/ \ + --prefix=/usr \ + -Dplatforms=x11,wayland \ + -Dgallium-drivers=freedreno,zink,virgl,llvmpipe \ + -Dgallium-va=enabled \ + -Dtermux-va-bridge=enabled \ + -Dtermux-va-wayland-shim=enabled \ + -Dvideo-codecs=all \ + -Dgallium-mediafoundation=disabled \ + -Dvulkan-drivers=freedreno \ + -Dvulkan-layers= \ + -Degl=enabled \ + -Dgles2=enabled \ + -Dglvnd=enabled \ + -Dglx=dri \ + -Dlibunwind=disabled \ + -Dintel-rt=disabled \ + -Dmicrosoft-clc=disabled \ + -Dvalgrind=disabled \ + -Dgles1=disabled \ + -Dfreedreno-kmds=kgsl \ + -Dbuildtype=release + ninja -C build/ + echo "Mesa build completed successfully!" + + - name: Save ccache + uses: actions/cache/save@v5 + if: always() + with: + path: /root/.ccache + key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ github.run_attempt }} + + - name: Package Mesa + shell: bash + run: | + echo "Packaging Mesa..." + cd ~/mesa-for-android-container + mkdir /tmp/mesa-install-tmp + DESTDIR=/tmp/mesa-install-tmp meson install -C build/ + tar -zcvf mesa_${MESA_RELEASE_NAME_SUFFIX}.tar.gz -C /tmp/mesa-install-tmp . + rm -rf /tmp/mesa-install-tmp + echo "Calculating sha256 checksums..." + find . -maxdepth 1 \( -name "*.tar.gz" \) -type f -printf "%P\0" | xargs -0 sha256sum | sort -k2 > sha256sums.txt + cat sha256sums.txt && echo + echo "Packaging completed successfully!" + + - name: Upload build artifacts + uses: actions/upload-artifact@v7 + with: + name: mesa_${{ env.MESA_RELEASE_NAME_SUFFIX }} + path: | + ~/mesa-for-android-container/*.tar.gz + ~/mesa-for-android-container/sha256sums.txt + retention-days: 90 + ubuntu-noble: runs-on: ubuntu-24.04-arm @@ -435,6 +541,116 @@ jobs: ~/mesa-for-android-container/sha256sums.txt retention-days: 90 + ubuntu-rolling: + runs-on: ubuntu-26.04-arm + container: + image: ubuntu:rolling + options: --privileged --user root + + steps: + - name: Install dependencies + run: | + sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources + apt update + apt build-dep -y mesa + apt install -y git ccache libxfixes-dev libarchive-dev + + - name: Cache ccache + uses: actions/cache@v5 + with: + path: /root/.ccache + key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ github.run_attempt }} + restore-keys: | + ccache-${{ runner.os }}-${{ runner.arch }}- + + - name: Configure ccache + run: | + export CCACHE_DIR=/root/.ccache + ccache --max-size=2G + ccache --show-config + ccache --zero-stats + ccache --show-stats + + - name: Clone repository + run: | + cd ~ + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + git clone -b ${{ github.event.pull_request.head.ref }} --depth 1 ${{ github.event.pull_request.head.repo.html_url }}.git mesa-for-android-container + + - name: Set release name suffix + shell: bash + run: | + cd ~/mesa-for-android-container + version=$(grep -v '^[[:space:]]*$' VERSION | head -n1) + short_hash=$(git rev-parse --short HEAD) + echo "MESA_RELEASE_NAME_SUFFIX=${version}-${short_hash}_ubuntu_rolling_arm64" >> "$GITHUB_ENV" + + - name: Build Mesa + shell: bash + run: | + export CCACHE_DIR=/root/.ccache + LLVM_CONFIG="$(find /usr/lib -maxdepth 3 -path '/usr/lib/llvm-*/bin/llvm-config' -type f | sort -V | tail -n 1)" + test -n "$LLVM_CONFIG" && test -x "$LLVM_CONFIG" + export LLVM_CONFIG + echo "Using LLVM_CONFIG=$LLVM_CONFIG" + echo "Building Mesa..." + cd ~/mesa-for-android-container + meson setup build/ \ + --prefix=/usr \ + -Dplatforms=x11,wayland \ + -Dgallium-drivers=freedreno,zink,virgl,llvmpipe \ + -Dgallium-va=enabled \ + -Dtermux-va-bridge=enabled \ + -Dtermux-va-wayland-shim=enabled \ + -Dvideo-codecs=all \ + -Dgallium-mediafoundation=disabled \ + -Dvulkan-drivers=freedreno \ + -Dvulkan-layers= \ + -Degl=enabled \ + -Dgles2=enabled \ + -Dglvnd=enabled \ + -Dglx=dri \ + -Dlibunwind=disabled \ + -Dintel-rt=disabled \ + -Dmicrosoft-clc=disabled \ + -Dvalgrind=disabled \ + -Dgles1=disabled \ + -Dfreedreno-kmds=kgsl \ + -Dbuildtype=release + ninja -C build/ + echo "Mesa build completed successfully!" + + - name: Save ccache + uses: actions/cache/save@v5 + if: always() + with: + path: /root/.ccache + key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ github.run_attempt }} + + - name: Package Mesa + shell: bash + run: | + echo "Packaging Mesa..." + cd ~/mesa-for-android-container + mkdir /tmp/mesa-install-tmp + DESTDIR=/tmp/mesa-install-tmp meson install -C build/ + tar -zcvf mesa_${MESA_RELEASE_NAME_SUFFIX}.tar.gz -C /tmp/mesa-install-tmp . + rm -rf /tmp/mesa-install-tmp + echo "Calculating sha256 checksums..." + find . -maxdepth 1 \( -name "*.tar.gz" \) -type f -printf "%P\0" | xargs -0 sha256sum | sort -k2 > sha256sums.txt + cat sha256sums.txt && echo + echo "Packaging completed successfully!" + + - name: Upload build artifacts + uses: actions/upload-artifact@v7 + with: + name: mesa_${{ env.MESA_RELEASE_NAME_SUFFIX }} + path: | + ~/mesa-for-android-container/*.tar.gz + ~/mesa-for-android-container/sha256sums.txt + retention-days: 90 + archlinux: runs-on: ubuntu-24.04-arm container: @@ -771,41 +987,28 @@ jobs: ~/mesa-for-android-container/sha256sums.txt retention-days: 90 - void-linux: - runs-on: ubuntu-24.04-arm + fedora-45: + runs-on: ubuntu-26.04-arm container: - image: ghcr.io/void-linux/void-glibc-full:latest + image: fedora:45 options: --privileged --user root steps: - name: Install dependencies run: | - xbps-install -Syu - xbps-install -y bash base-devel git ccache meson ninja pkg-config python3 \ - flex bison \ - libdrm-devel \ - libX11-devel libxcb-devel libXext-devel libXfixes-devel libXrandr-devel \ - libXxf86vm-devel libxshmfence-devel \ - wayland-devel wayland-protocols \ - libglvnd-devel \ - zlib-devel expat-devel \ - elfutils-devel \ - llvm18-devel clang18 \ - libxml2-devel \ - libarchive-devel \ - python3-Mako python3-packaging python3-yaml python3-ply \ - libffi-devel \ - libzstd-devel \ - libva-devel \ - glslang + echo "assumeyes=True" >> /etc/dnf/dnf.conf + dnf install -y dnf-plugins-core git ccache libarchive-devel + dnf config-manager setopt fedora-source.enabled=1 updates-source.enabled=1 + dnf makecache + dnf builddep -y mesa - name: Cache ccache uses: actions/cache@v5 with: path: /root/.ccache - key: ccache-${{ runner.os }}-${{ runner.arch }}-void-${{ github.run_id }}-${{ github.run_attempt }} + key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ github.run_attempt }} restore-keys: | - ccache-${{ runner.os }}-${{ runner.arch }}-void- + ccache-${{ runner.os }}-${{ runner.arch }}- - name: Configure ccache run: | @@ -828,7 +1031,7 @@ jobs: cd ~/mesa-for-android-container version=$(grep -v '^[[:space:]]*$' VERSION | head -n1) short_hash=$(git rev-parse --short HEAD) - echo "MESA_RELEASE_NAME_SUFFIX=${version}-${short_hash}_void_arm64" >> "$GITHUB_ENV" + echo "MESA_RELEASE_NAME_SUFFIX=${version}-${short_hash}_fedora_45_arm64" >> "$GITHUB_ENV" - name: Build Mesa shell: bash @@ -866,7 +1069,7 @@ jobs: if: always() with: path: /root/.ccache - key: ccache-${{ runner.os }}-${{ runner.arch }}-void-${{ github.run_id }}-${{ github.run_attempt }} + key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ github.run_attempt }} - name: Package Mesa shell: bash @@ -891,21 +1094,141 @@ jobs: ~/mesa-for-android-container/sha256sums.txt retention-days: 90 - alpine-324: + void-linux: runs-on: ubuntu-24.04-arm + container: + image: ghcr.io/void-linux/void-glibc-full:latest + options: --privileged --user root steps: - - name: Cache ccache - uses: actions/cache@v5 - with: - path: ~/.ccache - key: ccache-${{ runner.os }}-${{ runner.arch }}-alpine-${{ github.run_id }}-${{ github.run_attempt }} - restore-keys: | - ccache-${{ runner.os }}-${{ runner.arch }}-alpine- - - - name: Clone repository + - name: Install dependencies run: | - cd ~ + xbps-install -Syu + xbps-install -y bash base-devel git ccache meson ninja pkg-config python3 \ + flex bison \ + libdrm-devel \ + libX11-devel libxcb-devel libXext-devel libXfixes-devel libXrandr-devel \ + libXxf86vm-devel libxshmfence-devel \ + wayland-devel wayland-protocols \ + libglvnd-devel \ + zlib-devel expat-devel \ + elfutils-devel \ + llvm18-devel clang18 \ + libxml2-devel \ + libarchive-devel \ + python3-Mako python3-packaging python3-yaml python3-ply \ + libffi-devel \ + libzstd-devel \ + libva-devel \ + glslang + + - name: Cache ccache + uses: actions/cache@v5 + with: + path: /root/.ccache + key: ccache-${{ runner.os }}-${{ runner.arch }}-void-${{ github.run_id }}-${{ github.run_attempt }} + restore-keys: | + ccache-${{ runner.os }}-${{ runner.arch }}-void- + + - name: Configure ccache + run: | + export CCACHE_DIR=/root/.ccache + ccache --max-size=2G + ccache --show-config + ccache --zero-stats + ccache --show-stats + + - name: Clone repository + run: | + cd ~ + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + git clone -b ${{ github.event.pull_request.head.ref }} --depth 1 ${{ github.event.pull_request.head.repo.html_url }}.git mesa-for-android-container + + - name: Set release name suffix + shell: bash + run: | + cd ~/mesa-for-android-container + version=$(grep -v '^[[:space:]]*$' VERSION | head -n1) + short_hash=$(git rev-parse --short HEAD) + echo "MESA_RELEASE_NAME_SUFFIX=${version}-${short_hash}_void_arm64" >> "$GITHUB_ENV" + + - name: Build Mesa + shell: bash + run: | + export CCACHE_DIR=/root/.ccache + echo "Building Mesa..." + cd ~/mesa-for-android-container + meson setup build/ \ + --prefix=/usr \ + -Dplatforms=x11,wayland \ + -Dgallium-drivers=freedreno,zink,virgl,llvmpipe \ + -Dgallium-va=enabled \ + -Dtermux-va-bridge=enabled \ + -Dtermux-va-wayland-shim=enabled \ + -Dvideo-codecs=all \ + -Dgallium-mediafoundation=disabled \ + -Dvulkan-drivers=freedreno \ + -Dvulkan-layers= \ + -Degl=enabled \ + -Dgles2=enabled \ + -Dglvnd=enabled \ + -Dglx=dri \ + -Dlibunwind=disabled \ + -Dintel-rt=disabled \ + -Dmicrosoft-clc=disabled \ + -Dvalgrind=disabled \ + -Dgles1=disabled \ + -Dfreedreno-kmds=kgsl \ + -Dbuildtype=release + ninja -C build/ + echo "Mesa build completed successfully!" + + - name: Save ccache + uses: actions/cache/save@v5 + if: always() + with: + path: /root/.ccache + key: ccache-${{ runner.os }}-${{ runner.arch }}-void-${{ github.run_id }}-${{ github.run_attempt }} + + - name: Package Mesa + shell: bash + run: | + echo "Packaging Mesa..." + cd ~/mesa-for-android-container + mkdir /tmp/mesa-install-tmp + DESTDIR=/tmp/mesa-install-tmp meson install -C build/ + tar -zcvf mesa_${MESA_RELEASE_NAME_SUFFIX}.tar.gz -C /tmp/mesa-install-tmp . + rm -rf /tmp/mesa-install-tmp + echo "Calculating sha256 checksums..." + find . -maxdepth 1 \( -name "*.tar.gz" \) -type f -printf "%P\0" | xargs -0 sha256sum | sort -k2 > sha256sums.txt + cat sha256sums.txt && echo + echo "Packaging completed successfully!" + + - name: Upload build artifacts + uses: actions/upload-artifact@v7 + with: + name: mesa_${{ env.MESA_RELEASE_NAME_SUFFIX }} + path: | + ~/mesa-for-android-container/*.tar.gz + ~/mesa-for-android-container/sha256sums.txt + retention-days: 90 + + alpine-324: + runs-on: ubuntu-24.04-arm + + steps: + - name: Cache ccache + uses: actions/cache@v5 + with: + path: ~/.ccache + key: ccache-${{ runner.os }}-${{ runner.arch }}-alpine-${{ github.run_id }}-${{ github.run_attempt }} + restore-keys: | + ccache-${{ runner.os }}-${{ runner.arch }}-alpine- + + - name: Clone repository + run: | + cd ~ git config --global user.email "actions@github.com" git config --global user.name "GitHub Actions" git clone -b ${{ github.event.pull_request.head.ref }} --depth 1 ${{ github.event.pull_request.head.repo.html_url }}.git mesa-for-android-container @@ -993,3 +1316,549 @@ jobs: ~/mesa-for-android-container/*.tar.gz ~/mesa-for-android-container/sha256sums.txt retention-days: 90 + + opensuse-tumbleweed: + runs-on: ubuntu-26.04-arm + container: + image: opensuse/tumbleweed:latest + options: --privileged --user root + + steps: + - name: Install dependencies + run: | + zypper modifyrepo -e repo-source + zypper --non-interactive refresh + zypper --non-interactive install --auto-agree-with-licenses gcc gcc-c++ git ccache llvm-devel libarchive-devel python3 tar gzip findutils + PYTHON_VERSION=$(python3 -c 'import sys; print(f"{sys.version_info.major}{sys.version_info.minor}")') + zypper --non-interactive install "python${PYTHON_VERSION}-packaging" + zypper --non-interactive source-install --build-deps-only Mesa + + - name: Cache ccache + uses: actions/cache@v5 + with: + path: /root/.ccache + key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ github.run_attempt }} + restore-keys: | + ccache-${{ runner.os }}-${{ runner.arch }}- + + - name: Configure ccache + run: | + export CCACHE_DIR=/root/.ccache + ccache --max-size=2G + ccache --show-config + ccache --zero-stats + ccache --show-stats + + - name: Clone repository + run: | + cd ~ + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + git clone -b ${{ github.event.pull_request.head.ref }} --depth 1 ${{ github.event.pull_request.head.repo.html_url }}.git mesa-for-android-container + + - name: Set release name suffix + shell: bash + run: | + cd ~/mesa-for-android-container + version=$(grep -v '^[[:space:]]*$' VERSION | head -n1) + short_hash=$(git rev-parse --short HEAD) + echo "MESA_RELEASE_NAME_SUFFIX=${version}-${short_hash}_opensuse_tumbleweed_arm64" >> "$GITHUB_ENV" + + - name: Build Mesa + shell: bash + run: | + export CCACHE_DIR=/root/.ccache + echo "Building Mesa..." + cd ~/mesa-for-android-container + meson setup build/ \ + --prefix=/usr \ + --libdir=lib64 \ + -Dplatforms=x11,wayland \ + -Dgallium-drivers=freedreno,zink,virgl,llvmpipe \ + -Dgallium-va=enabled \ + -Dtermux-va-bridge=enabled \ + -Dtermux-va-wayland-shim=enabled \ + -Dvideo-codecs=all \ + -Dgallium-mediafoundation=disabled \ + -Dvulkan-drivers=freedreno \ + -Dvulkan-layers= \ + -Degl=enabled \ + -Dgles2=enabled \ + -Dglvnd=enabled \ + -Dglx=dri \ + -Dlibunwind=disabled \ + -Dintel-rt=disabled \ + -Dmicrosoft-clc=disabled \ + -Dvalgrind=disabled \ + -Dgles1=disabled \ + -Dfreedreno-kmds=kgsl \ + -Dbuildtype=release + ninja -C build/ + echo "Mesa build completed successfully!" + + - name: Save ccache + uses: actions/cache/save@v5 + if: always() + with: + path: /root/.ccache + key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ github.run_attempt }} + + - name: Package Mesa + shell: bash + run: | + echo "Packaging Mesa..." + cd ~/mesa-for-android-container + mkdir /tmp/mesa-install-tmp + DESTDIR=/tmp/mesa-install-tmp meson install -C build/ + tar -zcvf mesa_${MESA_RELEASE_NAME_SUFFIX}.tar.gz -C /tmp/mesa-install-tmp . + rm -rf /tmp/mesa-install-tmp + echo "Calculating sha256 checksums..." + find . -maxdepth 1 \( -name "*.tar.gz" \) -type f -printf "%P\0" | xargs -0 sha256sum | sort -k2 > sha256sums.txt + cat sha256sums.txt && echo + echo "Packaging completed successfully!" + + - name: Upload build artifacts + uses: actions/upload-artifact@v7 + with: + name: mesa_${{ env.MESA_RELEASE_NAME_SUFFIX }} + path: | + ~/mesa-for-android-container/*.tar.gz + ~/mesa-for-android-container/sha256sums.txt + retention-days: 90 + + deepin-crimson: + runs-on: ubuntu-26.04-arm + container: + image: linuxdeepin/deepin:crimson-arm64 + options: --privileged --user root + + steps: + - name: Install dependencies + run: | + echo 'deb-src https://community-packages.deepin.com/deepin/beige/ crimson main commercial community' \ + > /etc/apt/sources.list.d/deepin-src.list + apt update + apt build-dep -y mesa + apt install -y git ccache libxfixes-dev libarchive-dev + + - name: Cache ccache + uses: actions/cache@v5 + with: + path: /root/.ccache + key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ github.run_attempt }} + restore-keys: | + ccache-${{ runner.os }}-${{ runner.arch }}- + + - name: Configure ccache + run: | + export CCACHE_DIR=/root/.ccache + ccache --max-size=2G + ccache --show-config + ccache --zero-stats + ccache --show-stats + + - name: Clone repository + run: | + cd ~ + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + git clone -b ${{ github.event.pull_request.head.ref }} --depth 1 ${{ github.event.pull_request.head.repo.html_url }}.git mesa-for-android-container + + - name: Set release name suffix + shell: bash + run: | + cd ~/mesa-for-android-container + version=$(grep -v '^[[:space:]]*$' VERSION | head -n1) + short_hash=$(git rev-parse --short HEAD) + echo "MESA_RELEASE_NAME_SUFFIX=${version}-${short_hash}_deepin_crimson_arm64" >> "$GITHUB_ENV" + + - name: Build Mesa + shell: bash + run: | + export CCACHE_DIR=/root/.ccache + echo "Building Mesa..." + cd ~/mesa-for-android-container + meson setup build/ \ + --prefix=/usr \ + -Dplatforms=x11,wayland \ + -Dgallium-drivers=freedreno,zink,virgl,llvmpipe \ + -Dgallium-va=enabled \ + -Dtermux-va-bridge=enabled \ + -Dtermux-va-wayland-shim=enabled \ + -Dvideo-codecs=all \ + -Dgallium-mediafoundation=disabled \ + -Dvulkan-drivers=freedreno \ + -Dvulkan-layers= \ + -Degl=enabled \ + -Dgles2=enabled \ + -Dglvnd=enabled \ + -Dglx=dri \ + -Dlibunwind=disabled \ + -Dintel-rt=disabled \ + -Dmicrosoft-clc=disabled \ + -Dvalgrind=disabled \ + -Dgles1=disabled \ + -Dfreedreno-kmds=kgsl \ + -Dbuildtype=release + ninja -C build/ + echo "Mesa build completed successfully!" + + - name: Save ccache + uses: actions/cache/save@v5 + if: always() + with: + path: /root/.ccache + key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ github.run_attempt }} + + - name: Package Mesa + shell: bash + run: | + echo "Packaging Mesa..." + cd ~/mesa-for-android-container + mkdir /tmp/mesa-install-tmp + DESTDIR=/tmp/mesa-install-tmp meson install -C build/ + tar -zcvf mesa_${MESA_RELEASE_NAME_SUFFIX}.tar.gz -C /tmp/mesa-install-tmp . + rm -rf /tmp/mesa-install-tmp + echo "Calculating sha256 checksums..." + find . -maxdepth 1 \( -name "*.tar.gz" \) -type f -printf "%P\0" | xargs -0 sha256sum | sort -k2 > sha256sums.txt + cat sha256sums.txt && echo + echo "Packaging completed successfully!" + + - name: Upload build artifacts + uses: actions/upload-artifact@v7 + with: + name: mesa_${{ env.MESA_RELEASE_NAME_SUFFIX }} + path: | + ~/mesa-for-android-container/*.tar.gz + ~/mesa-for-android-container/sha256sums.txt + retention-days: 90 + + aosc: + runs-on: ubuntu-26.04-arm + container: + image: aosc/aosc-os:buildkit + options: --privileged --user root + + steps: + - name: Install dependencies + run: | + export DEBIAN_FRONTEND=noninteractive CI=true + sudo oma refresh + sudo oma upgrade -y + sudo oma install -y x11-lib libdrm expat systemd elfutils nettle libva wayland lm-sensors libglvnd llvm-runtime libcl libclc spirv-llvm-translator libdisplay-info xcb-util-keysyms libconfig x11-proto mako valgrind llvm libunwind glslang spirv-tools ply rustc rust-bindgen pycparser cbindgen pyyaml directx-headers ccache + + - name: Cache ccache + uses: actions/cache@v5 + with: + path: /root/.ccache + key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ github.run_attempt }} + restore-keys: | + ccache-${{ runner.os }}-${{ runner.arch }}- + + - name: Configure ccache + run: | + export CCACHE_DIR=/root/.ccache + ccache --max-size=2G + ccache --show-config + ccache --zero-stats + ccache --show-stats + + - name: Clone repository + run: | + cd ~ + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + git clone -b ${{ github.event.pull_request.head.ref }} --depth 1 ${{ github.event.pull_request.head.repo.html_url }}.git mesa-for-android-container + + - name: Set release name suffix + shell: bash + run: | + cd ~/mesa-for-android-container + version=$(grep -v '^[[:space:]]*$' VERSION | head -n1) + short_hash=$(git rev-parse --short HEAD) + echo "MESA_RELEASE_NAME_SUFFIX=${version}-${short_hash}_aosc_arm64" >> "$GITHUB_ENV" + + - name: Build Mesa + shell: bash + run: | + export CCACHE_DIR=/root/.ccache + echo "Building Mesa..." + cd ~/mesa-for-android-container + meson setup build/ \ + --prefix=/usr \ + -Dplatforms=x11,wayland \ + -Dgallium-drivers=freedreno,zink,virgl,llvmpipe \ + -Dgallium-va=enabled \ + -Dtermux-va-bridge=enabled \ + -Dtermux-va-wayland-shim=enabled \ + -Dvideo-codecs=all \ + -Dgallium-mediafoundation=disabled \ + -Dvulkan-drivers=freedreno \ + -Dvulkan-layers= \ + -Degl=enabled \ + -Dgles2=enabled \ + -Dglvnd=enabled \ + -Dglx=dri \ + -Dlibunwind=disabled \ + -Dintel-rt=disabled \ + -Dmicrosoft-clc=disabled \ + -Dvalgrind=disabled \ + -Dgles1=disabled \ + -Dfreedreno-kmds=kgsl \ + -Dbuildtype=release + ninja -C build/ + echo "Mesa build completed successfully!" + + - name: Save ccache + uses: actions/cache/save@v5 + if: always() + with: + path: /root/.ccache + key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ github.run_attempt }} + + - name: Package Mesa + shell: bash + run: | + echo "Packaging Mesa..." + cd ~/mesa-for-android-container + mkdir /tmp/mesa-install-tmp + DESTDIR=/tmp/mesa-install-tmp meson install -C build/ + tar -zcvf mesa_${MESA_RELEASE_NAME_SUFFIX}.tar.gz -C /tmp/mesa-install-tmp . + rm -rf /tmp/mesa-install-tmp + echo "Calculating sha256 checksums..." + find . -maxdepth 1 \( -name "*.tar.gz" \) -type f -printf "%P\0" | xargs -0 sha256sum | sort -k2 > sha256sums.txt + cat sha256sums.txt && echo + echo "Packaging completed successfully!" + + - name: Upload build artifacts + uses: actions/upload-artifact@v7 + with: + name: mesa_${{ env.MESA_RELEASE_NAME_SUFFIX }} + path: | + ~/mesa-for-android-container/*.tar.gz + ~/mesa-for-android-container/sha256sums.txt + retention-days: 90 + + nixos: + runs-on: ubuntu-26.04-arm + + steps: + - name: Clone repositories + run: | + cd ~ + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + git clone -b ${{ github.event.pull_request.head.ref }} --depth 1 ${{ github.event.pull_request.head.repo.html_url }}.git mesa-for-android-container + git clone --branch nixos-26.05 --depth 1 https://github.com/NixOS/nixpkgs.git nixpkgs + + - name: Set release name suffix + shell: bash + run: | + cd ~/mesa-for-android-container + version=$(grep -v '^[[:space:]]*$' VERSION | head -n1) + short_hash=$(git rev-parse --short HEAD) + echo "MESA_RELEASE_NAME_SUFFIX=${version}-${short_hash}_nixos_arm64" >> "$GITHUB_ENV" + + - name: Configure nixpkgs Mesa + shell: bash + run: | + export MESA_VERSION="${MESA_RELEASE_NAME_SUFFIX%_nixos_arm64}" + python3 <<'PY' + import os + from pathlib import Path + import re + + mesa = Path.home() / "nixpkgs/pkgs/development/libraries/mesa" + + def replace(text, pattern, replacement): + text, count = re.subn(pattern, lambda _: replacement, text, count=1, flags=re.S) + if count != 1: + raise RuntimeError(f"Mesa recipe no longer matches: {pattern}") + return text + + common = mesa / "common.nix" + text = common.read_text() + text = replace(text, r' version = ".*?";', f' version = "{os.environ["MESA_VERSION"]}";') + # Use the checkout mounted in the build container, without a fixed-output hash. + text = replace(text, r' src = fetchFromGitLab \{.*?\n \};', + ' src = lib.cleanSource /mesa-for-android-container;') + common.write_text(text) + + recipe = mesa / "default.nix" + text = recipe.read_text() + text = replace(text, r' patches = \[.*?\n \];', ' patches = [];') + # The separate nixpkgs header package tracks a different Mesa release. + text = replace(text, r" postPatch = ''.*?\n '';", " postPatch = ''patchShebangs .'';") + text = replace(text, r' outputs = \[.*?\n \];', ' outputs = [ "out" ];') + text = replace(text, r' mesonFlags = \[', ' mesonBuildType = "release";\n\n mesonFlags = [') + flags = [ + "-Dplatforms=x11,wayland", + "-Dgallium-drivers=freedreno,zink,virgl,llvmpipe", + "-Dgallium-va=enabled", + "-Dtermux-va-bridge=enabled", + "-Dtermux-va-wayland-shim=enabled", + "-Dvideo-codecs=all", + "-Dgallium-mediafoundation=disabled", + "-Dandroid-libbacktrace=disabled", + "-Dvulkan-drivers=freedreno", + "-Dvulkan-layers=", + "-Degl=enabled", + "-Dgles2=enabled", + "-Dglvnd=enabled", + "-Dglx=dri", + "-Dlibunwind=disabled", + "-Dintel-rt=disabled", + "-Dmicrosoft-clc=disabled", + "-Dvalgrind=disabled", + "-Dgles1=disabled", + "-Dfreedreno-kmds=kgsl", + "-Dlibgbm-external=false", + "-Dgallium-rusticl=false", + "-Dteflon=false", + ] + text = replace(text, r' mesonFlags = \[.*?\n \];', + ' mesonFlags = [\n' + ''.join(f' "{flag}"\n' for flag in flags) + ' ];') + text = replace(text, r" postInstall = ''.*?\n '';", " postInstall = '''';") + # Keep Nix store paths in manifests and let Zink find the Vulkan loader. + text = replace(text, r" postFixup = ''.*?\n '';", """ postFixup = '' + for js in $out/share/glvnd/egl_vendor.d/*.json; do + substituteInPlace "$js" --replace-fail '"libEGL_' '"'"$out/lib/libEGL_" + done + patchelf --add-rpath ${vulkan-loader}/lib $out/lib/libgallium*.so + '';""") + recipe.write_text(text) + PY + + - name: Build and export Mesa Nix closure + shell: bash + run: | + mkdir -p ~/mesa-nixos-artifacts + docker run --privileged --rm \ + -v "$HOME/mesa-for-android-container:/mesa-for-android-container:ro" \ + -v "$HOME/nixpkgs:/nixpkgs:ro" \ + -v "$HOME/mesa-nixos-artifacts:/artifacts" \ + -e MESA_RELEASE_NAME_SUFFIX \ + nixos/nix:latest \ + bash -euo pipefail -c ' + nix-build /nixpkgs -A mesa --out-link /artifacts/result + result_path=$(readlink -f /artifacts/result) + echo "$result_path" > /artifacts/result-path.txt + nix-store --query --requisites "$result_path" > /artifacts/closure-paths.txt + mapfile -t closure_paths < /artifacts/closure-paths.txt + nix-store --export "${closure_paths[@]}" | gzip > "/artifacts/mesa_${MESA_RELEASE_NAME_SUFFIX}.nar.gz" + ' + sudo chown -R "$(id -u):$(id -g)" ~/mesa-nixos-artifacts + cat > ~/mesa-nixos-artifacts/install.sh <<'EOF' + #!/usr/bin/env bash + set -euo pipefail + + artifact_dir=$(CDPATH='' cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) + nar_path=$(find "$artifact_dir" -maxdepth 1 -name 'mesa_*.nar.gz' -type f -print -quit) + test -n "$nar_path" + + gzip -dc "$nar_path" | nix-store --import >/dev/null + result_path=$(cat "$artifact_dir/result-path.txt") + case "$result_path" in + /nix/store/*) ;; + *) echo "Invalid Nix store path: $result_path" >&2; exit 1 ;; + esac + + install_method=${MESA_NIX_INSTALL_METHOD:-auto} + install_method_used= + + install_with_nix_profile() { + command -v nix >/dev/null 2>&1 || return 1 + if nix --extra-experimental-features 'nix-command flakes' profile install "$result_path"; then + install_method_used=nix-profile + return 0 + fi + return 1 + } + + install_with_nix_env() { + command -v nix-env >/dev/null 2>&1 || return 1 + nix-env -i "$result_path" + install_method_used=nix-env + } + + case "$install_method" in + auto) + install_with_nix_profile || install_with_nix_env || { + echo "Neither 'nix profile install' nor 'nix-env -i' succeeded." >&2 + exit 1 + } + ;; + nix-profile|profile) + install_with_nix_profile || { + echo "Requested nix profile installation, but it is unavailable." >&2 + exit 1 + } + ;; + nix-env|env) + install_with_nix_env || { + echo "Requested nix-env installation, but nix-env is unavailable." >&2 + exit 1 + } + ;; + *) + echo "Unknown MESA_NIX_INSTALL_METHOD: $install_method" >&2 + echo "Use auto, nix-profile, or nix-env." >&2 + exit 1 + ;; + esac + + echo "Installed $result_path with $install_method_used." + + if [ "${MESA_NIXOS_SWITCH:-1}" = 0 ]; then + echo "NixOS system driver switch disabled by MESA_NIXOS_SWITCH=0." + exit 0 + fi + + if [ ! -e /etc/NIXOS ] && [ ! -d /etc/nixos ]; then + echo "NixOS not detected; leaving the installed profile unchanged." + exit 0 + fi + + nixos_rebuild=$(command -v nixos-rebuild || true) + if [ -z "$nixos_rebuild" ]; then + echo "NixOS detected, but nixos-rebuild is unavailable." >&2 + exit 1 + fi + if [ ! -f /etc/nixos/configuration.nix ]; then + echo "NixOS detected, but /etc/nixos/configuration.nix is missing." >&2 + exit 1 + fi + + overlay=$(mktemp /tmp/mesa-nixos-configuration.XXXXXX.nix) + trap 'rm -f "$overlay"' EXIT + cat > "$overlay" < sha256sums.txt) + cat ~/mesa-nixos-artifacts/sha256sums.txt + + - name: Upload installable Mesa Nix closure + uses: actions/upload-artifact@v7 + with: + name: mesa_${{ env.MESA_RELEASE_NAME_SUFFIX }} + path: | + ~/mesa-nixos-artifacts/mesa_${{ env.MESA_RELEASE_NAME_SUFFIX }}.tar + ~/mesa-nixos-artifacts/sha256sums.txt + retention-days: 90