A working Emscripten port of CPython.
-
Install Emscripten SDK, make sure
emcc
,emmake
, and setup environment variables. -
Clone EmCPython repository with submodules:
git clone --recursive https://github.com/PeachPy/EmCPython.git
-
Switch to EmCPython directory:
cd EmCPython
. -
Run
./build-python.sh
. It will cross-compile CPython 2.7 and install it intoEmCPython/emscripten
. -
Run
./build-libtar.sh
. It will cross-compile libtar and install it intoEmCPython/emscripten
. -
Run
./pack-modules.py -p emscripten -o pydata.tar
. It will create a TAR with Python modules fromEmCPython/emscripten/lib/python2.7/
. -
Switch to EmCPython/test directory:
cd test
. -
Run
ninja
to build the test. It will createpython.asm.js
andpython.asm.js.mem
files. -
Execute
python.asm.js
with Node.js:node python.asm.js