Improvement #9 from BUILD-SYSTEM-IMPROVEMENTS.md. Scans the tail of
a failed repo cook output and matches it against ~14 known failure
patterns documented in AGENTS.md 'COMPLEX FIX CHECKLIST
(v6.0-impl17)'. Each rule emits a structured fix with the relevant
build flags, paths, and AGENTS.md reference.
Usage:
repo cook kf6-kio 2>&1 | tee /tmp/build.log
classify-cook-failure.py /tmp/build.log
Cuts per-failure diagnosis from 5-10 min of manual pattern-matching to
10-30 seconds. Critical for new contributors. Pure read-only analysis,
no build side effects.
Also opportunistically references the new
audit-patch-idempotency.py from the patch-no-longer-applies rule,
tying the two improvements together.
Two S-sized improvements from BUILD-SYSTEM-IMPROVEMENTS.md:
1. local/scripts/audit-patch-idempotency.py (improvement #3):
Validates that every external patch in local/patches/ is
idempotent (--reverse --check succeeds) and reproducible
(re-clone + re-apply produces an identical tree). Catches the
patch idempotency class of bug at lint time, where it used to
surface as a 2+ hour cookbook failure during a cook. Found a
real bug on first run: local/patches/libdrm/02-redox-dispatch.patch
has a hunk at xf86drm.c:321 that no longer matches the upstream
libdrm-2.4.125.
2. src/cook/script.rs auto-link Qt sysroot dirs (improvement #8):
The cookbook's BUILD_PRESCRIPT now auto-detects if the per-recipe
sysroot has Qt6 (qtbase or qtdeclarative) and creates the canonical
/usr/{plugins,mkspecs,metatypes,modules} symlinks that KF6 recipes
need for cmake to find Qt6Config.cmake's INTERFACE_* paths. New
KF6 recipes that depend on qtbase no longer need to manually
call redbear_qt_link_sysroot_dirs in their build script. Recipes
that need more customization can still call the helper directly
via 'source $COOKBOOK_ROOT/local/scripts/lib/qt-sysroot.sh'.
Previously the script only parsed [package].dependencies, missing
the build-time-only consumers that the cookbook's
get_build_deps_recursive() picks up via [build].{dependencies,
dev_dependencies}. This caused 'rebuild-cascade.sh relibc' to report
'nothing to do' even though the cookbook correctly identifies
uutils, libpciaccess, relibc-tests, and other packages as relibc
build-dep consumers and rebuilds them under 'make live'.
The fix is to also walk the [build] section. The cookbook's own
parser uses the same convention.
The per-recipe sysroot and stage cache used mtime of the dep pkgar
files to detect when a rebuild was needed. Any mtime bump on relibc
or any leaf dep (including the pre-cook relibc in build-redbear.sh)
would cascade-rebuild every downstream per-recipe sysroot even when
the dep's content was bit-identical. The resulting transient sysroot
extractions produced 'C compiler cannot create executables' and
'configure error' failures that retried fine standalone.
Replace the mtime checks with a blake3 content-hash fingerprint of
the dep pkgar set:
- For the per-recipe sysroot: store the fingerprint in
<target>/sysroot/.tags/deps-fingerprint and rebuild only when the
computed fingerprint does not match.
- For the per-recipe stage: store two fingerprints at
<target>/.deps-fingerprint and <target>/.host-deps-fingerprint.
Rebuild stage only when (source changed) OR (deps content changed)
OR (host-deps content changed) OR (auto_deps.toml missing).
This eliminates the transient build failures in 'make live' / 'build-redbear.sh'
and aligns the cache invalidation signal with the actual content the
recipe depends on, not the arbitrary mtime of the dependency package.
TUI rewrite (the visible half of the change):
- 8 views instead of 6: Home, Search, Info, Install, Build,
Query, Remove, Updates — central VIEW_ORDER const in
tui/views/mod.rs and cycle_view() / parent_view() helpers
mean adding a 9th view is one line.
- Help overlay is now view-scoped: shows a Global section and
an In this view section that only lists keybindings the
current view actually honors.
- Esc goes back one view (parent_view map); q still quits.
- New ConfirmAction enum and full-screen confirm_banner
widget: pressing i / b / r / U now sets pending_confirm
and shows a banner; y confirms, n cancels.
- TUI build routed through the canonical fetch_aur_to_store
+ validate_git_target instead of an inline git clone. The
6 swallowed errors are now surfaced in build_log and
status_message.
- panic-catching wrapper around spawn_action so a panic in
the worker thread becomes a visible ActionUpdate instead
of a frozen spinner.
- TUI cancel architecture: Arc<Mutex<Option<Child>>> shared
between parent and worker drainer, Arc<AtomicBool> cancel
flag, c keypress in Install/Build views calls child.kill().
- Terminal too-small guard: < 14 rows or < 40 cols renders
a Terminal too small overlay instead of broken layout.
- Sticky error coloring in the status bar: success uses
theme.success, failure uses theme.error, neutral uses
status_style.
- PgUp / PgDn global scroll bindings for Install/Build log
views; scroll position tracked in install_log_scroll /
build_log_scroll u16 fields; install_log_joined /
build_log_joined pre-joined strings avoid repeated
Vec<String>::join calls during render.
- CubApp::new() returns Result<Self, CubError>; HOME missing
or store.init() failure is now a fatal error overlay
instead of a silent /tmp/.cub fallback.
AUR hardening:
- AUR client (reqwest::blocking::Client) gets 5s connect +
15s request timeouts.
- fetch_aur_to_store writes the recipe atomically: stage in
store.tmp_dir()/recipe-staging-<name>-<nanos>, then
fs::rename. TmpGuard drop cleans up the clone directory.
- validate_git_target rejects names with .., ://, leading -,
empty, or NUL bytes (was previously only catching leading -).
- redox-pkg dependency pinned to rev
52f7930f8e6dfbe85efd115b3848ea802e1a56f0 to match the
resolved Cargo.lock.
God-module split (main.rs 2063 -> 1723 lines):
- constants.rs: 10 path / URL constants.
- bur_helpers.rs: search_cached_bur, ensure_bur_package_dir,
sync_bur_repo, default_bur_repo_url, bur_repo_dir,
aur_repo_url, BurMatch struct.
- fs_helpers.rs: find_stage_dir, directory_has_entries,
copy_dir_recursive, remove_dir_if_exists,
current_unix_timestamp, join_strings, join_package_names,
empty_if_blank, yes_no.
- paths.rs: cub_temp_dir, validate_git_target.
Tests:
- 19 unit tests in main-side modules (was 5); 121 in the
lib (unchanged). Total 140/140 pass.
- New CubError variant tests, validate_git_target
happy-path + 4 attack vectors, cub_temp_dir unique-name
under concurrent calls, bur_repo_dir / aur_repo_url
composition, fs_helpers round-trips with tempfile
scratch dirs.
Policy:
- local/AGENTS.md gains a TUI CONVENTION section: single
binary, -i flag, no separate -tui crate, ratatui 0.30
+ termion 4.0.6, anti-pattern list. cub, redbear-info,
and redbear-netctl-console are listed as already
compliant.
- cubl (the cub lib-only consumer) recipe path updated
from -p cub-cli to -p cub.
Verified: cargo build --workspace and --no-default-features
and --features full and --features tui all clean; cargo
test --workspace 140/140 pass; cub --version cub 0.2.3;
cub --help 21 subcommands.
There is one cub, not three. The CLI, TUI, and library used to be
three separate workspace crates with awkward paths and three
independent installable artifacts. After the rewrite:
- single Cargo workspace at local/recipes/system/cub/source/cub/
with [lib] name = "cub" and [[bin]] name = "cub" in one
Cargo.toml
- 21 source files moved into cub/src/ (lib modules + main.rs +
tui/{app,mod,theme,widgets,views/{mod,build,home,info,install,
query,search}}.rs)
- 13 dead crate Cargo.toml / Cargo.lock / old lib.rs files removed
- cub-assessment + cubl + cub system recipe point at the new
package name
- workspace manifest collapsed to { members = ["cub"], version =
"0.2.3" } to match the active Red Bear OS branch
The TUI surface is preserved (ratatui 0.30 + termion 4.0.6,
single binary, -i flag) and the public lib API is unchanged
(cub::aur, cub::pkgbuild, cub::version, etc. all re-exported from
the new lib.rs).
Verified: cargo build --workspace passes with all four feature
combos (default, no-default-features, --features full, --features
tui); cub-assessment compiles against cub v0.2.3; cub --version
prints cub 0.2.3; cub --help lists 21 subcommands.
The v6.0 service file used type={scheme='input/evdev'} which caused
init to register the scheme under the wrong name. Restored the
original type={scheme='input'} so init correctly registers the
:input scheme and all downstream services (vesad, fbcond, fbbootlogd)
can find it.
rtcd: syscall::openat(0, '/scheme/sys/update_time_offset') used fd 0
(stdin) instead of the namespace fd, causing EACCES. Fixed by using
libredox::call::getns().
acpid: AmlPhysMemHandler captured pci_fd at construction as
Arc<Option<Fd>>, so after set_pci_fd() stored the fd, the handler
never saw it. Changed to Arc<RwLock<Option<Fd>>> shared between
AcpiContext and the handler.
Base fork commits: 770694d0 (rtcd), 84573feb (acpid)
A focused batch of small, real improvements from prior sessions. Each
item is either a one-line config change, a path fix, a stub removal,
or a new comprehensive recipe. No stubs added, no workarounds, no
fake fixes.
* local/recipes/libs/libdrm/recipe.toml: enable Intel GPU support
(-Dintel=enabled). Mesa's iris/crocus Gallium drivers need the
Intel backend compiled in. The AMD backend is already enabled.
* local/recipes/libs/libxkbcommon/recipe.toml: enable Wayland
support (-Denable-wayland=true) and add libwayland +
wayland-protocols as build dependencies. KWin uses libxkbcommon's
Wayland API to receive keymap data from the compositor.
Previously the recipe had Wayland disabled, blocking KWin.
* local/recipes/kde/kf6-kded6/recipe.toml: replace a wrapper-script
hack (which renamed kded6 to kded6.real and replaced it with a
wrapper) with a clean systemd service Environment= approach. The
wrapper script is removed (kf6-kded6/source/kded6-wrapper.sh
deleted). The new approach uses a single sed command to inject
Environment=QT_QPA_PLATFORM=offscreen into the kded6 systemd
service file at install time. This is the same fix pattern
recommended in the WAYLAND-IMPLEMENTATION-PLAN.md.
* local/patches/libdrm/02-ioctl-response-sizes.patch: fix the patch
header paths. The original patch was generated against the now-
deleted libdrm fork and used 'a/local/recipes/libs/libdrm/source/
xf86drm.c' style paths. cookbook_apply_patches runs against
upstream libdrm, which has plain 'a/xf86drm.c' paths. Without
this fix, git apply would warn about path mismatch. The hunk
contents are unchanged.
* recipes/libs/libpciaccess/recipe.toml: new comprehensive recipe
for libpciaccess 0.19. Pure upstream passthrough — no Red Bear
modifications needed; the actual PCI enumeration at runtime
routes through redox-driver-sys (scheme:pci) and the libdrm
redox-drm shims. Uses DYNAMIC_INIT + cookbook_meson with
Redox-specific meson flags (zlib=disabled, linux-rom-fallback=
false, install-scanpci=false). Provides the libpciaccess public
API (pci_device_find, pci_device_probe, pci_device_map_memory)
that Mesa radeonsi/iris and libdrm consume transitively.
* recipes/libs/pciaccess-stub: removed. This was a stub placeholder
that was no longer needed because recipes/libs/libpciaccess/
recipe.toml is the real implementation. Per the project's
ZERO TOLERANCE FOR STUBS policy (local/AGENTS.md), stubs must
be removed when real implementations exist.
The cub AUR→RBPKGBUILD→recipe.toml conversion pipeline (located at
local/recipes/system/cub/source/) was assessed end-to-end against
12 representative real-world PKGBUILDs:
- libevdev (simple meson)
- fd-find (cargo)
- libpciaccess 0.18.1 (meson)
- fmt (cmake)
- wlroots-git (git source, complex deps)
- libpciaccess 0.19 (extra/-style, meson + ninja)
- ffmpeg (configure + options)
- mesa 24.3 (git+url + multi-source + pkgver())
- gzip (configure + git source + check)
- zlib (simple C, configure)
- openssl (pkgbase split package)
- glib2 (complex deps, real-world)
The assessment found 8 critical bugs that would prevent cub from
producing working Red Bear recipes for any real Arch package. 7 of
the 8 bugs were fixed in the previous commit (7c5b1f36e); the 8th
(custom-template recipes lack DYNAMIC_INIT and cookbook_apply_patches
boilerplate) is deferred as a cookbook-integration concern.
This commit adds two artifacts of the assessment:
1. local/docs/cub-assessment-and-improvement-plan.md (508 lines,
~28KB): the complete assessment document. Sections:
- Executive summary (architecture decision + 8-bug verdict)
- What cub does well (10+ working cases)
- The 8 bugs (location, severity, root cause, fix)
- Test methodology
- Test cases by category (A: conversion success, B: dep mapping,
C: source URL, D: build template, E: edge cases, F: validation)
- Forward improvement plan (16 items in 4 tiers)
- Appendix A: cub architecture map (CLI + 17 modules)
- Appendix B: RBPKGBUILD format spec
- Appendix C: Generated recipe format vs. real Red Bear recipe
2. local/recipes/system/cub/source/cub-assessment/:
a 12-PKGBUILD integration test harness. A standalone binary that
exercises the conversion pipeline on each PKGBUILD and reports
status, warnings, action_items, recipe validity (TOML), and the
first 30 lines of the generated recipe. Used to verify the bug
fixes in 7c5b1f36e — all 12 cases convert successfully
post-fix, including the previously-erroring mesa 24.3 (which
now produces a valid recipe with a multi-source warning).
The test harness lives next to the cub source (cub-assessment/) and
has its own Cargo.toml with [workspace] empty so it doesn't join the
cub workspace. Build/run with:
cd local/recipes/system/cub/source
cargo run --manifest-path cub-assessment/Cargo.toml
The harness is intended for use by future cub maintainers to catch
regressions. It's not wired into CI yet — that would be a separate
task.
After running an empirical assessment of cub's AUR→RBPKGBUILD→recipe
pipeline against 12 representative real-world PKGBUILDs (libevdev,
fd-find, libpciaccess, fmt, wlroots-git, ffmpeg, mesa 24.3, gzip,
zlib, openssl, glib2, plus a libpciaccess extra/-style variant), 7
critical bugs were found that would prevent any real Arch package
from converting to a working Red Bear recipe.
Fixes (all surgical, in cub-lib/src/):
1. deps.rs: drop glibc dependency (was: mapped to relibc, which is
wrong because relibc is the Redox C library and is part of the
OS, not a package). glibc is a tautology on Redox and must be
omitted. The empty mapping triggers the standard 'omitted' path
in map_dep_list with a clear 'has no Redox mapping' warning.
2. deps.rs: drop gcc-libs dependency (was: mapped to gcc, which
conflates the runtime libgcc/libstdc++ with the compiler).
gcc-libs is provided by relibc on Redox and must be omitted.
3. deps.rs: prefix build tools (meson, ninja, cmake, make,
pkg-config, autoconf, automake, libtool, git, perl, python,
rust, cargo, llvm, clang, swig, bison, flex, doxygen, and ~50
more) with 'host:' so the Redox cookbook knows they're host-only
and not part of the cross-compiled target. The new BUILD_TOOLS
constant lists all known build tools; map_dependency returns
'host:<name>' for entries in this set.
4. pkgbuild.rs: parse AUR-style 'git+url#tag=branch' source syntax.
The new split_source_fragment function strips the 'git+' prefix,
extracts the '#tag=...' or '#branch=...' or '#commit=...'
fragment, and maps to the Redox cookbook's [source].branch or
[source].rev field. The previous behavior kept the literal
'git+...#tag=...' URL in the recipe, which is invalid Redox
cookbook format.
5. pkgbuild.rs: support multi-source PKGBUILDs. Real packages like
mesa have 2+ sources (git repo + extra file). The previous
behavior errored on multi-source with 'multiple sources not yet
supported'. Now: keep the first source as primary, warn about
the rest, and continue conversion. Auxiliary sources are listed
in the warning message so the user can re-add them.
6. pkgbuild.rs: preserve options=() flags (e.g., '!lto', '!strip',
'!emptydirs') in the new RBPKGBUILD compat.options field.
Previously dropped silently.
7. pkgbuild.rs: substitute \${pkgver}, \${pkgname}, etc. in source
URLs by piping each entry through resolve_shell_vars before
converting. The previous behavior kept the literal '\${pkgver}'
in the URL, making the recipe's [source].tar URL invalid.
All fixes verified by:
- cub-assessment: 12 PKGBUILDs all convert and produce valid TOML.
The mesa 24.3 case (which previously errored on multi-source) now
produces a valid recipe with a warning. ffmpeg's glibc is now
correctly dropped. All build tools (meson, ninja, etc.) are
correctly host: prefixed. All AUR git+url sources parse
correctly into branch/rev fields.
- cargo test --workspace: 72 passing (up from 70 — added 2 new
tests for the build-tool prefixing and gcc-libs dropping).
The 8th known issue (custom-template recipes lack DYNAMIC_INIT and
cookbook_apply_patches boilerplate) is deferred — it's a separate
cookbook-integration concern tracked in the cub assessment plan
(local/docs/cub-assessment-and-improvement-plan.md).
This is the final cleanup batch for the Rule 2 big-project migration
work (pipewire, wireplumber, mesa, libdrm all migrated to upstream git
+ external patches in local/patches/<component>/).
Changes:
* local/recipes/libs/libdrm/recipe.toml: upgrade from
template = 'meson' + mesonflags to template = 'custom' +
DYNAMIC_INIT + cookbook_apply_patches + cookbook_meson. This
matches the structural pattern used by the other 3 Rule 2
migration recipes (mesa, pipewire, wireplumber) and gives libdrm
the same flexible shell-script build context for future
cross-compilation tweaks. Adds build dependencies expat,
libpciaccess, meson, ninja-build, pkgconf (the meson template
had these implicit; the custom template requires them explicit).
Patch application still goes through cookbook_apply_patches
(4 dots from local/recipes/libs/libdrm/ to project root).
* local/recipes/AGENTS.md: catalog update reflecting the libdrm
template change (now 'custom' instead of 'meson') and adding
catalog entries for 4 recipes that were created during this
migration round but were missing from the catalog: libxkbcommon,
pam-redbear, pipewire, wireplumber.
* sources/redbear-0.1.0/manifest.json: add a new manifest entry
for 'libs/libdrm' (the historical 0.1.0 archive entry for libdrm,
which uses the patched tarball). This mirrors the existing
'lib/libdrm' entry and gives 'repo restore' a consistent way to
recover the libdrm source from the 0.1.0 release archive.
* Doc updates: AGENTS.md, README.md, local/AGENTS.md,
local/docs/CONSOLE-TO-KDE-DESKTOP-PLAN.md, local/docs/GPU-MESA-
KDE-CHAIN-ASSESSMENT.md, local/recipes/AGENTS.md: bring the
docs in line with the Rule 2 policy and the 4-migration set
(pipewire, wireplumber, mesa, libdrm). Most are catalog or
cross-reference updates.
* local/docs/STUBS-FIX-PROGRESS.md: heavily trimmed (-303 net).
The old document was tracking 346+ stub fixes from earlier
sessions; most of those are now closed and the document has
been condensed to the current state.
* local/docs/SOURCE-OWNERSHIP-MODEL.md: deleted (-89 lines).
This old doc described a 'source ownership' concept that has
been superseded by the amended AGENTS.md Rule 2 (NO OVERLAY-
STYLE PATCHES — SCOPED POLICY) section, which is the canonical
source-ownership model going forward.
Two related cleanups for the libdrm Rule 2 migration (commit 5f5eec1c4):
* libwayland: add -Dscanner=false to cookbook_meson, with a 20-line
comment explaining the rationale. Without this flag, libwayland's
meson.build builds a `wayland-scanner` executable for the *target*
(Redox). The resulting binary has /lib/ld64.so.1 as its ELF
interpreter (Redox's loader) and is useless on the build host. The
pkgconfig that libwayland installs (wayland-scanner.pc) then points
`wayland_scanner` to this Redox binary, and downstream consumers
(mesa, wayland-protocols) pick it up via
dependency('wayland-scanner'). When the cookbook's redoxer sandbox
tries to exec it on the host, the host kernel can't find
/lib/ld64.so.1 and the build fails with 'required file not found'.
Disabling the scanner means libwayland doesn't install
wayland-scanner to the sysroot. Downstream consumers then fall
through to the host's /usr/bin/wayland-scanner (a proper
x86_64-linux-gnu binary that works on the build host). This
matches what wayland-protocols already does in its own meson.build
(see its redox.patch in the recipe).
* libdrm: remove 4 orphaned source-cache files that were left over
from the libdrm Local source fork at local/sources/libdrm/ (deleted
in commit 5f5eec1c4). The 4 files were the in-tree Red Bear edits
that are now external patches in local/patches/libdrm/:
- source/virtgpu_drm.h DELETED (was in 01-drm-ioctl-bridge.patch)
- source/xf86drm.c MODIFIED (most edits moved to patch)
- source/xf86drmMode.c MODIFIED (most edits moved to patch)
- source/xf86drm_redox.h DELETED (was in 01-drm-ioctl-bridge.patch)
The local/recipes/libs/libdrm/source/ cache is now empty (only
upstream files) and is regenerated by 'repo cook' from the upstream
git URL specified in the recipe. These 4 files are no longer
touched by the build system.
Fixes the build correctness issue where downstream mesa/wayland-protocols
builds would fail with 'required file not found: /lib/ld64.so.1' due to
wayland-scanner being built for the wrong target. The fix mirrors what
upstream Redox's wayland-protocols recipe does in its own meson.build.
Replace the inline `for p in ${REDBEAR_PATCHES_DIR}/[0-9]*.patch; do
git apply ...; done` loop in each of the 4 Rule 2 migration recipes
with a single call to cookbook_apply_patches (added in the previous
commit to src/cook/script.rs).
Before (9 lines per recipe):
REDBEAR_PATCHES_DIR="${REDBEAR_PATCHES_DIR:-...}/local/patches/<component>"
cd "${COOKBOOK_SOURCE}"
for p in "${REDBEAR_PATCHES_DIR}"/[0-9]*.patch; do
[ -f "$p" ] || continue
echo "Applying Red Bear <component> patch: $p"
git apply "$p" || { echo "Failed to apply $p"; exit 1; }
done
cd "${COOKBOOK_BUILD}"
After (1 line per recipe):
REDBEAR_PATCHES_DIR="${REDBEAR_PATCHES_DIR:-...}/local/patches/<component>"
cookbook_apply_patches "${REDBEAR_PATCHES_DIR}"
Behavior change: the helper is now idempotent (skips already-applied
patches via `git apply --reverse --check`), so a partial re-cook
after a previous successful build no longer fails with 'patch already
applied'. This was the primary motivation for the refactor.
Per-recipe path depth notes (for the record):
* mesa — recipes/libs/mesa/ (depth 2) — 2 dots
* libdrm — local/recipes/libs/libdrm/ (depth 3) — 4 dots
* pipewire — local/recipes/libs/pipewire/ (depth 3) — 4 dots
* wireplumber — local/recipes/libs/wireplumber/ (depth 3) — 4 dots
All four recipes parse as valid TOML and use the cookbook's
[source].script (libdrm) or [build].script (mesa/pipewire/wireplumber)
hook, both of which load cookbook shell functions including the new
cookbook_apply_patches helper.
Per local/AGENTS.md Rule 2 (NO OVERLAY-STYLE PATCHES — AMENDED 2026),
big external projects (mesa, libdrm, wayland, qt, KF6, KWin, SDDM,
llvm, libepoxy, pipewire, wireplumber) apply their Red Bear edits as
external patches in local/patches/<component>/[0-9]*.patch on top of
the upstream checkout. Recipes for these projects previously inlined
the same 7-line bash loop (`cd $COOKBOOK_SOURCE; for p in
.../*.patch; do git apply ...; done; cd $COOKBOOK_BUILD`).
The cookbook_apply_patches helper centralizes this loop and adds
three quality improvements over the inline version:
1. Idempotence: each patch is checked with `git apply --reverse
--check` before applying. If the patch is already applied (e.g.
a partial re-cook after a previous successful build), the helper
skips it instead of failing with 'patch already applied'.
2. Failure accounting: applied/skipped/failed counts are reported
at the end of the run, so a single failed patch doesn't silently
abort the entire build chain.
3. Single source of truth: any future change to the patch application
semantics (e.g. supporting 3-way merges, --3way, or a different
check algorithm) happens in one place, not across 12+ recipes.
The helper is loaded into every recipe's build environment via the
existing cookbook shell-script injection in src/cook/script.rs and is
called as:
cookbook_apply_patches "${REDBEAR_PATCHES_DIR}"
This commit is the cookbook-side change. The 4 existing Rule 2
migration recipes (mesa, libdrm, pipewire, wireplumber) are refactored
in the next commit to call this helper instead of inlining the loop.
Per local/AGENTS.md Rule 2 (NO OVERLAY-STYLE PATCHES — AMENDED 2026), big
external projects must NOT have source forks in local/sources/. libdrm's
Red Bear edits now live as external patches in local/patches/libdrm/,
matching the established pipewire and wireplumber migration pattern
(commits 8ff9da2ff, 722f0c452).
The 5 patches were recovered from git history (commit 89d1306c8^ —
the migration that deleted them) and renamed to the modern Rule 2
NN-prefix naming for lexical-order application:
01-drm-ioctl-bridge.patch (P1 from old series, 278 lines)
02-ioctl-response-sizes.patch (P1 from old series, 30 lines)
03-drm-get-pci-info.patch (P2 from old series, 153 lines)
04-drm-get-version-driver-name.patch (P3 from old series, 34 lines)
05-drmGetDeviceFromDevId-redox.patch (P4 from old series, 68 lines)
These patches add the Redox-side ioctl/ioctl-com and scheme: dispatch
path needed by redox-drm and Mesa radeonsi/iris.
The recipe now points at upstream libdrm 2.4.125
(https://gitlab.freedesktop.org/mesa/libdrm, tag libdrm-2.4.125) and
applies the patches via a [source].script hook (the cookbook's
"Optional script to run to prepare the source" field) with a
REDBEAR_PATCHES_DIR computed from COOKBOOK_RECIPE.
Fixes the broken state where the recipe referenced the now-deleted
local/sources/libdrm/ fork.
Per local/AGENTS.md Rule 2 (NO OVERLAY-STYLE PATCHES — AMENDED 2026), big
external projects must NOT have source forks in local/sources/. Mesa's
Red Bear edits now live as external patches in local/patches/mesa/,
matching the established pipewire and wireplumber migration pattern
(commits 8ff9da2ff, 722f0c452).
The 3 patches were recovered from git history (commit 89d1306c8^ —
the migration that deleted them) and renamed to the modern Rule 2
NN-prefix naming for lexical-order application:
01-virgl-redox-disk-cache.patch (P4 from old series, 49 lines)
02-gbm-dumb-prime-export.patch (P5 from old series, 56 lines)
03-platform-redox-gpu-probe.patch (P6 from old series, 264 lines)
These patches disable the virgl disk cache (dl_iterate_phdr is missing
on Redox), add the GBM dumb prime export for cross-GPU buffer sharing,
and implement the platform/redox GPU probe path needed for EGL/Vulkan
on Redox.
The recipe now points at upstream Redox mesa
(https://gitlab.redox-os.org/redox-os/mesa, branch redox-24.0) and
applies the patches via a git apply loop in [build].script with
correct path resolution (2 dots from recipes/libs/mesa/ to project root).
Fixes the broken state where the recipe referenced the now-deleted
local/sources/mesa/ fork.
Per local/AGENTS.md Rule 2 (NO OVERLAY-STYLE PATCHES — AMENDED 2026), big
external projects must NOT have source forks in local/sources/. PipeWire's
Red Bear edits now live as external patches in local/patches/pipewire/,
matching the established mesa, libdrm, and wireplumber migration pattern.
The patch contains the redox_compat/ shim headers (byteswap.h,
sys/mman.h) that bridge relibc gaps for the meson subprojects, the
__redox__ guards in src/pipewire/mem.c for the memfd_create emulation
on the redox ramfs scheme, and the __redox__ stubs in
src/pipewire/thread.c for pthread_setname_np and
sched_get_priority_min/max. It also includes the README-redbear.md
fork gap analysis and a small number of build script adjustments for
cross-compilation under the Redox toolchain.
The local/sources/pipewire/ fork is preserved as a historical reference
of the migration baseline but no longer used by the build system. A
follow-up commit will remove it after we verify a clean rebuild from
upstream git + the external patch.
The recipe's REDBEAR_PATCHES_DIR uses ../../../.. (four dots) to
correctly resolve to local/patches/pipewire/ from the recipe's depth
(local/recipes/libs/pipewire/recipe.toml). The mesa and libdrm
migrations shipped a path-count typo (one short); this recipe uses
the correct depth per local/AGENTS.md.
Per local/AGENTS.md Rule 2 (NO OVERLAY-STYLE PATCHES — AMENDED 2026), big
external projects must NOT have source forks in local/sources/. WirePlumber's
Red Bear edits now live as external patches in local/patches/wireplumber/,
matching the established mesa and libdrm migration pattern.
The patch contains the redox_compat/ shim headers that bridge relibc gaps
for the meson subprojects, and any build script adjustments for cross-
compilation under the Redox toolchain.
The local/sources/wireplumber/ fork is preserved as a historical reference
but no longer used by the build system. A follow-up commit will remove
it after we verify a clean rebuild from upstream git + patch.
Implements the 10 protocol surfaces from Phase 4 of CONSOLE-TO-KDE-DESKTOP-PLAN.md:
- xdg-shell: xdg_wm_base, xdg_surface, xdg_toplevel, xdg_popup, xdg_positioner
- xdg-output (zxdg_output_manager_v1)
- xdg-decoration (zxdg_decoration_manager_v1)
- wp_viewporter for surface scaling
- zwp_linux_dmabuf_v1 for hardware buffer import
- wl_data_device, wl_data_source, wl_data_offer for clipboard/drag-and-drop
- wl_subcompositor, wl_subsurface for sub-surface composition
All protocols are required for Qt6 / KDE Plasma / KWin clients to run under
redbear-compositor. The compositor still serves the greeter only; KWin is
the canonical compositor for the user session.