Skip to content

emscripten: add Docker-based one-stop build and polish demo page#6385

Open
ChrisJefferson wants to merge 1 commit intogap-system:masterfrom
ChrisJefferson:emscripten-polish
Open

emscripten: add Docker-based one-stop build and polish demo page#6385
ChrisJefferson wants to merge 1 commit intogap-system:masterfrom
ChrisJefferson:emscripten-polish

Conversation

@ChrisJefferson
Copy link
Copy Markdown
Contributor

Reworks the emscripten build to be reproducible inside a pinned emsdk:3.1.23 container, replacing the previous mix of shell, Ruby, and Node helpers. New entry point: etc/emscripten/build-in-docker.sh builds the image, runs the wasm build inside it, and assembles a self-contained web-example/ directory copyable to any static host.

This doesn't change functionality, but it (hopefully) makes it clearer what is going on, makes the created page nicer, and cleans up the docker script. You can now just run etc/emscripten/build-in-docker.sh and get a full finished build ready to deploy.

Reworks the emscripten build to be reproducible inside a pinned
emsdk:3.1.23 container, replacing the previous mix of shell, Ruby,
and Node helpers. New entry point: etc/emscripten/build-in-docker.sh
builds the image, runs the wasm build inside it, and assembles a
self-contained web-example/ directory copyable to any static host.

Build pipeline:
  - Dockerfile pins emsdk 3.1.23 (newer versions break GASMAN's
    ASYNCIFY interaction), installs autotools/python3/bison/byacc/m4,
    and bakes the GAP package distribution tarball into the image so
    repeated runs don't re-download it.
  - build.sh: cleaned up (dead error-check, $(nproc), pipefail);
    wipes stale build/ before reconfiguring under emcc to avoid
    cross-arch contamination from prior native in-tree builds; uses
    find -L so users' pkg/X -> git/X dev symlinks are picked up.
  - build-in-docker.sh: pins --platform linux/amd64 on both build
    and run so the layer cache survives on Apple Silicon hosts.
  - assemble-website.sh: replaces run-web-demo.sh; wipes the output
    dir and uses cp -RL to dereference symlinks for portability.
  - serve.py: replaces server.rb (drops the Ruby dep); stdlib-only
    Python server with COOP/COEP headers.

Demo page (web-template/index.html):
  - Header with title, disclaimer, and gap-system.org links.
  - Collapsible "What is this? · Licensing" disclosure with brief
    intro, getting-started commands, IndexedDB caching note, and
    links to the bundled LICENSE and COPYRIGHT.
  - Loading notice that auto-hides on the first xterm render.
  - SharedArrayBuffer detection with a clear error pointing at
    COOP/COEP if the page is served without the right headers.
  - Footer with main-site/docs/source links.
  - Terminal at 85x40 (wider to dodge an apparent off-by-one).

Manifest workflow:
  - gap-fs.js wraps fetch and XMLHttpRequest.open and reports each
    unique URL to the main thread; the page exposes window.fetchedUrls
    for devtools-driven manifest regeneration. Replaces the previous
    Node tracker server (build_startup_manifest.js).
  - startup_manifest.json captured from a real GAP run and committed.

Removes: build_startup_manifest.js, run-web-demo.sh, server.rb.
.gitignore: adds web-example/, native-build/, packages.tar.gz, the
top-level wasm artefacts, and /extern/emscripten/.
@wangyenshu
Copy link
Copy Markdown
Contributor

That is great! I have a small change request. Could you let the startup_manifest.json include the manual files, as requested in #6269 (comment)? You could do it by typing the following command in gap wasm website to record it in startup_manifest.json:

SizeScreen([100000, 100000]);
??a

or use external tools to add paths of all .six files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants