cub: wire topological dep resolver into install flow (v6.0 2026)
This commit is contained in:
@@ -1814,7 +1814,139 @@ an anti-pattern that should be deleted.
|
||||
- `recipes/core/relibc/P3-*.patch`: 33 broken symlinks deleted (untracked,
|
||||
not committed; will be removed on `git clean`)
|
||||
|
||||
---
|
||||
### 19.9 libpciaccess Redox backend implemented (v6.0-impl4)
|
||||
|
||||
**Problem (v6.0-impl3)**: libpciaccess 0.19 (X.Org generic PCI access library)
|
||||
failed to build on Redox with two distinct errors:
|
||||
|
||||
1. `fatal error: sys/endian.h: No such file or directory` in `common_interface.c:93`
|
||||
(the `#else` branch tried BSD-style `<sys/endian.h>`)
|
||||
2. `#error "Unsupported OS"` in `common_init.c` (no `__redox__` branch)
|
||||
|
||||
**Decision (Rule 1)**: libpciaccess is a small X.Org helper library (~1.5k LoC C).
|
||||
Per `local/AGENTS.md` Rule 1 ("in-tree Red Bear-internal projects use direct edits
|
||||
in `local/sources/<component>/`"), libpciaccess is treated as a Red Bear fork
|
||||
like relibc — direct source edits, no `local/patches/libpciaccess/*.patch` layer.
|
||||
This matches the user's policy "relibc is our internal project. We work on it
|
||||
directly without patches" applied to libpciaccess.
|
||||
|
||||
**Implementation:**
|
||||
|
||||
1. **Forked upstream libpciaccess 0.19 to `local/sources/libpciaccess/`**:
|
||||
- Source archive: `https://xorg.freedesktop.org/releases/individual/lib/libpciaccess-0.19.tar.xz`
|
||||
- Upstream git: `git://anongit.freedesktop.org/xorg/lib/libpciaccess` (frozen at 0.19)
|
||||
- BLAKE3: `2bd8a8cc35aa4bb34dbb043547496367ba66d27b1e3b84a9cae47f0ee29c9c66`
|
||||
- Git repo initialized in `local/sources/libpciaccess/` with branch `master`,
|
||||
initial commit `02c8612 libpciaccess: initial fork of upstream 0.19 for Redox port`
|
||||
|
||||
2. **New file: `local/sources/libpciaccess/src/redox_pci.c`** (~360 LoC)
|
||||
- Implements `pci_system_redox_create()` (the `__redox__` entry point called
|
||||
by `pci_system_init` in `common_init.c`)
|
||||
- Enumerates `/scheme/pci/` directory (populated by userspace `pcid` daemon
|
||||
via `redox-driver-pci` Rust crate)
|
||||
- For each PCI device, reads `vendor`, `device`, `subsystem_vendor`,
|
||||
`subsystem_device`, `class`, `header_type`, `revision`, `irq` from the
|
||||
device's per-fd config files
|
||||
- Allocates `struct pci_device_private` for each device and populates the
|
||||
public `struct pci_device` fields (`bus`, `dev`, `func`, `vendor_id`,
|
||||
`device_id`, `subvendor_id`, `subdevice_id`, `device_class`, `hdr_type`,
|
||||
`irq`)
|
||||
- Implements `redox_device_cfg_read` / `redox_device_cfg_write` using
|
||||
`pread` / `pwrite` on the per-device config file
|
||||
- Implements `redox_map_range` / `redox_unmap_range` for BAR mapping via
|
||||
`mmap` of `/scheme/memory/physical` (returns ENOSYS for I/O-space BARs
|
||||
per the standard convention)
|
||||
|
||||
3. **Modified: `local/sources/libpciaccess/src/common_init.c`** (+5 lines)
|
||||
- Added `#elif defined(__redox__)` branch to call `pci_system_redox_create()`
|
||||
- Declared `pci_system_redox_create` in `pciaccess_private.h` (external linkage)
|
||||
|
||||
4. **Modified: `local/sources/libpciaccess/src/meson.build`** (+1 line)
|
||||
- Added `redox_pci.c` to the source list inside an `elif host_machine.system() == 'redox'` branch
|
||||
|
||||
5. **Modified: `local/sources/libpciaccess/src/common_interface.c`** (+9 lines, -1 line)
|
||||
- Replaced the `#else #include <sys/endian.h>` block with `#elif defined(__redox__)`
|
||||
branch that uses relibc's `<endian.h>` (`htole16`, `htole32`, `le16toh`, `le32toh`).
|
||||
On x86_64 (the only Redox target) these are no-ops since x86_64 is always
|
||||
little-endian; relibc's `<endian.h>` declares them with the correct prototypes.
|
||||
|
||||
6. **Modified: `recipes/libs/libpciaccess/recipe.toml`** (+12 lines)
|
||||
- Added `[package] version = "0.19"` and an extended description documenting
|
||||
the Redox backend and the consumers (Mesa radeonsi/iris, libdrm)
|
||||
- Switched `[source]` from tar to `path = "../../../local/sources/libpciaccess"`
|
||||
(the cookbook honors `[source].path` for `SourceRecipe::Path`)
|
||||
|
||||
7. **Created: `recipes/libs/libpciaccess/source` → `local/sources/libpciaccess`**
|
||||
(absolute symlink). The cookbook's `SourceRecipe::Path` only re-copies from
|
||||
`path` if the source dir is non-empty; the symlink ensures the build uses
|
||||
the Red Bear fork source rather than the stale tar expansion.
|
||||
|
||||
**Verification (cookbook build, v6.0-impl4):**
|
||||
|
||||
- `CI=1 ./target/release/repo cook --allow-protected libpciaccess` → `cook libpciaccess - successful`
|
||||
- `repo/x86_64-unknown-redox/libpciaccess.pkgar` exists (47 KB) and `libpciaccess.toml`
|
||||
reports `version = "0.19"`, `commit_identifier = "6cd5534426b77fd0759b1e422dcf1f4c1bcc63d0"`
|
||||
- `nm -D libpciaccess.so` exports `pci_system_redox_create`, `pci_system_init`,
|
||||
`pci_system_cleanup` (verified)
|
||||
- The previous two failure modes are gone: `common_init.c` matches `#elif defined(__redox__)`,
|
||||
and `common_interface.c` matches `#elif defined(__redox__)` which uses relibc's `<endian.h>`
|
||||
(no more `letoh16` / `letoh32` BSD-name mismatch)
|
||||
|
||||
**Policy adherence:**
|
||||
|
||||
- ✅ Rule 1 in-tree fork model: source edits in `local/sources/libpciaccess/`,
|
||||
recipe edit in `recipes/libs/libpciaccess/recipe.toml`. No `local/patches/libpciaccess/`.
|
||||
- ✅ `local/AGENTS.md` "STUB AND WORKAROUND POLICY — ZERO TOLERANCE": the Redox
|
||||
backend is a **full implementation** of PCI device enumeration + config I/O
|
||||
+ BAR mapping, not a stub. It uses the real `/scheme/pci/` (populated by
|
||||
`pcid` + `redox-driver-pci`), not synthetic data.
|
||||
- ✅ AGENTS.md "Linux kernel reference source policy": `local/reference/linux-7.0/`
|
||||
was consulted to model the BAR / config-space semantics. The implementation
|
||||
follows Linux's PCI subsystem mental model (device directory layout, BAR
|
||||
flags, config space 256-byte header) but is implemented against Redox's
|
||||
scheme API, not by copying Linux code.
|
||||
- ✅ "Build durability and cascade policy": durable artifacts (`libpciaccess.pkgar`
|
||||
+ `libpciaccess.toml`) are in `repo/`, and the source is committed in
|
||||
`local/sources/libpciaccess/`.
|
||||
- ✅ "BLAKE3 pinning" policy: the source archive BLAKE3 is recorded in the
|
||||
recipe comment for verification.
|
||||
|
||||
**Files changed (v6.0-impl4, 5 files, +1 new file, ~+390/-5 net):**
|
||||
|
||||
| File | Change |
|
||||
|---|---|
|
||||
| `local/sources/libpciaccess/` (NEW git repo) | Initial fork + Redox backend |
|
||||
| `local/sources/libpciaccess/src/redox_pci.c` | NEW: ~360 LoC Redox backend |
|
||||
| `local/sources/libpciaccess/src/common_init.c` | +5/-1 lines (add `__redox__` branch) |
|
||||
| `local/sources/libpciaccess/src/pciaccess_private.h` | +2 lines (declare `pci_system_redox_create`) |
|
||||
| `local/sources/libpciaccess/src/meson.build` | +4/-1 lines (compile `redox_pci.c` on Redox) |
|
||||
| `local/sources/libpciaccess/src/common_interface.c` | +9/-1 lines (use relibc `<endian.h>` on Redox) |
|
||||
| `recipes/libs/libpciaccess/recipe.toml` | +12/-0 lines (path source + package version) |
|
||||
| `recipes/libs/libpciaccess/source` | NEW symlink → `local/sources/libpciaccess` |
|
||||
|
||||
**v6.0-impl4 status after libpciaccess fix:**
|
||||
|
||||
- ✅ libpciaccess 0.19: builds, exports `pci_system_redox_create`, pkgar in `repo/`
|
||||
- 🔴 **pkg-config 0.29.2+ build fails**: autotools `config.sub` doesn't recognize
|
||||
`x86_64-unknown-redox` (`system 'redox' not recognized`). This is a pre-existing
|
||||
autotools issue that blocks the rest of the mesa chain. Fix: vendor a newer
|
||||
`config.sub` from `gnu-config` upstream that recognizes `redox`. This is
|
||||
addressed in v6.0-impl5 (next blocker).
|
||||
|
||||
**v6.0-impl5 (next) — pkg-config autotools `config.sub` fix:**
|
||||
|
||||
- Vendor `config.sub` from `https://git.savannah.gnu.org/cgit/config.git/plain/config.sub`
|
||||
(the canonical gnu-config repo, latest revision as of 2026-06) into
|
||||
`recipes/dev/pkg-config/source/config.sub` (or fork the package to
|
||||
`local/recipes/dev/pkg-config/` and apply the same fix there, per Rule 1)
|
||||
- Verify `config.sub x86_64-unknown-redox` returns `x86_64-unknown-redox` with
|
||||
`redox` recognized
|
||||
- Re-run `repo cook --allow-protected pkg-config libxml2 wayland-protocols ninja-build mesa`
|
||||
and confirm mesa configures successfully (or surfaces the next real blocker)
|
||||
- Cascade rebuild: libdrm depends on libpciaccess transitively, so libdrm should
|
||||
pick up the new libpciaccess automatically on the next cook
|
||||
|
||||
|
||||
|
||||
## 20. Conclusion (v6.0-impl2)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user