Skip to content

Conversation

@nbriggs
Copy link
Collaborator

@nbriggs nbriggs commented Jan 25, 2024

Integrates the WASM work done by others more fully into the system for building and packaging.

In order to build (from maiko/bin, ./makeright wasm) you need the emscripten package(s) installed, with a working emcc, which will also require a version of clang (this setup is system specific and not documented here). The "makeright" will generate, in the same style as other targets, the emscripten.wasm directory, containing ldesdl.js, ldesdl.wasm, and ldesdl.data. The HTML page that wraps these is (now) stored in maiko/src/lde.html. In order to run lde under wasm you need a web server in which you will install all 4 files. As it is currently set up, all the files go at the root of the web directory. If your web server is on a host named "lisp.local", you would then browse http://lisp.local/lde.html to run Medley. When the lde files for WASM are built they capture the state of the adjacent medley directory -- all the files in docs, doctools, greetfiles, internal, sources, library, lispusers, fonts, as well as loadups/full.sysout, loadups/whereis.hash, and greetfiles/MEDLEYDIR-INIT.LCOM -- so you need to make sure you have built a native maiko, and done the medley loadup to get a full.sysout, before you build the WASM lde.

I'd appreciate it if someone who has the capability of testing this would do so...

no-defun-allowed and others added 14 commits November 13, 2023 15:18
…le phase

Give emcc link-time flags only to the link phase not the compile phase
Remove target "lde" which is not used in the emscripten configuration.
… periodic emscripten_sleep() call.

There is no need for an additional Emscripten-specific counter to periodically call emscripten_sleep().

Make test for Emscripten environment check MAIKO_OS_EMSCRIPTEN rather than checking __EMSCRIPTEN__,
which is localized in the maiko/platform.h include.
Moves the full.sysout from the root of tle system to /medley/loadups/full.sysout,
adds /medley/lispusers/BACKGROUND-YIELD.LCOM and an Emscripten/WAsm specific
site init file at /usr/local/lde/site-init.lisp

Adjusts options so that the options are in the correct place for the
compiler and loader.
Passes the window width/height as the requested geometry to lde at startup.

Since we control the directory structure of the file-system, we can pass the
known fixed location of the Medley directories in the MEDLEYDIR environment variable.

Sets up the NetHub host as localhost - not currenty functional, but a WebSocket
server could be added to communicate with the NetHub gateway to enable local
networking from the browser version of Medley.
…AIKO_ENABLE_NETHUB

Compiling with -DMAIKO_ENABLE_NETHUB makes it possible to test out having a WebSocket
server that could pass packets back and forth to the Dodo NetHub.

Setting Emscripten link-time option for EXIT_RUNTIME allows the runtime code to shutdown
when you exit Medley via a (LOGOUT)

Set up preloads for all the parts of the Medley directory that MEDLEYDIR-INIT expects
to be there.  The resulting ldesdl.data is (at this time) 128 MB.  It can be installed
gzipped if using nginx or some other web server that supports pre-zipped static files.
It would be better to have these as lazy-loading files, but the setup for that is
complicated.  Another alternative to embedding all the data would be if a WebSocket
to  XNS/Nethub gateway were written and deployed.
@masinter masinter self-requested a review January 26, 2024 16:31
Copy link
Member

@masinter masinter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

image

I was able to do a clean install of wsl and emscript etc so...
LGTM

@nbriggs nbriggs merged commit 586a320 into master Jan 26, 2024
@nbriggs nbriggs deleted the incorporate-wasm-changes branch May 22, 2024 23:22
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.

4 participants