# XLibre Desktop — Phase 1a Results

**Completed:** 2026-07-22 on hh-alpha9. **Outcome: a working XLibre + Openbox X11 desktop over VNC**, built entirely from zports via Coral. Screenshot: `hammerhead/docs/roadmap/hammerhead-desktop-phase1a.png` (Openbox-decorated `st` terminal, `root@hammerhead` shell, 1280×800).

## What shipped
**57 packages** installed on alpha9. New ports this phase (~50), by layer:
- **Tooling:** util-macros, nasm, meson, gperf, unzip (+ built existing python, ninja, mercurial)
- **Protocol:** xorgproto, xtrans, xcb-proto
- **Client libs (M2):** libpthread-stubs, libXau, libXdmcp, libxcb, libX11, libXext, libXrender, libXfixes, libXdamage, libXrandr, libXi, libXtst, libXcursor, libXinerama, libXcomposite, libICE, libSM, libXt, libXmu, libXpm, pixman, libxkbfile
- **Font/render (M3):** libpng, libjpeg-turbo, freetype, fontconfig, libfontenc, libXfont2, libXft, font-util, dejavu-fonts, pcre2, glib2 (2.88.2), fribidi, harfbuzz, cairo, pango
- **Server + runtime (M4):** xlibre-xserver (25.1.8, Xvfb), xkbcomp, xkeyboard-config, xauth, xinit, libvncserver, x11vnc
- **Desktop (M5):** openbox (3.6.1), st (0.9.3)

## Verified milestone
`Xvfb :99` + a libX11 client → `CLIENT CONNECTED: 1024x768 depth 24, vendor=XLibre`. Full stack (Xvfb+openbox+st+x11vnc) runs on alpha9:5900; screenshot shows the live interactive desktop.

## Systemic illumos-porting gotchas found + standardized (in plan templates + memory)
1. **libtool static-only** — pre-generated `configure` lacks a hammerhead arm → silent `.a`-only builds. Fix: sed the `dynamic_linker` case (nested for freetype: `builds/unix/configure`).
2. **`__EXTENSIONS__` + `_POSIX_PTHREAD_SEMANTICS`** — illumos hides POSIX/BSD prototypes + uses Solaris-draft `_r` signatures without them; meson's `has_function()` false-positives.
3. **Meson rpath** — Meson strips rpath on install + `/usr/local/lib` not on default ld path → bake `-R$PREFIX/lib` (+ added `/usr/local/lib` to alpha9 `crle`).
4. **Hammerhead sysname ≠ `sunos`** — recurred in glib meson checks and the XLibre server os-layer (patched).
5. **autoreconf regenerates config.sub** without the hammerhead patch; **CMake bundled-static needs `-DCMAKE_POSITION_INDEPENDENT_CODE=ON`**; **coral needs `unzip`** for .zip sources.

## Coral bugs filed (see CORAL_ISSUES.md) — for the Coral team
- **CORAL-1:** relative `coral build <cat>/<name>` exit-127-fails (use absolute path).
- **CORAL-2:** bundled TLS trust store rejects some hosts (nasm.us) — pre-stage the tarball.

## XLibre patches (upstream candidates — stored in `base/xlibre-xserver/patches/`)
- **0001** — extend the `os/meson.build` `sunos` guard to accept Hammerhead's sysname (lights up `-lsocket`/`-lnsl`).
- **0002** — fix inverted re-arm check in the illumos event-ports (`PORT_SOURCE_FD`) `ospoll` backend; without it the server accepted only ONE client for its lifetime. Worth contributing back to XLibre.

## Workflow
Mercurial on both machines: author on Linux → `hg commit`/`push` → alpha9 `hg pull -u` → `coral build` (absolute path). Ports build + test on alpha9 (single-VM ports pattern). alpha8 remains the base-OS build VM; alpha7 retired.

## Next
Phase 1b — lightweight X11-native CBPP-look desktop (tint2, conky, picom, feh, dmenu + mpv/mupdf/nnn). Phase 1c — Qt6 + LXQt durable rich-app tier. Phase 2 — native VM console (retarget kdrive/Xfbdev to illumos `visual_io`). See `hammerhead/docs/roadmap/DESKTOP_XLIBRE_OPENBOX.md`.
