Skip to content

Latest commit

 

History

History
63 lines (47 loc) · 1.55 KB

PYTHON_BUILD.md

File metadata and controls

63 lines (47 loc) · 1.55 KB

Building python

Steps

1. Install emscripten

  • Follow steps here.
  • Easier to build from git than use AUR packages.

2. Clone cpython

git clone https://github.com/python/cpython.git
# make build directories for build (the current system architecture)
# and host, the emscripten/wasi architecture
mkdir -p cpython/builddir/build
mkdir -p cpython/builddir/emscripten-browser
mkdir -p cpython/builddir/emscripten-node

3. Build cpython

mkdir -p cpython/builddir/build
pushd cpython/builddir/build
../../configure -C
make -j$(nproc)
popd

# Other ports
embuilder build zlib bzip2

4. Build wasm module

mkdir -p cpython/builddir/emscripten-browser

# install emcc ports so configure is able to detect the dependencies
embuilder build zlib bzip2

pushd cpython/builddir/emscripten-browser
CONFIG_SITE=../../Tools/wasm/config.site-wasm32-emscripten \
  emconfigure ../../configure -C \
    --host=wasm32-unknown-emscripten \
    --build=$(../../config.guess) \
    --with-emscripten-target=browser \
    --enable-wasm-dynamic-linking=no \
    --with-build-python=$(pwd)/../build/python \
    "$@"

emmake make -j$(nproc)
# -s MINIFY_HTML=0 -sMODULARIZE -s 'EXPORT_NAME="createMyModule"'

popd

Links