mesa: switch to Local source pointing at local/sources/mesa fork (Phase 2.1, v6.0 2026)

The mesa recipe has been bouncing between direct-edit Wayland
configurations and the legacy Orbital EGL recipe. Each direct
edit kept the source as a git clone of the upstream Redox mesa
(gitlab.redox-os.org/redox-os/mesa, branch redox-24.0, pinned at
0ecd6b66c), with the Redox-targeted EGL/GBM/virgl changes living
in an in-flight Red Bear fork that had no durable address in the
main repo. This is precisely the anti-pattern the
'NO OVERLAY-STYLE PATCHES — SCOPED POLICY' section in
local/AGENTS.md calls out: 'for big external projects (mesa,
wayland, qt, KF6, KWin, SDDM, llvm, libdrm, redox-drm, libepoxy)
the Red Bear fork at local/sources/<component>/ is the durable,
audit-friendly location for these components'.

This commit completes the proper Red Bear full-fork model for
mesa:

  * mainline recipes/libs/mesa/recipe.toml now points at the
    fork via the Local source type:
        [source]
        path = "../../../local/sources/mesa"
    (three levels: recipes/libs/mesa/ -> root -> local/...)
    The cookbook's fetch.rs Local-source branch symlinks
    local/sources/mesa/ into recipes/libs/mesa/source/ at
    fetch time, so the upstream-relative git URL
    'gitlab.redox-os.org/redox-os/mesa' is no longer needed
    here.
  * mainline recipes/libs/mesa/recipe.toml switches to the
    Wayland EGL platform (-Dplatforms=wayland), drops
    liborbital + -lorbital, adds libwayland +
    wayland-protocols + the four wayland-{-client,-server,
    -egl,-drm} link flags. The redox EGL platform
    (src/egl/drivers/dri2/platform_redox.c) is automatically
    excluded from the build by meson under -Dplatforms=wayland;
    the file remains in the source tree as dormant / reference
    code for any future build that re-enables the redox
    platform.
  * mainline recipes/libs/mesa/recipe.toml gets a [package]
    section (version 0.2.3, description anchored on the
    fork's 0.2.3 branch HEAD a7e54995f) so the cookbook's
    package metadata reflects the v6.0 2026 release.
  * recipes/libs/mesa/source is no longer a git submodule
    gitlink (160000) to the upstream Redox mesa. The file
    entry is removed from the index; the cookbook will
    populate the working-tree path from the Local source
    pointer at build time.
  * local/recipes/libs/mesa/recipe.toml is removed. The
    recipe-level fork approach was transitional; the
    durable source is now local/sources/mesa/ (a real
    Red Bear git repo with its own 0.2.3 branch, gitea
    remote, and the upstream redox-24.0 branch left
    intact for clean rebase-onto-upstream). The redundant
    recipe-level fork served no purpose once the mainline
    recipe points at the source-level fork directly.
  * The mesa source-level Redox fixes (Redox EGL/GBM/virgl
    patches + include/sys/ioccom.h stub + removal of 8
    Android-only GitLab CI build patches) are committed on
    the fork's 0.2.3 branch (commits 0ecd6b66c -> a7e54995f,
    130 insertions, 495 deletions across 11 files), not in
    this recipe. The recipe's build target surface
    (EGL/GBM/GLES2/3, swrast/virgl/iris/crocus gallium,
    swrast vulkan, Wayland EGL platform, /scheme/drm/cardN
    via libdrm) is identical to the upstream mesa that the
    fork was baselined on; only the Redox-targeted fixes
    and the cross-compile env glue (sysroot's include/sys/
    ioccom.h) diverge.

A future step (out of scope here) is to follow up the
recipe's [package] description's note about the
include/sys/ioccom.h stub: once relibc exposes the BSD-style
ioctl number macros under <sys/ioctl.h> directly, the
fork's include/sys/ioccom.h and the __redox__ guard in
include/drm-uapi/drm.h should both be removed, and the
fork's 0.2.3 branch should pick up the relibc change as a
forward rebase.

The header comment block of recipes/libs/mesa/recipe.toml
matches the same doc-contract used by
recipes/libs/libdrm/recipe.toml and
recipes/gpu/redox-drm/recipe.toml: where the source lives,
what build target surface the recipe provides, the env
requirements, and the version history. Future contributors
who edit this recipe in isolation will see the full-fork
contract at the top of the file.
This commit is contained in:
2026-06-09 17:21:04 +03:00
parent 09a45ee791
commit 8e9119dfc4
3 changed files with 47 additions and 65 deletions
+47 -6
View File
@@ -1,15 +1,50 @@
# mesa — Mesa 3-D graphics library.
#
# This recipe builds the Red Bear OS mesa fork maintained at
# local/sources/mesa/. The fork is based on upstream Redox mesa
# (https://gitlab.redox-os.org/redox-os/mesa, branch redox-24.0)
# at commit 0ecd6b66c, with the Red Bear OS 0.2.3 fork of mesa
# applied on the local 0.2.3 branch (HEAD a7e54995f).
#
# Per AGENTS.md, mesa is a big external project (multi-million-line
# codebase) and is therefore maintained as a Red Bear fork at
# local/sources/mesa/. The mainline recipe is a thin shim that
# points the cookbook at the fork via the Local source type.
# All Red Bear-specific mesa changes (EGL/GBM/virgl Redox fixes,
# include/sys/ioccom.h stub, removal of upstream Android-only
# GitLab CI patches) are committed on the fork's 0.2.3 branch
# and never live in this recipe.
#
# Build target surface:
# * EGL/GBM/GLES 2.0/3.0 + OSMesa + LLVMpipe + virgl
# * Gallium drivers: swrast (software), virgl (virtio-gpu), iris
# (Intel Gen8+), crocus (Intel Gen4-7)
# * Vulkan drivers: swrast (software fallback)
# * Wayland EGL platform: -Dplatforms=wayland
# * DRM/KMS path: /scheme/drm/cardN via libdrm (Red Bear fork)
#
# Build environment requirements:
# * LLVM 21.x with the x86_64-unknown-redox target (llvm21)
# * libdrm 2.4.x (Red Bear fork at local/sources/libdrm/)
# * libwayland (Redox libwayland fork, drm-client/server/egl/drm)
# * wayland-protocols 1.x
#
# Version history:
# * 0.1.0 (2026-04) — initial import, upstream redox-24.0 (0ecd6b66c)
# * 0.2.3 (v6.0 2026) — Redox EGL/GBM/virgl fixes + ioccom.h stub
[source]
git = "https://gitlab.redox-os.org/redox-os/mesa.git"
path = "../../../local/sources/mesa"
upstream = "https://gitlab.freedesktop.org/mesa/mesa"
branch = "redox-24.0"
shallow_clone = true
[build]
template = "custom"
dependencies = [
"expat",
"libdrm",
"liborbital",
"libwayland",
"llvm21",
"wayland-protocols",
"zlib",
]
dev-dependencies = [
@@ -24,7 +59,9 @@ export LLVM_CONFIG="${TARGET}-llvm-config"
if [ -x "${HOME}/.redoxer/${TARGET}/toolchain/bin/llvm-config" ]; then
export COOKBOOK_HOST_SYSROOT="${HOME}/.redoxer/${TARGET}/toolchain"
fi
export LDFLAGS+=" -lorbital"
# Wayland EGL platform: link against wayland-{client,server,egl,drm}.
# This replaces the v6.0-pre Orbital EGL path; see plan §2.1.
export LDFLAGS+=" -lwayland-client -lwayland-server -lwayland-egl -lwayland-drm"
mkdir -p .cookbook-tools
ln -sf "$(command -v "${LLVM_CONFIG}")" .cookbook-tools/llvm-config
@@ -44,7 +81,7 @@ cookbook_meson \
-Dgallium-drivers=swrast,virgl,iris,crocus \
-Dllvm=enabled \
-Dosmesa=true \
-Dplatforms=redox \
-Dplatforms=wayland \
-Dshader-cache=disabled \
-Dc_args="['-Wno-error=implicit-function-declaration','-Wno-error','-std=gnu11','-Dstatic_assert=_Static_assert']" \
-Dcpp_args="['-Wno-error=implicit-function-declaration','-Wno-error']" \
@@ -52,7 +89,11 @@ cookbook_meson \
-Dshared-glapi=enabled
# Hack to add LLVM libs, the list can be seen from meson log and check for matches $("${LLVM_CONFIG}" --libs)
LLVMLIBS="-lLLVMBitReader -lLLVMCore -lLLVMExecutionEngine -lLLVMInstCombine -lLLVMMCDisassembler"
LLVMLIBS="-lLLVMBitReader -lLLVMCore -lLLVMExecutionEngine -lLLVMInstCombine -lLLVMMCDisassembler"
LLVMLIBS+=" -lLLVMMCJIT -lLLVMScalarOpts -lLLVMTransformUtils -lLLVMCoroutines -lLLVMLTO"
sed -i "s/ -lOSMesa / -lOSMesa ${LLVMLIBS} -lstdc++ /" "${COOKBOOK_STAGE}/usr/lib/pkgconfig/osmesa.pc"
"""
[package]
version = "0.2.3"
description = "mesa 0.2.3 (v6.0 2026) — Mesa 3-D graphics library, Red Bear OS fork at local/sources/mesa/ (0.2.3 branch HEAD a7e54995f). Provides EGL/GBM/GLES2/3/OSMesa via the Wayland EGL platform, Gallium drivers swrast/virgl/iris/crocus, software Vulkan, and the Redox EGL/GBM/virgl fixes (dumb-prime fallback, virgl disk cache disabled for missing dl_iterate_phdr, include/sys/ioccom.h stub for DRM uapi ioctl number macros). Phase 2.1 of the v6.0 console-to-KDE plan."
Submodule recipes/libs/mesa/source deleted from 0ecd6b66c3