Skip to content

Build scripts and configuration for building CPython for Emscripten

Notifications You must be signed in to change notification settings

roixroi/python-wasm

 
 

Repository files navigation

CPython on WASM

Build scripts and configuration for building CPython for Emscripten.

Pretty straight forward. First, install emscripten. Then, run the following commands:

# get the Python sources
./fetch-python.sh
# build Python for the machine we are building on, needed before cross compiling for emscripten
./build-python-build.sh
# build Python cross-compiling to emscripten
./build-python-host-emscripten.sh

There will probably be errors, but that's just part of the fun of experimental platforms.

Assuming things compiled correctly, you can have emscripten serve the Python executable and then open http://localhost:8000/python.html in your browser:

./run-python.sh

The CLI input is done via an input modal which is rather annoying. Also to get output you need to click Cancel on the modal...

Developing

Once you've built the Emscripten'd Python, you can rebuild it via

./clean-host.sh
./build-python-host-emscripten.sh

which will rebuild Python targeting emscripten and re-generate the python.{html, wasm, js}

About

Build scripts and configuration for building CPython for Emscripten

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%