diff options
author | Christian Heimes <christian@python.org> | 2022-01-12 15:08:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-12 15:08:19 (GMT) |
commit | 43839ba438368a50f22f718d4ce8ce607c17046c (patch) | |
tree | d9785a40ccbf9f8a3e8a1614cc6e3f7af3708430 /Tools | |
parent | be578e0c063dad1dbb273f86d5bc77e4e6f14583 (diff) | |
download | cpython-43839ba438368a50f22f718d4ce8ce607c17046c.zip cpython-43839ba438368a50f22f718d4ce8ce607c17046c.tar.gz cpython-43839ba438368a50f22f718d4ce8ce607c17046c.tar.bz2 |
bpo-40280: Add --with-emscripten-target to build for browser or node (GH-30552)
Co-authored-by: Ethan Smith <ethan@ethanhs.me>
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/wasm/README.md | 18 | ||||
-rw-r--r-- | Tools/wasm/config.site-wasm32-emscripten | 5 |
2 files changed, 22 insertions, 1 deletions
diff --git a/Tools/wasm/README.md b/Tools/wasm/README.md index 93c76b2..f59b876 100644 --- a/Tools/wasm/README.md +++ b/Tools/wasm/README.md @@ -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) +``` + +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) python.html +emmake make -j$(nproc) ``` ### Test in browser diff --git a/Tools/wasm/config.site-wasm32-emscripten b/Tools/wasm/config.site-wasm32-emscripten index b291c80..ce9dec7 100644 --- a/Tools/wasm/config.site-wasm32-emscripten +++ b/Tools/wasm/config.site-wasm32-emscripten @@ -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 |