Commit Graph

2693 Commits

Author SHA1 Message Date
vasilito 8eaf54d87f verify-tracked-sources: first-party redbear-* drift is fatal
redbear-* recipes are not vendored upstream code -- they are Red Bear's own
programs and exist nowhere else. A vendored tree can be restored from its
tarball or git remote; first-party source cannot. If a recipe sed or an `rm`
damages it and that gets committed, the work is gone.

Not hypothetical. Seven redbear-* recipes rewrite their own source during the
build (greeter, btusb, btctl, ime, dnsd, accessibility, keymapd), and all seven
are exempt from out-of-tree staging because their cargo manifests carry path
dependencies escaping the source tree. They are simultaneously the least
protected and the most irreplaceable code here.

Uncommitted drift in them now fails preflight instead of printing a note that
scrolls past. Vendored trees keep the existing warn-by-default behaviour.
Override: REDBEAR_ALLOW_DIRTY_FIRSTPARTY=1.

Verified: gate is silent on a clean tree, fires on a one-line edit to
redbear-authd, and the tree restores cleanly.
2026-08-04 19:30:37 +03:00
vasilito 130f37de8b cook: don't stage recipes with cargo path deps escaping their source
redbear-greeter's manifest has
  redbear-login-protocol = { path = "../../redbear-login-protocol/source" }
Cargo resolves that relative to the manifest, so out-of-tree staging pointed it
at <recipe>/target/redbear-login-protocol/source:
  failed to read .../target/redbear-login-protocol/source/Cargo.toml
  No such file or directory (os error 2)

Rewriting the manifest would silently change dependency paths behind the
recipe's back. Leaving these in tree is the honest option: they are cargo
recipes that do not sed their source, so the mutation risk staging exists to
prevent does not apply to them.
2026-08-04 19:24:40 +03:00
vasilito 85462821a2 build: serialise recipe cooking by default; auto-reset stale cmake caches
Two systemic fixes for failure classes this session kept re-hitting.

1. COOK_JOBS default 4 -> 1. Recipes are not isolated: redbear_qt_ensure_dep_
   sysroots repairs OTHER recipes' sysroots, so one cook can relink the include/
   or lib/ directory another is compiling against. The tell was a failure that
   MOVED between source files across runs (kirigami died in KirigamiTemplates on
   build 59, KirigamiPrivateplugin on 61) with a sibling's rm -f/ln -sf
   interleaved in the log. Making the relink atomic closed one window; the
   sharing itself remains unsound. Compilation is still parallel -- each recipe
   keeps the full -j budget -- only the number of recipes in flight drops to 1.
   An intermittent build costs more than a serial one.

2. Auto-reset build dirs whose CMakeCache records a different source path.
   CMake stores CMAKE_HOME_DIRECTORY and hard-aborts when the source moves:
     CMake Error: The source ".../source-staged/..." does not match the source
       ... used to generate cache
   Out-of-tree staging moved every tracked recipe's source and stranded 66 build
   dirs. Two rounds of clearing them by hand were not a fix: the next source-path
   change strands them again, and the abort surfaces in a downstream recipe
   rather than at the cause. cook now detects the mismatch and resets the dir.
2026-08-04 19:05:25 +03:00
vasilito 36554161cb verify-patch-sanity: skip source-staged, the out-of-tree copy of source/
Out-of-tree staging made the checker scan source-staged/, which holds the same
upstream third-party patches as source/ -- already skipped because they are not
ours to fix. qtdeclarative's bundled yoga patch then failed the build at
preflight. Same rationale as the existing /source/ entry.
2026-08-04 18:26:44 +03:00
vasilito a591bee846 cook: don't stage submodules; refresh staged source in place
Two defects in the out-of-tree staging from 221a91cba4/a3d9240d62, both found
by actually running it rather than by inspection.

1. Submodules were staged. `git ls-files --error-unmatch` succeeds on a
   gitlink, so relibc looked like an ordinary tracked tree and was copied
   wholesale, losing the nested-repo context cargo needs -- crt0, crti, crtn
   and ld_so all failed to build. Fork submodules are already covered by the
   stricter REFUSING-TO-BUILD dirty gate, so skipping them loses no protection.

2. `rm -rf` before the copy made the staged path vanish mid-build. Qt bakes its
   COOKBOOK_SOURCE into installed cmake files (QtSeparateDebugInfo.cmake
   try_compile()s ${QT_SOURCE_TREE}/config.tests/...), so once that path was the
   staged tree, rebuilding qtbase pulled it out from under consumers:
     CMake Error: The source ".../qtbase/.../source-staged/config.tests/
       binary_for_strip/CMakeLists.txt" does not ...
   (qtsvg and qtshadertools). Now rsync -a --delete refreshes in place: same
   pristine result, but the directory never stops existing. Verified with 4000
   probes across a full kirigami rebuild -- 0 observations of it missing.

Staging is confirmed working: a 26-package run staged 10 trees, skipped relibc,
and left 0 dirty tracked source files (previously 22-29).
2026-08-04 18:10:52 +03:00
vasilito 7ae9646968 qt-sysroot: relink dependency sysroots atomically
redbear_qt_ensure_dep_sysroots repairs OTHER recipes' sysroots, so with
COOKBOOK_COOK_JOBS>1 it runs while a parallel cook is compiling against the
very directory it is relinking. It did `rm -f` then `ln -sf`, leaving a window
where the path did not exist. kirigami died in that window:

  cstdio:47: fatal error:
    .../qtdeclarative/target/.../sysroot/include/stdio.h: No such file

with another cook's `rm -f`/`ln -sf` on qtdeclarative's sysroot interleaved in
the same log.

Now: skip entirely when the link already points at the right target (the
common case, and the cheapest way to stop the churn), otherwise replace via
ln -s to a temp name + `mv -T`, a single rename(2) -- readers see the old link
or the new one, never nothing.

Verified with 300 concurrent relinks against 3000 probes: 0 missing
observations, where the old sequence reproduced the gap.
2026-08-04 17:54:01 +03:00
vasilito a3d9240d62 cook: resolve symlinks before the tracked-source check
redbear-ci / check (push) Has been cancelled
The out-of-tree staging added in 221a91cba4 never actually ran. Recipes are
reached through the overlay path `recipes/<cat>/<name>`, a symlink into
`local/recipes/...`, and `git ls-files --error-unmatch` refuses any pathspec
that traverses a symlink ("pathspec is behind a symbolic link"). The check
therefore reported every tracked vendored tree as untracked, staging was
skipped, and builds went on mutating git-tracked sources -- 22 dirty source
files after a 42-package run.

Canonicalize the path before both the git query and the copy. Verified: the
check fails via the symlink, succeeds via the resolved path, and cooking
kirigami now logs

  [out-of-tree] staged tracked source -> .../kirigami/target/.../source-staged

with the recipe's sed rewriting the staged copy instead of the tracked tree.
2026-08-04 17:50:14 +03:00
vasilito 27ca9bc4b0 relibc: advance submodule for timerfd/signalfd C linkage
Points the relibc submodule at 4e9fbf4c. sys/timerfd.h and sys/signalfd.h
declare their prototypes in the cbindgen trailer, which is emitted outside the
extern "C" block cpp_compat generates, so C++ consumers linked against a
mangled name while relibc exports the plain C symbol:

  alignedtimer.cpp:(.text+0x29a): undefined reference to
      `timerfd_create(int, int)'

(plasma-workspace libclock). C callers were unaffected, which is why it
survived until a C++ consumer appeared.

Also refreshes the tracked-source baseline. This should become largely static
now that cook stages tracked vendored sources out of tree.
2026-08-04 16:49:56 +03:00
vasilito 221a91cba4 build: port libcanberra, gate X11-only KWindowSystem APIs, build out of tree
libcanberra: plasma-workspace calls find_package(Canberra) TYPE REQUIRED and
includes <canberra.h> from four translation units with no HAVE_CANBERRA guard,
one of them libnotificationmanager (the core notification library). It cannot
be made optional, so it is ported for real. Built shared: it dlopens its
backend through libltdl, the libtool recipe stages libltdl.so only (no .a), so
a static build left every consumer with an undefined lt_dlopenext.

Audio is SILENT. Upstream 0.30 offers alsa/oss/pulse/gstreamer/null and none
speak Redox; the pulse driver needs PulseAudio's client library, which PipeWire
does not provide. The null driver is real upstream code, so the API/ABI is
genuine and all consumers work -- but nothing reaches the speakers until a
native /scheme/audio driver exists.

KX11Extras et al: gate the five X11-only KWindowSystem headers behind the
HAVE_X11 that plasma-workspace already defines. X11 is compiled OUT, not added.
gate-kx11extras.py brace-matches each block and keeps any trailing else outside
the guard, since wrapping a whole if/else-if chain yields invalid C++.

check-recipe-escapes.py: a single backslash in a TOML multi-line string is a
TOML escape, so a sed written as \bFoo\b parses to <BS>Foo<BS> and silently
matches nothing -- no TOML error, no sed error. This class bit the tree three
times. Now gated in preflight; it also found openssh, which used an invalid \$
and could not be parsed by any compliant parser.

cook_build.rs: build git-tracked vendored sources OUT OF TREE. Recipe scripts
rewrite their source, so builds were mutating version-controlled files: a
no-op sed became indistinguishable from a working one, and the integrity gate
fired so often that clearing it stopped being protective. Uses
cp -a --reflink=auto, not cp -al: sed -i is link-safe but `cp -f` and `>`
truncate in place and would write through a hard link into the tracked
original. Content hashing still runs against the pristine tree, so hashes now
describe committed state. Escape hatch: REDBEAR_IN_TREE_BUILD=1.
2026-08-04 16:41:39 +03:00
vasilito fd11aa716c feat: port the missing KDE Plasma dependency chain and harden the auth stack
redbear-ci / check (push) Has been cancelled
Unblocks plasma-workspace/plasma-desktop, which required 14 packages that had
no in-tree recipe. Sources are reproducible from each recipe's tar= + blake3;
the vendored source/ trees are deliberately not committed here (212M).

New recipes:
  KF6 6.28.0   kf6-kholidays, kf6-krunner, kf6-kstatusnotifieritem,
               kf6-kunitconversion
  Plasma 6.7.2 knighttime, layer-shell-qt, libkscreen, libksysguard,
               plasma-activities-stats, plasma5support, kscreenlocker
  Qt 6.11.1    qtpositioning, qtspeech, qttools

libksysguard carries P0-redox-process-backend.patch: processes_local_p.cpp
dispatches on platform macros and had no __redox__ arm, so ProcessesLocal was
entirely undefined. Adds a real backend reading /scheme/proc/ps (pid, ppid,
real+effective ids, thread count, state) and /scheme/sys/mem, with kill() for
signals. Upstream's generic fallback is a pure stub and was not used. Absent
facilities (no setpriority/sched_setscheduler/ioprio on a microkernel) report
NotSupported rather than pretending.

Restored, no longer disabled:
  - night colour: kcms/nighttime + kwin's nightlight plugin, now that
    KNightTime/Qt6Positioning/KF6Holidays exist
  - KIO FileWidgets (file dialog, places model), wrongly swept in with the
    unportable kiod/kssld/kioworkers subdirs
  - kf6-ktexteditor text-to-speech: removes a disguised stub that rewrote
    speechEngine() to return nullptr and mangled call sites into invalid C++
  - kwin KWIN_BUILD_SCREENLOCKER=ON (needs kscreenlocker; see below)

Toolchain and recipe fixes:
  - redox-toolchain.cmake: append -lgcc. __extendhfsf2/__extendbfsf2 are
    global in libgcc.a but hidden in libgcc_s.so (the Redox libgcc version map
    stops at GCC_7.0.0 and never emits the GCC_12/13 nodes upstream exports),
    and GCC omits -lgcc for -shared, so no C++23 shared library using
    std::format<_Float16|bfloat16_t> could link.
  - qtmultimedia: rewrite /usr/src/.../meta_types paths and stage metatypes,
    so consumers using qt_internal_add_qml_module can configure.
  - qtspeech: qtmultimedia is mandatory, not optional -- upstream return()s
    with only a NOTICE without it, yielding a green build over an empty
    package. Asserts its own output so that cannot recur.
  - narrow Linux-only guards with AND NOT REDOX where the toolchain sets
    CMAKE_SYSTEM_NAME=Linux purely to get UNIX=TRUE (kio LibMount,
    libksysguard NL/Sensors, plasma-workspace NetworkManagerQt).
  - drop REQUIRED components that are declared but referenced nowhere
    (Location, QCoro6, Qt6 Test) -- verified by exhaustive grep.
  - DESTDIR installs where KDE emits absolute KDE_INSTALL_FULL_* paths that
    --prefix cannot re-root, which otherwise write into the build host.

Auth stack:
  - pam-redbear: add PAM_MODULE_UNKNOWN (28), missing from both the header and
    lib.rs; realign 30/31 to Linux-PAM's PAM_CONV_AGAIN/PAM_INCOMPLETE, which
    previously held Red Bear-only names on standard values, so anything built
    against stock PAM headers mis-decoded them.
  - redbear-authd: support yescrypt ($y$ -- the default shadow format on
    current Debian/Ubuntu/Fedora, previously an unexplained login failure),
    bcrypt and md5-crypt. Plaintext shadow entries now require the
    /etc/redbear/allow-plaintext-passwords sentinel and warn on every use,
    instead of being compared silently. 19/19 host tests pass.

Build-system hardening:
  - verify-tracked-sources.sh, wired into preflight: fails on deletion of any
    tracked vendored source, and on modifications with no baseline entry.
    local/sources/ had a dirty gate and version checks; local/recipes/*/source/
    had none, which allowed an rm -rf to delete 7958 tracked files and a
    pristine re-extract to silently overwrite committed fixes (kwin's
    std::expected/vulkan-hpp and X11 gating, kio's Q_OS_REDOX resolver guards).
  - validate-source-trees.py: resolve recipe.toml through the overlay symlink;
    it reported false MISSING for symlinked recipes.
  - test-sddm-virgl-qemu.sh: the null-proxy check used report(), which PASSES
    on regex match -- so the known Qt6 Wayland null+8 fault would report PASS
    when present. Added report_absent().

kscreenlocker builds only its cmake-level Wayland-only changes so far; the
C++ X11 removal (61 call sites) is not yet applied, so kwin's screenlocker
flag is blocked on it.
2026-08-04 10:06:39 +03:00
vasilito e4a44377fb libdisplay-info: replace the stub with upstream 0.4.0
redbear-ci / check (push) Has been cancelled
The recipe was not building libdisplay-info. It synthesized its own
meson.build declaring `version: '0.2.3'` and compiled a hand-written
stub: one di.c and four headers, 518 lines, 20 exported functions.

0.2.3 does not exist upstream -- the tags are 0.1.0, 0.1.1, 0.2.0, 0.3.0
and 0.4.0. That fabricated version satisfied kwin's

    pkg_check_modules(libdisplayinfo REQUIRED IMPORTED_TARGET libdisplay-info>=0.2.0)

so kwin configured cleanly and then failed to compile utils/edid.cpp on
di_info_get_default_color_primaries, di_info_get_hdr_static_metadata,
di_info_get_supported_signal_colorimetry and di_edid_display_descriptor.
A version gate satisfied by a declaration rather than an implementation.

Now vendors upstream 0.4.0 (gitlab.freedesktop.org/emersion/libdisplay-info):
14 C files, 10898 lines, 10 headers, 94 exported symbols. 0.4.0 rather than
0.2.0 because the colorimetry and HDR static metadata accessors kwin needs
post-date the 0.2.x series -- and they feed the real colour-primaries and
HDR path of the display stack, so a stub returning NULL would have been
wrong at runtime even if it had compiled.

Red Bear delta is one hunk in source/meson.build: the unconditional
subdir('di-edid-decode') and subdir('test') are commented out. Both build
auxiliary executables and a shell test harness that are not part of the
runtime and do not cross-compile for Redox. Library, headers and
pkg-config are untouched.

Verified: builds clean, stages libdisplay-info.so.0.4.0 with all four
symbols kwin needs, pkg-config reports 0.4.0, and kwin's utils/edid.cpp
now compiles.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-03 22:19:38 +03:00
vasilito d1e8202958 fix: kwin's remaining GCC 16 / vulkan-hpp and X11-gating fallout
redbear-ci / check (push) Has been cancelled
Continues the previous kwin commit; all found by compiling further.

vulkan-hpp (VULKAN_HPP_RAII_NO_EXCEPTIONS, now active because GCC 16's
libstdc++ provides __cpp_lib_expected at C++23):

  - vulkan_device.cpp getQueue() returns CreateReturnType<Queue>, an
    expected, not a Queue -- unwrapped via splitResult().
  - CommandBuffer::begin/end, bindImageMemory2, importSemaphoreFdKHR and
    Queue::submit return void, not vk::Result. They route their Result
    through detail::resultCheck -> VULKAN_HPP_ASSERT_ON_RESULT, which this
    build defines to `void`, so the status is discarded by configuration.
    Assigning them to vk::Result no longer compiles. Noted at each site;
    the eErrorDeviceLost branch after Queue::submit is now unreachable.
  - mapMemory() returns void* and needed wrapping.
  - QueryPool::getResults already returns a decomposable std::pair, so
    splitResult() had double-wrapped it; unwrapped.

X11 gating -- KWIN_BUILD_X11=OFF is set correctly by the recipe, but
several includes sit outside the guard their own uses are inside:

  - workspace.cpp included syncalarmx11filter.h unguarded (both uses and
    the workspace.h member are guarded).
  - shadow.h declared readX11ShadowProperty(xcb_window_t) unguarded while
    shadow.cpp guards the definition.
  - effecthandler.h declared unique_ptr<WindowPropertyNotifyX11Filter>
    unguarded; with X11 off the type is only forward-declared and
    ~unique_ptr needs it complete.

Missing includes, same shape as earlier findings -- the declaration exists,
it just never reaches the compiler:

  - tabletmodemanager.cpp and backends/libinput/device.cpp call udev_device_*
    without including <libudev.h>, which upstream gets transitively through
    libinput.h. Ours does not pull it in.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-03 22:06:09 +03:00
vasilito 19e91d6803 fix: depend on libxkbcommon in qtbase and kwin
redbear-ci / check (push) Has been cancelled
qtbase configured with QT_FEATURE_xkbcommon=OFF because libxkbcommon was
never staged into its sysroot -- the recipe existed but nothing depended
on it. With the feature off, qtbase does not install
QtGui/private/qxkbcommon_p.h (src/gui/CMakeLists.txt:1095 is conditional
on it), so kwin's inputmethod.cpp failed with

    inputmethod.cpp:51: fatal error: private/qxkbcommon_p.h: No such file

kwin also includes <xkbcommon/xkbcommon-keysyms.h> directly while
declaring no such dependency, relying on it arriving transitively; that
is now explicit.

Another latent gap rather than GCC 16 fallout -- it only surfaced once
kwin compiled far enough to reach this include.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-03 21:26:11 +03:00
vasilito d6c3c95628 fix: kwin's Vulkan backend for C++23 std::expected, and two unguarded X11 includes
vulkan-hpp switches every vk::raii create/enumerate/get return from the
decomposable vk::ResultValue to VULKAN_HPP_EXPECTED once
VULKAN_HPP_NO_EXCEPTIONS is set (kwin does, src/CMakeLists.txt) and the
standard library provides __cpp_lib_expected at C++23. GCC 16's libstdc++
has it and GCC 13's did not, so the toolchain upgrade silently changed the
API shape under kwin 6.7.2 and 20 call sites stopped compiling with
"cannot decompose class type 'std::expected<...>'".

There is no ResultValue path left to fall back to: vulkan_raii.hpp with
NO_EXCEPTIONS but no expected emits calls to throwResultException, which
NO_EXCEPTIONS compiles out. Declining the switch is not available.

So splitResult() (src/vulkan/vulkan_result_compat.h) restores the
(result, value) pair those sites are written against, and each site is
wrapped mechanically. The surrounding control flow stays exactly as
upstream wrote it rather than being rewritten around a different idiom.
Not every such call is still fallible in this header revision, so the
helper also passes plain payloads through paired with eSuccess.

Separately, two X11-only includes were never guarded, and only showed up
now because no xcb headers are staged for Redox:

  - effect/effecthandler.cpp included window_property_notify_x11_filter.h
    unguarded while every *use* of that type sits inside #if KWIN_BUILD_X11,
    and x11window.h two lines below is guarded. A plain upstream oversight.
  - screenedge.h included <xcb/xcb.h> while referencing no xcb_* type at all.

Both now use KWIN_BUILD_X11, matching the file's own idiom.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-03 21:24:57 +03:00
vasilito 32e7c5d259 kirigami: restore the missing patch symlink
The recipe lists 02-qnetwork-real-implementation.patch, but the symlink
into the recipe directory was absent, so fetch failed outright:

    repo: failed to fetch: Failed to find patch file
    "recipes/kde/kirigami/02-qnetwork-real-implementation.patch"

The patch itself was never lost -- it is in local/patches/kirigami/ and
its content is already applied in the vendored source (icon.cpp carries
the QNetworkAccessManager work). Only the link was missing, because
recipes/**/*.patch is gitignored and this one was never force-added, so a
clean checkout could not resolve it.

Force-added, as done for the other patch symlinks this session. Swept the
rest of local/recipes for the same defect: no others.

kirigami cooks clean. The vendored source tree (493 tracked files) was
left untouched, per local/AGENTS.md LOCAL RECIPE SOURCE IMMUTABILITY.
2026-08-03 20:47:07 +03:00
vasilito 5dfaaeb79f release: bump relibc for the _setjmp/_longjmp declarations 2026-08-03 20:25:44 +03:00
vasilito 45696b918b git: re-port git.patch onto 2.55.0
The patch was written against git 2.13.1 (2017) while the recipe fetches
2.55.0 — eight years of drift, seven of eight files rejecting. Rebased by
applying what still fit, hand-porting every reject against the current
source, and regenerating the whole patch from a pristine-vs-ported diff so
it is a coherent 2.55.0 patch rather than a 2.13 patch with fixups.

Per file, preserving the original Redox intent:
  compat/bswap.h      <machine/endian.h> for ntohl/htonl
  compat/terminal.c   __redox__ git_terminal_prompt branch; the file was
                      restructured, so it now precedes the generic #else
  configure           NO_IPV6=YesPlease
  daemon.c            logreport is a switch over LOG_DESTINATION_* in
                      2.55.0; guard the syslog arm and openlog instead of
                      the old if/else
  git-compat-util.h   SIG_DFL/SIG_IGN/SIG_ERR fallbacks
  Makefile            EXTLIBS=-lnghttp2; drop the three hardlink fallbacks
  run-command.c       dup_devnull is gone in 2.55.0; the four /dev/null
                      opens it replaced now use DEV_NULL directly
  setup.c             sanitize_stdfds uses xopen/xdup, which die
                      internally, so the old die_errno hunk is obsolete

Applies at --fuzz=0 with zero rejects across all eight files.

Also ac_cv_iconv_omits_bom=no: the 'iconv omits bom for utf-16 and
utf-32' probe is a RUN test and cannot execute while cross compiling.
Same mechanism as the neighbouring ac_cv_fread_reads_directories and
ac_cv_snprintf_returns_bogus entries.

One trap worth recording: a blanket '*.orig' cleanup before regenerating
the diff silently deleted t/t4256/1/mailinfo.c.orig, a real git test
fixture, which would have shipped as a deletion in the patch. Restored.
2026-08-03 20:16:12 +03:00
vasilito 22f8849007 git: rebase the setup.c hunks onto 2.55.0 (patch still needs a full re-port)
git.patch is written against git 2.13.1 (2017); the recipe fetches 2.55.0.
The setup.c hunks were the first to fail, so the build stopped there.

Rebased them. 2.55.0 rewrote sanitize_stdfds() to use xopen/xdup, which
die internally, so the old die_errno hunk is obsolete and the rebase is
smaller than the original:
  - xopen("/dev/null", O_RDWR) -> xopen(DEV_NULL, O_RDWR)
  - #if !defined(__redox__) around setsid()
Both preserve the original Redox intent: scheme paths instead of
/dev/null, and no setsid() on Redox.

This does NOT make git build. With setup.c applying, the patch runs
further and six more files turn out to have drifted over the same eight
years:

    compat/bswap.h        1/1 hunk
    compat/terminal.c     1/1
    configure             1/1
    daemon.c              2/4
    git-compat-util.h     1/2
    Makefile              1/1
    run-command.c         1/1

git-compat-util.h matters most: it is where DEV_NULL is defined, so the
setup.c change above depends on that hunk being re-ported too.

An eight-year, 2.13 -> 2.55 span is a re-port, not a hunk rebase, and
PATCH-GOVERNANCE.md is explicit that the patch is rebased rather than
dropped. Committing this piece so it is not lost and the remaining scope
is written down.
2026-08-03 20:09:10 +03:00
vasilito 5e5251cc95 binutils-native: drop the gcc13 dependency
gcc13 was still being built despite gcc-native/rust-native being
deferred, and it failed the whole build: binutils-native pulled it
transitively. It is the same dependency pattern already removed from
gcc-native -- what the recipe actually needs is a cross compiler, and
that comes from the prefix toolchain on PATH
(x86_64-unknown-redox-gcc, now 16.1.0), not from a cooked gcc13 package.

Keeping it meant building GCC 13 with GCC 16, which does not work: the
host link fails with the libstdc++ 128-bit float helpers unresolved
(__eqtf2/__getf2/__gttf2/__letf2/__unordtf2 against
/usr/lib/gcc/x86_64-pc-linux-gnu/16/libstdc++.so), a host/target libgcc
leak, and beyond that GCC 16 ICEs on GCC 13's libsupc++. See
local/docs/NATIVE-TOOLCHAIN-WORKSTREAM.md.

binutils-native cooks clean without it.
2026-08-03 19:56:36 +03:00
vasilito c2fc7dd973 docs: record the deferred native-toolchain workstream
redbear-ci / check (push) Has been cancelled
The config comment referencing this file was dangling. Captures the
twelve gcc-native and four rust-native findings so the work is not lost:
the GCC 13 -> 16 move and why (char8_t, libcody's C++11-only probe, the
cpuid macros GCC 15/16 removed, then an ICE), the stale same_as symlink,
the gnu17 exemption, the missing relibc dependency, the getopt.h
shadowing, and the fnmatch extensions implemented in the fork.

Records two things explicitly because they are easy to get wrong again:

- The old 'Redox C++/pthread header gaps' justification was false.
  llvm-native cooks clean in isolation; it only failed in parallel builds
  because of a cookbook race on shared staging paths. A build-system bug
  had been misdiagnosed as a porting gap and used to exclude a required
  package.

- My own 'relibc fenv.h is a stub' diagnosis was also false. relibc
  delegates to openlibm_fenv.h which defines both types; the header just
  was not reaching the sysroot. Generalised into a rule: an undeclared
  identifier against relibc is more often a header-path problem than a
  missing implementation.

Also notes the exact stopping point (host libstdc++ headers leaking into
a target compile), the re-enable procedure, and the advice to diagnose
with COOKBOOK_COOK_JOBS=1 since several wrong turns came from attributing
one recipe's error to another in the interleaved parallel log.
2026-08-03 19:44:49 +03:00
vasilito cdb8f39661 release: reconcile syscall with origin; defer the native toolchain
syscall
  submodule/syscall had diverged from origin -- 18 local commits against
  19 on the remote, with matching subjects and different SHAs, i.e. the
  local branch had been rewritten at some point. Rather than force-push
  and discard 19 published commits, rebased local onto
  origin/submodule/syscall. git absorbed 16 duplicates by patch-id,
  leaving two genuinely local commits (NUMA support, which origin does
  not have at all, and the 0.3.2 version bump).

  Verified no work was lost: the rebased tree is byte-for-byte identical
  to the pre-rebase state apart from the Cargo.toml version line, and a
  backup/pre-rebase-* branch is kept. Two Cargo.toml conflicts were
  version-label collisions only, resolved to 0.9.1+rb0.3.1 mid-series and
  0.9.1+rb0.3.2 at the tip, per the Cat 2 convention. The push is now a
  fast-forward and the gitlink is updated to the rebased SHA.

native toolchain
  gcc-native and rust-native set to "ignore" -- explicit operator
  decision, 2026-08-03: 'Treat gcc-native/rust-native as a separate
  workstream, explicitly deferred by me, for now.' That is the one
  condition AGENTS.md ABSOLUTE RULE permits an exclusion under. It is not
  an agent-initiated removal, and not a repeat of the 'not needed for
  greeter proof' hand-wave that previously hid real breakage -- that
  suppression was reverted first, which is how the defects were found.

  binutils-native and llvm-native stay in the target; llvm-native is
  required for libclc and Mesa's iris/radeonsi CLC path. The recipes for
  the deferred pair are fixed and committed, not reverted.
2026-08-03 19:41:49 +03:00
vasilito 472a58e001 gcc-native: repoint the source symlink at the GCC 16 tree
Follows the recipe's [source] move from same_as gcc13 to
path = "../gcc16/source". The old symlink pointed at
recipes/dev/gcc13/source and survived the recipe edit, which is why the
first GCC 16 build attempt was still compiling GCC 13 sources.
2026-08-03 19:36:07 +03:00
vasilito d9b408d7de gcc-native: put GCC's own include/ ahead of the sysroot for getopt.h
libiberty compiles getopt1.c against GCC's include/getopt.h, which
declares the GNU-internal _getopt_internal. relibc ships a getopt.h that
does not declare it and was shadowing GCC's:

    getopt1.c:71: error: implicit declaration of function
    '_getopt_internal'

Same shape as the cpuid.h shadowing already handled in recipes/dev/gcc13.
Verified: _getopt_internal errors 5 -> 0.

STILL FAILING, on a new and different phase: the HOST libstdc++ headers
are being pulled into the build --

    /usr/include/c++/16/x86_64-pc-linux-gnu/bits/os_defines.h:44:
    error: missing binary operator before token '('

which is __GLIBC_PREREQ evaluated where there is no glibc. That is a
host/target header leak, not a continuation of the getopt problem, and it
is unrelated to this commit's change.
2026-08-03 19:15:20 +03:00
vasilito f4363142b1 gcc-native: restore relibc headers to the sysroot; bump relibc for fnmatch
Two corrections.

relibc dependency restored. Dropping gcc13 from gcc-native's deps also
removed what transitively staged relibc's headers, leaving the sysroot
with no libc headers at all -- no fenv.h, so libstdc++'s <cfenv> failed
with 'fenv_t has not been declared in ::'.

That corrects my earlier diagnosis: relibc's fenv.h is NOT a stub. It
delegates to openlibm_fenv.h, which dispatches on __x86_64__ to
openlibm_fenv_amd64.h where fenv_t and fexcept_t are both defined, and
relibc stages all of those headers. The header was simply never reaching
this recipe's sysroot. The previous commit message asserting a relibc
fenv gap was wrong.

relibc gitlink bumped for the fnmatch commit, which adds the GNU
FNM_FILE_NAME and FNM_LEADING_DIR that GCC 16's libiberty needs.
2026-08-03 19:06:41 +03:00
vasilito 4446e287ae gcc-native: move onto GCC 16.1.0; blocked on relibc's fenv.h stub
Repointed [source] from the gcc13 recipe to the Redox-ported GCC 16 tree
(local/recipes/dev/gcc16/source, upstream 16.1.0 + gcc-redox-port), which
is what produced the working cross toolchain in prefix/.

Building GCC 13 with the GCC 16 cross compiler was not a supported
configuration and each fix only revealed the next incompatibility -- a
C++11 pin for libcody, GCC 13's cpuid.h shadowing the toolchain's after
GCC 15/16 removed the withdrawn AVX512PF/ER/4VNNIW/4FMAPS and PREFETCHWT1
macros, and finally an ICE in gimple_build_eh_must_not_throw compiling
libsupc++. All three are gone on GCC 16: ICE 0, char8_t 0, cpuid 0.

Also fixed here:
- The stale same_as symlink (source -> recipes/dev/gcc13/source) survived
  the recipe edit and kept feeding GCC 13 sources to the build. Removed.
- gcc13/gcc13.cxx dropped from dependencies: they build the compiler this
  recipe no longer uses. The cross compiler comes from the prefix on PATH.
- Exempted from the tree-wide -std=gnu17 pin. That pin exists for the
  C17-era recipes, but GCC 16's own sources are C23 and use `bool` as a
  keyword: gcc/config/i386/i386.h:1722: unknown type name 'bool'.
- [package].version set explicitly -- same_as used to supply it, and a
  path source leaves the cookbook nothing to infer from.
- Version-globbed the hardcoded 13.2.0 libgcc copy paths.

BLOCKED on a genuine relibc gap. libstdc++'s <cfenv> does
    using ::fenv_t;   using ::fexcept_t;
but relibc's fenv.h is a 3-line stub defining neither, so
libstdc++-v3/include/fenv.h fails. fenv.h is a C99/POSIX header owed
fenv_t, fexcept_t, the FE_* macros and the fe* functions. Implementing it
in the relibc fork is the fix -- per LOCAL-FORK-SUPREMACY-POLICY.md Rule 2
the fork must be complete -- and is real work, not a flag.
2026-08-03 18:58:45 +03:00
vasilito 93a0433770 gcc13: three real GCC-16-as-bootstrap fixes; blocked on a compiler ICE
Three defects found and fixed, each verified to go to zero:

1. libcody C++ standard. Its configure contains
       #if __cplusplus > 201103
       #error "C++11 is required"
   so anything newer than C++11 is rejected outright. My earlier
   -std=gnu++17 tripped exactly this -- the 'C++11 is required' failure
   came from build/libcody/config.log, not from a missing libstdc++ as
   the previous commit assumed. C++11 also fixes the original problem:
   char8_t arrived in C++20, so under C++11 u8"" is still const char[].
   char8_t diagnostics: 100+ -> 0.

2. libcody is compiled by the CROSS compiler, not the host one --
       x86_64-unknown-redox-g++ ... -c -o buffer.o .../libcody/buffer.cc
   because --host is the Redox target. So plain CXXFLAGS is the right
   knob, scoped to this branch; the freestanding branch must keep the
   compiler defaults.

3. libgcc's cpuinfo.c needs CPUID bit macros from <cpuid.h>. Built by
   GCC 16 that resolves to GCC 16's header, and GCC 15/16 REMOVED the
   macros for the withdrawn AVX512PF/ER/4VNNIW/4FMAPS and PREFETCHWT1
   extensions. GCC 13 ships its own cpuid.h that still defines them, so
   its config dir now precedes the toolchain include path for target
   compiles. Undeclared-bit errors: 5 -> 0.

BLOCKED, and not by a flag. GCC 16 now ICEs compiling GCC 13's own
libstdc++:

    libstdc++-v3/libsupc++/eh_call.cc:39:1: internal compiler error:
    in gimple_build_eh_must_not_throw

Each fix has revealed the next incompatibility; an ICE is where
flag-tweaking stops being the answer. Building GCC 13 with GCC 16 is
three major versions of drift and is not a supported configuration.

The coherent fix is to move gcc-native onto GCC 16, which is the whole
point of the port in local/patches/gcc-redox-port/ -- local/recipes/dev/
gcc16/source is already ported and is what produced the working cross
toolchain. That is an operator-level decision, so it is not taken here.
2026-08-03 18:50:01 +03:00
vasilito deca6a6820 gcc13: scope -std=gnu++17 to the target branch (char8_t fixed; probe still open)
libcody is compiled by the CROSS compiler, not the host one -- the build
log shows
    x86_64-unknown-redox-g++ ... -c -o buffer.o .../libcody/buffer.cc
because --host is the Redox target. So plain CXXFLAGS is the right knob,
not CXXFLAGS_FOR_BUILD as the previous commit assumed. Scoped to the
gcc-native branch only.

Verified: char8_t errors go 100+ -> 0.

STILL OPEN. With CXXFLAGS set, the top-level configure now fails its
build-side probe:
    checking whether gcc accepts -g... no
    configure: error: C++11 is required
The two states are exclusive as things stand:
  - CXXFLAGS carrying -std=gnu++17  -> char8_t fixed, C++11 probe fails
  - CXXFLAGS without it             -> probe passes, char8_t fails
so something in the exported CXXFLAGS is unacceptable to the HOST gcc
that configure probes (the cookbook adds -fno-hardened -DHAVE_ALLOCA_H=1
-fPIC alongside a target -I). The recipe unsets CFLAGS/CPPFLAGS/LDFLAGS
for this branch but leaves CXXFLAGS set, which is the likely culprit --
the next step is to give the build-side compiler its own clean flags
rather than inheriting the target's.
2026-08-03 18:31:03 +03:00
vasilito f02504b863 libc: apply the Cat 2 version convention to the vendored fork
version = "0.2.189" -> "0.2.189+rb0.3.2", per local/AGENTS.md
"Version conventions": every Cat 2 fork is <upstream>+rb<branch>. The
label is what makes the fork traceable to both its upstream base and the
Red Bear branch it was built for.

+rb is build metadata, which semver ignores when matching, so ^0.2
requirements still resolve to the fork -- confirmed, the rust lockfile now
reads libc v0.2.189+rb0.3.2 from the path source. A -rb suffix would be
read as a pre-release and would NOT satisfy them, which is exactly why the
project mandates +rb.

Two things this surfaced:

- fork-upstream-map: libc moved from snapshot to diverged. The fork is
  vendored from the crates.io PACKAGE, whose file set differs from the
  upstream git tag by construction (no .github/, adds
  .cargo_vcs_info.json), so a tag content-diff reported differences that
  mean nothing -- 'missing files that exist in upstream' for files the
  package never ships. diverged states the real relationship.

- local/recipes/dev/gcc16/.vendored-upstream added. Extracting GCC 16.1.0
  put upstream's vendored Rust crates under local/recipes/*/source/, so
  sync-versions.sh treated datafrog/log/polonius-engine as Cat 1 in-house
  crates and wanted to stamp them 0.3.2. The marker is the documented
  escape hatch (BUILD-SYSTEM.md section 7).

Both gates clean: verify-fork-versions reports no violations,
sync-versions --check reports no gcc16 drift.
2026-08-03 18:20:06 +03:00
vasilito 09ba5201f4 libc: wire the vendored fork into the fork machinery
The fork was an unmapped tree -- verify-fork-versions.sh reported
'libc NOT-MAPPED'. Register it properly so it is governed like every other
Cat 2 fork rather than sitting outside the checks:

- local/fork-upstream-map.toml: libc -> rust-lang/libc 0.2.189, snapshot
  mode (vendored from the registry, so its history is unrelated to
  upstream's), with the temporary status noted inline.
- verify-fork-versions.sh: src/unix/redox/mod.rs added to the declarative
  expected-differ list, so the content check keeps verifying the rest of
  the tree instead of being blanket-skipped.
- local/docs/VENDORED-LIBC-FORK.md: what the fork adds, the relibc source
  and evidence for every symbol, why the values come from relibc rather
  than Linux (Redox's idtype_t is c_int where glibc uses an enum), and a
  five-step retirement procedure.
- local/AGENTS.md: listed in the fork table, marked temporary.

Kept vendored for as long as it is required. The gap is upstream-
reportable and belongs in the libc crate.
2026-08-03 18:08:24 +03:00
vasilito 88b4d06ec2 libc: vendor a Redox-complete fork for waitid/CLD_*/P_*
local/sources/libc is libc 0.2.189 with src/unix/redox/mod.rs extended to
expose the waitid surface relibc already implements:

  - idtype_t (= c_int, as relibc defines it)
  - P_ALL / P_PID / P_PGID
  - CLD_EXITED / KILLED / DUMPED / TRAPPED / STOPPED / CONTINUED
  - extern fn waitid(idtype_t, id_t, *mut siginfo_t, c_int) -> c_int

All of it is real in relibc -- src/header/sys_wait/mod.rs defines the
types and constants, and `nm libc.a` shows `T waitid` -- but the libc
crate's Redox bindings never exposed any of it, and still do not as of
0.2.189. Any crate calling waitid therefore cannot build for
x86_64-unknown-redox:

  error[E0531]: cannot find unit struct, unit variant or constant
                `CLD_EXITED` in crate `libc`

which breaks nix, and through it ctrlc and rustc's bootstrap tooling --
the last thing blocking rust-native.

Values and types come from relibc, not from Linux. Every non-Redox target
is byte-for-byte upstream 0.2.189, so host builds are unaffected. Wired
into the rust workspace via [patch.crates-io]; the fork type-checks for
x86_64-unknown-redox.

Upstream-reportable: this gap belongs in the libc crate.
2026-08-03 18:02:32 +03:00
vasilito 8218c3f5d1 gcc13: scope -std=gnu++17 to the build-side compiler only
Putting it in plain CXXFLAGS also handed it to the Redox cross g++, whose
C++ probe then failed during the freestanding stage, before libstdc++
exists:

    configure: error: C++11 is required

libcody -- where the char8_t failures occur -- is compiled by
CXX_FOR_BUILD (the host g++ 16), so CXXFLAGS_FOR_BUILD is the correct
knob and the cross compiler is left alone.
2026-08-03 17:44:19 +03:00
vasilito 96da04403d rust-native: depend on llvm-native.dev for the LLVM headers
rustc_llvm compiles llvm-wrapper/*.cpp, which include
"llvm/Config/llvm-config.h". Those headers ship in the .dev package, and
rust-native listed only llvm-native and llvm-native.runtime, so the build
failed with

  LLVMWrapper.h:6:10: fatal error: llvm/Config/llvm-config.h:
  No such file or directory

even though the header was staged at
llvm-native/target/<triple>/stage.dev/usr/include/. recipes/dev/rust
declares the equivalent llvm21.dev for the same reason.

Latent because rust-native was commented out of the config and had never
been built.
2026-08-03 17:19:42 +03:00
vasilito c7bca65088 gcc13, rust: fix C++20 char8_t and the nix/libc type mismatch
gcc13
  The host compiler is now GCC 16, which defaults to C++20
  (__cplusplus 202002L). C++20 changed u8"" literals from const char[] to
  const char8_t[], and GCC 13's libcody -- its module mapper -- uses them
  throughout, so the build collapsed with ~100 diagnostics like
      error: invalid conversion from 'const char8_t*' to 'const char*'
  in libcody/{buffer,client,server}.cc. GCC 13's sources are C++17; build
  them at that standard. Not a workaround -- it is the dialect this
  release was written against.

rust / rust-native
  nix 0.30.1 is incompatible with the resolved libc 0.2.178: it declares
  type SaFlags_t = libc::c_ulong while libc now has sigaction.sa_flags and
  the SA_* constants as c_int, so rustc's bootstrap tooling failed with
      error[E0308]: expected `u64`, found `i32`  nix/src/macros.rs:72
      error[E0308]: expected `i32`, found `u64`  nix/src/sys/signal.rs:808
  nix 0.31 fixed it by flipping the default to c_int. ctrlc moves itself
  (3.5 requires nix "0.31"), but in-tree miri pinned 0.30.1 and kept the
  broken version in the graph, so both are moved forward -- update and
  adapt rather than pinning libc back, per the
  Most-recent-upstream-when-building rule. Both crates were already in the
  offline registry cache.

These surfaced only because gcc-native/rust-native were restored to the
config; neither had been building.
2026-08-03 17:12:16 +03:00
vasilito 46abc404a2 libinput, linux-kpi, iwlwifi: remove a shadowing header, add missing prototypes
Three defects that were latent until GCC 14+ made implicit declarations
and pointer-type mismatches errors. None was a missing implementation --
in every case the code existed and only the declaration was wrong.

libinput
  Carried its own bundled libudev.h that shadowed the real one from the
  libudev recipe, which it already declares as a dependency. The bundled
  copy lacked udev_device_get_sysattr_value(), so udev/libinput-device-
  group.c got an implicit declaration and then an int-to-pointer
  assignment. The real header is a strict superset -- nothing is declared
  in the bundled copy that the real one lacks -- so the bundled file is
  dead code that shadows a real implementation, which
  LOCAL-FORK-SUPREMACY-POLICY.md Rule 4 requires removing.

linux-kpi
  ieee80211_register_rx_handler() is fully implemented in
  src/rust_impl/mac80211.rs as #[no_mangle] extern "C", and
  ieee80211_rx_drain()'s own doc comment refers to it, but it was never
  declared in c_headers/net/mac80211.h. Declared it.

redbear-iwlwifi
  - rb_iwlwifi_bridge_register_rx() is used ~1800 lines before its
    definition with no forward declaration. Added one at file scope.
  - bridge_rx_callback was declared here as taking void *hw, while its
    Rust definition in src/bridge/callback.rs takes *mut Ieee80211Hw and
    linux-kpi's RxCallback type expects struct ieee80211_hw *. The C
    declaration was simply wrong; corrected to match the implementation.

All three cook clean.
2026-08-03 16:28:40 +03:00
vasilito af03420bcc libpng, zsh: two more GCC 14+ strictness regressions
libpng
  contrib/libtests/pngvalid.c calls feenableexcept(), a glibc extension
  relibc does not provide, and GCC 14+ makes the implicit declaration an
  error. It is a test program, so build it the way AGENTS.md
  § CONVENTIONS already prescribes for cross builds -- '--disable-tests'.
  The library is unaffected; only check_PROGRAMS is skipped, and those
  binaries cannot run on the build host regardless.

zsh
  zsh 5.9 probes for the termcap symbol arrays with
      char **test = boolcodes; puts(*test);
  and ncurses declares boolcodes as 'const char * const *'. GCC 14
  promoted -Wincompatible-pointer-types to an error, so the probe stopped
  compiling, configure concluded boolcodes=no, HAVE_BOOLCODES was left
  undefined, and Src/Modules/termcap.c fell back to defining its own
  array -- colliding with the header:
      termcap.c:45: error: conflicting types for 'boolcodes'
  The probe uses a bare shell variable, not an ac_cv_ cache entry, so
  there is nothing to override; restoring the pre-GCC-14 severity is what
  lets it reach the right answer. Scoped to this recipe so the rest of the
  tree keeps the stricter default.

Both cook clean.
2026-08-03 16:15:17 +03:00
vasilito d55deaa420 build: declare HAVE_ALLOCA_H; route netutils through the local forks
uutils / onig_sys
  oniguruma guards its alloca.h include on the autoconf macro:
      #if defined(HAVE_ALLOCA_H)
      # include <alloca.h>
      #endif
  onig_sys is compiled by the `cc` crate, so no configure ever runs and
  nothing defines it. Under GCC 14+ the resulting implicit declaration is
  an error, so uutils failed at
      regint.h:271: error: implicit declaration of function 'alloca'
  relibc does ship <alloca.h>, so declare it in the cookbook's C flags.
  This asserts a fact about the sysroot rather than silencing a warning,
  and is what a cross-build environment is expected to supply for sources
  that have no configure step. Packages whose own configure defines it to
  1 are unaffected -- identical redefinitions are not diagnosed.

netutils
  Declares `libredox = "0.1"`, a version string, so cargo resolved
  libredox and its transitive redox_syscall from crates.io instead of the
  forks. With the forks now at 0.1.19 / 0.9.1 the crates.io side is not in
  the offline cache and the build died with
      failed to download `redox_syscall v0.9.0`
      Caused by: attempting to make an HTTP request, but --offline was
      specified
  local/AGENTS.md 'Local fork dependency rule (ABSOLUTE)' prohibits
  version strings for crates that have a local fork, for exactly this
  reason -- a second copy of the crate in the graph gives mismatched
  types, and offline builds cannot resolve it at all. [patch.crates-io]
  now redirects the direct and transitive resolutions onto the forks.

Both cook clean.
2026-08-03 16:03:17 +03:00
vasilito 893f98a2cf build: cancel -fhardened; fix termcap for GCC 16; regenerate pam-redbear lock
Three GCC 16 gaps found by the redbear-full build.

-fhardened (seatd and other meson recipes, 24 errors)
  -fhardened is a host-glibc hardening bundle x86_64-unknown-redox cannot
  implement, but GCC accepts it on the command line, so meson's
  cc.has_argument('-fhardened') probe answers YES and meson adds it to
  every compile. GCC then refuses it for real:
    cc1: error: '-fhardened' not supported for this target [-Werror]
  Note the tag is [-Werror], not [-Werror=hardened] -- it is an
  unconditional warning, so -Wno-hardened does not silence it (tried, and
  it did not). The flag has to be cancelled instead; -fno-hardened does
  that cleanly and the cookbook's flags are appended after the project's
  own, so it wins. Nothing is weakened: the compiler is telling us the
  option is inert on this target.

termcap (two independent defects, both latent until now)
  1. Makefile.in hardcoded 'CFLAGS = -g' and has no @CFLAGS@ substitution
     at all, so nothing configure resolved ever reached the compiler --
     including the toolchain's default C dialect. termcap is pre-ANSI
     code, so being compiled as GCC 16's default C23 failed at once with
     'too many arguments to function malloc; expected 0, have 1'.
     Substituting @CFLAGS@ is what a normal autotools Makefile.in does.
  2. With CFLAGS flowing, the remaining errors were implicit declarations
     of strlen/memcpy/exit/write, which GCC 14+ makes errors regardless of
     -std. Cause: autoconf 2.70+ removed AC_HEADER_STDC, so STDC_HEADERS
     is never defined and termcap.c/tparam.c took their pre-ANSI branch,
     declaring 'char *malloc ();' instead of including <stdlib.h>.
     Autoconf's guidance on dropping AC_HEADER_STDC is to assume those
     headers exist, which holds for every target Red Bear builds.

pam-redbear
  Cargo.lock missed by the earlier sweep; regenerated for the 0.3.2 fork
  versions.

termcap and seatd now cook clean.
2026-08-03 15:32:29 +03:00
vasilito 3f8ebd8631 cookbook: serialise cook units that share a recipe directory
The unique-temp-name fix was treating symptoms. The actual defect is
structural: run_parallel_cook documents the invariant

  'each recipe builds in its own target/stage/sysroot'

and that invariant is false. dep_levels() keys on the package NAME, so a
recipe's optional-package variants -- llvm-native, llvm-native.dev,
llvm-native.runtime -- are distinct units with no dependency between
them. They therefore land in the same level and cook concurrently while
sharing one target/<triple>/ directory, because build/, sysroot/ and the
stage* dirs are all derived from the recipe directory, not the package
name.

create_dir_clean() on the shared build/ then wipes a sibling's tree
mid-compile:

  ninja: error: failed recompaction: No such file or directory

which is the error the earlier parallel builds kept producing and which
unique temp names could never have fixed -- build/ is a real, shared,
destructively re-created directory, not a staging path. It is also why
llvm-native cooks clean in isolation but failed in every parallel build,
and why that failure was misread as a porting gap serious enough to
exclude the package from the config.

Make the recipe DIRECTORY the unit of mutual exclusion. Distinct recipes
still cook fully in parallel; only siblings serialise, and that costs
almost nothing because one cook already populates every stage dir for
the recipe -- the siblings that follow find their work done and return
cached. It also stops LLVM being built three times over.

Residual, not addressed here: recipes joined by [source] same_as (e.g.
llvm-native -> llvm21) share a source tree. That is read-only during
cook, but a concurrent fetch/patch of the shared source would be a
separate race.
2026-08-03 15:06:14 +03:00
vasilito e3aa90b0f5 gettext: use relibc's error() instead of gnulib's replacement
gettext failed to link against the GCC 16 toolchain with

  ld: libc.a(...rcgu.o):(.bss.error_message_count+0x0): multiple
      definition of `error_message_count'; libgrt.a(libgrt_a-error.o):
      first defined here

Root cause is a cross-compile artefact, not a compiler change. gnulib's
check for a working error() is a RUN test, so cross-compiling reports
'checking for working error function... guessing no' and turns on
GNULIB_REPLACE_ERROR. Two things then go wrong at once: consumers are
redirected to rpl_error, and gnulib's own error.c -- listed in
am__objects_5 with no GL_COND_OBJ_ERROR guard -- still defines the
unrenamed error_* globals, which collide with relibc's.

relibc genuinely implements error(), error_at_line() and all three
globals (verified with nm). Two coordinated fixes:

- gl_cv_func_working_error=yes in the recipe. Stating the answer a run
  test cannot reach while cross-compiling is the standard autoconf
  mechanism, and is exactly what the neighbouring ac_cv_/gt_cv_ entries
  already do for the same reason. Consumers now call relibc's error()
  and no rpl_error reference remains.

- Guard gnulib's error.c on HAVE_ERROR, which configure already defines
  as 1 -- upstream gnulib later made this module conditional on the
  system lacking error(); this snapshot computes the right answer and
  does not act on it. Without this the definitions still collide, since
  relibc is Rust and one codegen unit carries several symbols, so
  referencing any of them drags the whole object in. glibc escapes this
  only by giving each its own object file.

gettext cooks clean. Patch generated by diff, applies at --fuzz=0.
2026-08-03 15:02:36 +03:00
vasilito 4fac89eec4 cookbook: make every staging path collision-free; restore the native toolchain
Concurrency
-----------
Package variants of one recipe (llvm-native, llvm-native.dev,
llvm-native.runtime) share a single target/<triple>/ directory and are
cooked concurrently by the cook_jobs thread pool, but every staging path
under it had a fixed name -- stage.tmp and sysroot.tmp. The variants
therefore raced: one renamed or removed the shared directory while a
sibling was still writing into it.

  Canonicalize stage dir failed at '.../stage.tmp': No such file or directory
  Renaming failed from '.../sysroot.tmp' to '.../sysroot': File exists

llvm-native cooks clean on its own -- verified, zero errors, all three
variants published -- but failed in every parallel build for this
reason. It was never a compile error, which is what the earlier
'C++/pthread header gaps' note in the config misattributed.

Both stage.tmp sites and the sysroot site now go through one
unique_tmp_dir() helper. A pid alone cannot disambiguate (the pool is
threads in one process), so a process-wide counter supplies uniqueness.

Config
------
Restore gcc-native, llvm-native and rust-native to redbear-full.
gcc-native was set to "ignore" and the other two were commented out as
'not needed for greeter proof'. Both forms are forbidden by AGENTS.md
ABSOLUTE RULE -- NEVER DELETE, NEVER IGNORE, NEVER COMMENT OUT, and by
local/AGENTS.md 'No build-excluded until ported packages': a package
that does not build gets ported, not excluded. llvm-native is required,
not optional -- it supplies the host LLVM dev tree that libclc and
Mesa's iris/radeonsi CLC path need.
2026-08-03 14:53:39 +03:00
vasilito 2f6e2d2b58 docs: finish de-dangling driver-manager citations; sync Cat 0 lockfile
Remaining hunks from the doc pass: local/AGENTS.md and the
legacy-superseded SUPERSEDED.md still cited the driver-manager
ASSESSMENT-2026-07-22 / D5-AUDIT evidence files and the archived
migration plan as if they were openable. Cargo.lock picks up the
0.3.1 -> 0.3.2 Cat 0 and installer versions.
2026-08-03 14:18:46 +03:00
vasilito 393fa47cfe argp-standalone: include <alloca.h> under GCC (GCC 14+ / C23)
argp-parse.c and argp-help.c wrap the whole alloca-declaration block in
'#ifndef __GNUC__', so the header is never included when building with
GCC -- the code relied on GCC historically providing an implicit
declaration. GCC 14 promoted -Wimplicit-function-declaration to an error
and C23 removed implicit declarations, so the GCC 16 cross toolchain
fails:

  argp-parse.c:1227:36: error: implicit declaration of function 'alloca'
  argp-help.c:1329:35: error: implicit declaration of function 'alloca'

configure already sets HAVE_ALLOCA_H 1 and relibc's <alloca.h> defines
alloca(size) as __builtin_alloca(size), which is what GCC wants. Honour
HAVE_ALLOCA_H before consulting __GNUC__; non-GCC paths are untouched.

Patch generated by diff against pristine source, applies at --fuzz=0,
and the recipe cooks clean. Second opportunistic C23-era fix under the
gnu17 migration, after libiconv.
2026-08-03 14:17:59 +03:00
vasilito 48a924c561 recipes: regenerate Cargo.lock for the 0.3.2 fork versions
The libredox 0.1.19 / redox_syscall 0.9.1 bump left 45 recipe lockfiles
pinning libredox 0.1.18+rb0.3.1 and redox_syscall 0.9.0+rb0.3.1. The
cookbook builds with --locked, so every affected recipe died with

  error: cannot update the lock file .../Cargo.lock because --locked was
  passed to prevent this

which is what took out redox-driver-sys -- and with it every Red Bear
driver -- during the redbear-full build. Regenerating the fork lockfiles
was not enough; the recipes that consume the forks as path deps carry
their own. This is step 6 of local/docs/FORK-BUMP-PATCHING-POLICY.md
applied to the recipe layer.

Also drop the hardcoded GCC version in recipes/libs/libstdcxx-v3: the
literal include/c++/13.2.0 stopped resolving the moment the cross
toolchain moved to 16.1.0, leaving -I pointing at a directory that does
not exist. Now resolves the newest installed C++ header directory and
fails loudly if there is none. Same failure class as the hardcoded
13.2.0 in mk/prefix.mk.

Note: a few recipe-level Cargo.lock files (redox-driver-pci, cpufreqd,
redbear-acmd/-ecmd/-ftdi) sit beside a recipe.toml whose [source] is
path = "source", so they are not build inputs; redox-driver-pci's even
references a redox-driver-core/Cargo.toml that does not exist. They are
left alone rather than given meaning they do not have.

redox-driver-sys now cooks clean.
2026-08-03 14:15:38 +03:00
vasilito 713131367f cookbook: fix sysroot staging races between package variants of one recipe
Two related races on recipes/<r>/target/<target>/sysroot, hit by
llvm-native during a -j 20 redbear-full build:

  repo: failed to build: Renaming failed from '.../sysroot.tmp' to
  '.../sysroot': File exists (os error 17)

llvm-native, llvm-native.dev and llvm-native.runtime are package
variants of one recipe and share that target directory. The cook_jobs
pool runs them as concurrent threads in a single process, so:

1. Shared staging path. Every variant used the same '<sysroot>.tmp', and
   create_dir_clean() at the start of the staging block would wipe a
   sibling's half-populated tree while it was still extracting pkgars
   into it. Staging is now per-call, named from an atomic counter (a pid
   would not disambiguate -- the pool is threads, not processes).

2. TOCTOU on the publish. The '!deps_dir.is_dir()' guard is checked long
   before the rename, so all variants can pass it and then race; rename(2)
   returns EEXIST/ENOTEMPTY once a winner has published a non-empty
   directory, and the losers failed the whole recipe. Losing is harmless
   -- every variant populates from the same recipe's dep set, so the
   winner's tree is equivalent -- so the losers now discard their staging
   and use it. The destination is deliberately not removed first, since a
   concurrent cook may already be reading it.
2026-08-03 13:44:56 +03:00
vasilito 1790010483 docs: restore two wrongly-removed plans and de-dangle stale references
Round 18's N22 'stale-doc removal' deleted three docs on the stated
premise that they had 'no references anywhere in the repo'. That premise
was wrong for two of them, and SUPERSEDED-DOC-LOG.md's recorded
absorption destinations for those two do not exist:

- CUB-PACKAGE-MANAGER.md was said to be absorbed into a 'redbear-cub
  recipe README.md' and NETWORKING-IMPROVEMENT-PLAN.md section 8.2.
  Neither exists -- there is no cub README under local/recipes/system/cub,
  and that plan has no package-manager section (its 'cubic' matches are
  TCP congestion control). README.md meanwhile links the doc from its
  Documentation list and names cub in six places, so this left a headline
  component with no documentation at all.

- BLUETOOTH-IMPLEMENTATION-PLAN.md was said to be merged into
  NETWORKING-IMPROVEMENT-PLAN.md section 3.x. That file contains three
  passing mentions of Bluetooth, not a 703-line plan. local/AGENTS.md,
  docs/README.md and docs/07 all still list it as a first-class subsystem
  plan, and AGENTS.md forbids treating Bluetooth as secondary.

Both restored from aa480f7ca3^ and their SUPERSEDED-DOC-LOG entries
retracted with the reason. USB-VALIDATION-RUNBOOK.md's supersession is
genuine -- USB-IMPLEMENTATION-PLAN.md carries the runbook as section 6.x
test procedures -- so it stays removed and its one reference now points
there.

Also de-dangled references to docs the authorised 2026-07-27
consolidation (092d1b39c3) removed but which canonical docs still cited
as openable: the driver-manager ASSESSMENT-2026-07-22 and D5-AUDIT
evidence files and the archived migration plan, across eight documents.
They now name what they were and where the supersession is recorded.

Remaining unresolved references are upstream KWin's vendored README
pointing at upstream's own CONTRIBUTING.md, which is deliberately not
touched.
2026-08-03 13:41:01 +03:00
vasilito 7f2920f861 build: make verify-fork-functions honor 'diverged' mode like its sibling
verify-fork-versions.sh reads the 4th column of fork-upstream-map.toml
and skips the content check for forks marked 'diverged', with a WARN.
verify-fork-functions.sh had no notion of mode and hard-failed every
fork, so kernel (30), bootloader (5) and installer (2) blocked every
canonical build for drift the map itself records as accepted, with
comments saying a full rebase is later work.

Both verifiers now read the same source of truth. Diverged forks are
reported and counted as warnings; every other fork still gates. This
turned a 5-fork / 43-function hard failure into 2 real findings, which
are fixed in the accompanying relibc and base commits.
2026-08-03 13:26:14 +03:00
vasilito 84a9872ab0 release: bump relibc and base gitlinks for restored upstream functions 2026-08-03 13:26:01 +03:00
vasilito 5b08b0630f release: bump fork gitlinks after 0.3.2 lockfile regeneration
Cargo.lock in seven forks still named libredox 0.1.18+rb0.3.1 and
redox_syscall 0.9.0+rb0.3.1. Cargo rewrites them on first build, which
then trips the dirty-source gate mid-run. Regenerated offline and
committed so fingerprints reflect committed state.
2026-08-03 13:16:37 +03:00
vasilito 538b1745d4 policy: document delicate patching during version and toolchain bumps
New local/docs/FORK-BUMP-PATCHING-POLICY.md, wired into AGENTS.md,
local/AGENTS.md and docs/README.md. Core rule: a version bump is a
REBASE, never a REPLACEMENT.

Written from the libredox 0.1.19 incident, which hit three failures at
once -- wholesale replacement that dropped the acpi re-export,
F_DUPFD_CLOEXEC, the mandated authors entry and the Single-Repo
repository URL; a version-named branch that also tripped the build's
fork-branch gate; and a stale fork-upstream-map.toml that failed
verify-fork-versions.sh with a fake-label violation. Covers the vendored
recipe-fork mirror image (metadata moves, build input does not -- how Qt
shipped 6.11.0 against a 6.11.1 recipe), patch handling during a bump,
and toolchain bumps as version bumps.

Also fixes the two bookkeeping gaps that failed this build:

- local/fork-upstream-map.toml: libredox 0.1.18 -> 0.1.19, never updated
  when the fork was bumped.
- verify-fork-versions.sh: record redoxfs's legitimate divergence in the
  declarative allowlist the script already provides for libredox, with
  the originating commit for each file -- a936d00 (Red Bear, Vec from
  alloc for no_std bootloader builds) for filesystem.rs and record.rs,
  852a971 (Red Bear, RecvFd EOPNOTSUPP) for mount/redox/mod.rs, and
  d807dd3 (upstream symlink fix imported ahead of the 0.9.1 tag) for
  mount/redox/scheme.rs. Documented rather than bypassed with
  REDBEAR_SKIP_FORK_VERIFY.
2026-08-03 13:12:47 +03:00
vasilito 9f2de2a0b1 docs+build: correct version drift, mangled prose, and toolchain-version gaps
Docs:
- Baseline was stated as 0.3.1 across the canonical set while the branch,
  Cat 0/1 crates and every Cat 2 fork are 0.3.2. AGENTS.md also cited a
  sources/redbear-0.3.1/ archive that does not exist; the only archive
  present is sources/redbear-0.1.0/. Versioning examples now match the
  forks as they actually stand (redoxfs/syscall 0.9.1, libredox 0.1.19).
- Repaired 18 instances of 'immutable archived' across 8 documents, where
  a global find/replace had turned sync/synced/archived into that phrase
  and produced ungrammatical text ('never auto-immutable archived',
  '### Source immutable archived').
- Settled the apply-patches.sh contradiction empirically. Both sides were
  wrong: the GROSS WARNING blocks (x5) described it as routine
  patch-linking, and SCRIPT-BEHAVIOR-MATRIX.md said build-redbear.sh
  'never invokes' it. It is invoked at build-redbear.sh:487, but only to
  auto-repair a failed verify-overlay-integrity.sh check.
- Dropped the dangling reference to a local/AGENTS.md section
  'NO OVERLAY-STYLE PATCHES — SCOPED POLICY' that does not exist.

Build system:
- mk/prefix.mk hardcoded 13.2.0 in the limits.h removal, which silently
  no-ops after a toolchain upgrade and leaves the conflicting header.
  Version-globbed.
- Parameterized GCC_RECIPE so the from-source toolchain path is not
  pinned to gcc13.
- The three cstdlib strtold seds were not idempotent -- the shipped GCC
  13 toolchain carried that comment block 17 times from repeated
  'make prefix' runs. Each is now guarded.
2026-08-03 13:07:25 +03:00