Files
velzieandClaude Opus 5.5 b2615c4904 web/src/README.md: the app library's API in one place
start()'s options, its handle, its errors, the Linux program's library,
and what is not the API (the test page's build option, the globals,
gex.mjs). The eject README's copy of the table, which had fallen behind
(no uid, wisp, pageHosts, glLazy, launch), now points here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_c8c04c00da9a4525ab21b0b9f146c598
2026-10-28 16:36:49 -04:00

2.6 KiB

web

The page that runs gex in a browser, and the builds of what it loads:

  • the browser shim, the shared kernel module and the seed, from shims/browser and shims/kernel (build-assets.sh);
  • Mesa for wasm32, from the third_party/mesa submodule. It draws through Gallium's gex_wgpu driver on the browser's WebGPU. A guest's GL calls reach it through guest/gl and web/mesa/gexgl-mesa.cpp (build-mesa-wasm.sh);
  • Xwayland as wasm32, which runs in a Worker of the page and talks to shims/hostwl (build-xwayland-wasm.sh);
  • the guest root filesystems come from the debdemo repository, which writes them into web/public/rootfs (and the desktop demo's launcher packages into web/public/pkgs).

The two builds

build dist threads hosting
multi-process (default) web/dist each guest thread is a Worker on shared memory needs COOP/COEP (SharedArrayBuffer)
single-thread web/dist-sp every guest thread is a fiber in one Worker any static host

Both builds load the same shim, kernel and seed. Each builds its own Mesa and Xwayland, with or without -pthread. The dists ship stripped wasm. Unstripped copies stay in target/web-debug/<mp|sp>/, and --debug ships them instead.

git submodule update --init third_party/mesa
web/build-all.sh             # multi-process
web/build-all.sh --sp        # single-thread
web/build-all.sh --both
node web/serve-dist.mjs 8088 --sp-port 8089

The first Mesa build also builds Tint (tint/build-tint.sh), so it takes much longer than later ones. Stripping needs wasm-tools (cargo install wasm-tools).

Ejected programs

build-eject-page.sh builds the page library that an ejected project ships. eject-site.mjs PROJECT OUT packs a built 32-bit Wine project into a static site: the library, its runtime and Mesa, zstd-compressed assets, and the headers the host must send. The site's index.html belongs to the project, so the library can be imported into a page of your own. Its API, start(), is in src/README.md.

The desktop demo

build-demo.sh builds the desktop page into web/dist-demo. Its guest side (the base rootfs and the launcher's packages) comes from the debdemo repository, built against this checkout first:

make -C path/to/debdemo native GEXCC_PREFIX=...   # the gexcc .deb pool, once
make -C path/to/debdemo desktop GEX_DIR=$PWD      # web/public/rootfs/base.tar.zst, web/public/pkgs
web/build-demo.sh

Without them build-demo.sh stops and says so. The other pages (build-all.sh) need nothing from debdemo; their Debian demos say when their rootfs is missing.