mirror of
https://github.com/python/cpython.git
synced 2025-07-29 14:15:07 +00:00
bpo-40280: Add --with-emscripten-target to build for browser or node (GH-30552)
Co-authored-by: Ethan Smith <ethan@ethanhs.me>
This commit is contained in:
parent
be578e0c06
commit
43839ba438
7 changed files with 164 additions and 22 deletions
|
@ -27,6 +27,8 @@ embuilder build zlib
|
|||
|
||||
### Cross compile to wasm32-emscripten
|
||||
|
||||
For browser:
|
||||
|
||||
```shell
|
||||
mkdir -p builddir/emscripten
|
||||
pushd builddir/emscripten
|
||||
|
@ -35,9 +37,23 @@ CONFIG_SITE=../../Tools/wasm/config.site-wasm32-emscripten \
|
|||
emconfigure ../../configure -C \
|
||||
--host=wasm32-unknown-emscripten \
|
||||
--build=$(../../config.guess) \
|
||||
--with-emscripten-target=browser \
|
||||
--with-build-python=$(pwd)/../build/python
|
||||
|
||||
emmake make -j$(nproc) python.html
|
||||
emmake make -j$(nproc)
|
||||
```
|
||||
|
||||
For node:
|
||||
|
||||
```
|
||||
CONFIG_SITE=../../Tools/wasm/config.site-wasm32-emscripten \
|
||||
emconfigure ../../configure -C \
|
||||
--host=wasm32-unknown-emscripten \
|
||||
--build=$(../../config.guess) \
|
||||
--with-emscripten-target=node \
|
||||
--with-build-python=$(pwd)/../build/python
|
||||
|
||||
emmake make -j$(nproc)
|
||||
```
|
||||
|
||||
### Test in browser
|
||||
|
|
|
@ -30,6 +30,11 @@ ac_cv_func_shutdown=no
|
|||
# breaks build, see https://github.com/ethanhs/python-wasm/issues/16
|
||||
ac_cv_lib_bz2_BZ2_bzCompress=no
|
||||
|
||||
# clock_nanosleep() causes time.sleep() to sleep forever.
|
||||
# nanosleep() works correctly
|
||||
ac_cv_func_clock_nanosleep=no
|
||||
ac_cv_lib_rt_clock_nanosleep=no
|
||||
|
||||
# The rest is based on pyodide
|
||||
# https://github.com/pyodide/pyodide/blob/main/cpython/pyconfig.undefs.h
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue