Skip to content

Commit 05c12ce

Browse files
committed
reference dev guide for building emscripten
1 parent bed7f8a commit 05c12ce

File tree

1 file changed

+8
-57
lines changed

1 file changed

+8
-57
lines changed

Tools/wasm/README.md

Lines changed: 8 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -9,68 +9,19 @@ compilation of CPython to WebAssembly (WASM). Python supports Emscripten
99
run in modern browsers and JavaScript runtimes like *Node.js*. WASI builds
1010
use WASM runtimes such as *wasmtime*.
1111

12-
Users and developers are encouraged to use the script
13-
`Tools/wasm/wasm_build.py`. The tool automates the build process and provides
14-
assistance with installation of SDKs, running tests, etc.
12+
Users and developers are encouraged to use the `Tools/wasm/emscripten` and
13+
`Tools/wasm/wasi` for building CPython for WebAssembly. These tools automate
14+
the build process and provide assistance with installation of SDKs, running
15+
tests, etc.
1516

16-
**NOTE**: If you are looking for information that is not directly related to
17-
building CPython for WebAssembly (or the resulting build), please see
18-
https://github.com/psf/webassembly for more information.
17+
**NOTE**: If you are looking for general information about WebAssembly that is
18+
not directly related to CPython, please see https://github.com/psf/webassembly.
1919

20-
## wasm32-emscripten
20+
## Emscripten (wasm32-emscripten)
2121

2222
### Build
2323

24-
To cross compile to the ``wasm32-emscripten`` platform you need
25-
[the Emscripten compiler toolchain](https://emscripten.org/),
26-
a Python interpreter, and an installation of Node version 18 or newer.
27-
Emscripten version 4.0.2 is recommended; newer versions may also work, but all
28-
official testing is performed with that version. All commands below are relative
29-
to a checkout of the Python repository.
30-
31-
#### Install [the Emscripten compiler toolchain](https://emscripten.org/docs/getting_started/downloads.html)
32-
33-
You can install the Emscripten toolchain as follows:
34-
```shell
35-
git clone https://github.com/emscripten-core/emsdk.git --depth 1
36-
./emsdk/emsdk install latest
37-
./emsdk/emsdk activate latest
38-
```
39-
To add the Emscripten compiler to your path:
40-
```shell
41-
source ./emsdk/emsdk_env.sh
42-
```
43-
This adds `emcc` and `emconfigure` to your path.
44-
45-
##### Optionally: enable ccache for EMSDK
46-
47-
The ``EM_COMPILER_WRAPPER`` must be set after the EMSDK environment is
48-
sourced. Otherwise the source script removes the environment variable.
49-
50-
```shell
51-
export EM_COMPILER_WRAPPER=ccache
52-
```
53-
54-
#### Compile and build Python interpreter
55-
56-
You can use `python Tools/wasm/emscripten` to compile and build targeting
57-
Emscripten. You can do everything at once with:
58-
```shell
59-
python Tools/wasm/emscripten build
60-
```
61-
or you can break it out into four separate steps:
62-
```shell
63-
python Tools/wasm/emscripten configure-build-python
64-
python Tools/wasm/emscripten make-build-python
65-
python Tools/wasm/emscripten make-libffi
66-
python Tools/wasm/emscripten configure-host
67-
python Tools/wasm/emscripten make-host
68-
```
69-
Extra arguments to the configure steps are passed along to configure. For
70-
instance, to do a debug build, you can use:
71-
```shell
72-
python Tools/wasm/emscripten build --with-py-debug
73-
```
24+
See [the devguide instructions for building for Emscripten](https://devguide.python.org/getting-started/setup-building/#emscripten).
7425

7526
### Running from node
7627

0 commit comments

Comments
 (0)