Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-95205: Improve wasm README #95206

Merged
merged 9 commits into from
Jul 25, 2022
22 changes: 15 additions & 7 deletions Tools/wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ to a repository checkout.
Christian Heimes maintains a container image with Emscripten SDK, Python
build dependencies, WASI-SDK, wasmtime, and several additional tools.

From within your local CPython repo clone, run one of the following commands:

```
# Fedora, RHEL, CentOS
podman run --rm -ti -v $(pwd):/python-wasm/cpython:Z quay.io/tiran/cpythonbuild:emsdk3
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -31,12 +33,18 @@ podman run --rm -ti -v $(pwd):/python-wasm/cpython:Z quay.io/tiran/cpythonbuild:
docker run --rm -ti -v $(pwd):/python-wasm/cpython quay.io/tiran/cpythonbuild:emsdk3
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved
```

Note that when you exit the container, all work will be lost.
See the `podman` or `docker` docs for how to preserve the container environment
across runs.

erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved
### Compile a build Python interpreter

From within the container, run the following commands:
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved

```shell
mkdir -p builddir/build
pushd builddir/build
../../configure -C
../../cpython/configure -C
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved
make -j$(nproc)
popd
```
Expand All @@ -53,10 +61,10 @@ embuilder build zlib bzip2
mkdir -p builddir/emscripten-browser
pushd builddir/emscripten-browser

CONFIG_SITE=../../Tools/wasm/config.site-wasm32-emscripten \
emconfigure ../../configure -C \
CONFIG_SITE=../../cpython/Tools/wasm/config.site-wasm32-emscripten \
emconfigure ../../cpython/configure -C \
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved
--host=wasm32-unknown-emscripten \
--build=$(../../config.guess) \
--build=$(../../cpython/config.guess) \
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved
--with-emscripten-target=browser \
--with-build-python=$(pwd)/../build/python

Expand Down Expand Up @@ -86,10 +94,10 @@ and header files with debug builds.
mkdir -p builddir/emscripten-node
pushd builddir/emscripten-node

CONFIG_SITE=../../Tools/wasm/config.site-wasm32-emscripten \
emconfigure ../../configure -C \
CONFIG_SITE=../../cpython/Tools/wasm/config.site-wasm32-emscripten \
emconfigure ../../cpython/configure -C \
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved
--host=wasm32-unknown-emscripten \
--build=$(../../config.guess) \
--build=$(../../cpython/config.guess) \
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved
--with-emscripten-target=node \
--with-build-python=$(pwd)/../build/python

Expand Down