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:
Christian Heimes 2022-01-12 17:08:19 +02:00 committed by GitHub
parent be578e0c06
commit 43839ba438
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 164 additions and 22 deletions

View file

@ -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

View file

@ -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