diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-09-13 10:35:11 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-09-13 10:35:11 -0700 |
commit | 2c111533ff6e841d9dfecfa38d506c06e3e5cb62 (patch) | |
tree | 623eb2b989023dbf554928c56983f744aed63e02 | |
parent | 61c818d8da85668f2697d032f118db4243d7cafe (diff) | |
parent | 8c53e6a8edc021654de1353d9d37bb80806f4870 (diff) |
Merge pull request #1619 from waywardmonkeys/python-build-instructions
Python build instructions
-rw-r--r-- | tests/python/readme.md | 59 | ||||
-rw-r--r-- | tests/python/readme.txt | 46 |
2 files changed, 59 insertions, 46 deletions
diff --git a/tests/python/readme.md b/tests/python/readme.md new file mode 100644 index 00000000..e728dce3 --- /dev/null +++ b/tests/python/readme.md @@ -0,0 +1,59 @@ +Building Python with Emscripten +=============================== + +These directions should work for Python 2.7.x (last tested with 2.7.5). + +First, uncompress Python into two separate directories, one for native +and one for JavaScript. + +In the JavaScript directory, do: + +```` + EMCONFIGURE_JS=1 emconfigure ./configure --without-threads --without-pymalloc --enable-shared --disable-ipv6 +```` + +If you are on Mac OS X, you will also want ``disable-toolbox-glue``. +If you are on an older version of Python (such as 2.7.2), you may +not need the ``--disable-ipv6`` option. + +If you are on Python 2.7.4 or later, you will need to edit the +``Makefile`` generated and remove the ``MULTIARCH=`` line(s). +You will also need to edit ``pyconfig.h`` and remove defines +for ``DOUBLE_IS_BIG_ENDIAN_IEEE754``, ``DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754``, +and ``HAVE_GCC_ASM_FOR_X87``. + +On Python 2.7.2, you will need to edit ``pyconfig.h`` and remove +``HAVE_GCC_ASM_FOR_X87``, ``HAVE_SIG*`` except for ``SIGNAL_H`` +and *add* ``#define PY_NO_SHORT_FLOAT_REPR``. + +Now, you can run ``make``. It will fail trying to run ``pgen``. + +At this point, go to your native directory and run: + +```` +./configure --without-threads --without-pymalloc --enable-shared --disable-ipv6 +```` + +Now, run ``make`` in the native directory and then copy the generated ``Parser/pgen`` +to your JavaScript directory. Back in your JavaScript directory, be sure to flag +the ``pgen`` executable as executable: + +```` +chmod +x Parser/pgen +```` + +Now, run ``make`` again. + +You will get an error about trying to run ``python`` or ``python.exe``. This +can be ignored. + +Now, you can link the bitcode file that you need: + +```` +llvm-link libpython2.7.so Modules/python.o -o python.bc +```` + +If you are on Mac OS X, you will want to look for ``libpython2.7.dylib`` +instead of ``libpython2.7.so``. + +Thanks to rasjidw and everyone else who has helped with this! diff --git a/tests/python/readme.txt b/tests/python/readme.txt deleted file mode 100644 index 31b0ff45..00000000 --- a/tests/python/readme.txt +++ /dev/null @@ -1,46 +0,0 @@ -Updates to Python 2.7.4 and emscripten of Arp 29 2013 with le32 - -Go to js dir, run EMCONFIGURE_JS=1 ~/Dev/emscripten/emconfigure ./configure --without-threads --without-pymalloc --enable-shared --disable-ipv6 -clean out MULTIARCH= in Makefile -make, until error on pgen -Go to native, run ./configure --without-threads --without-pymalloc --enable-shared --disable-ipv6 -cp Parser/pgen ../JS_DIR/Parser -return to JS -chmod +x Parser/pgen -remove #defines of DOUBLE_IS_BIG_ENDIAN_IEEE754 and DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 and HAVE_GCC_ASM_FOR_X87 in pyconfig.h -make -link libpython2.7.so with Modules/python.o to get the bitcode file you want - -========================= - - -This is Python 2.7.2, compiled to .bc as follows: - -Uncompress Python into two separate directories, one for native and one for JS. - -In the JS one, do - emconfigure ./configure --without-threads --without-pymalloc --enable-shared - EDIT pyconfig.h, remove - HAVE_GCC_ASM_FOR_X87 - HAVE_SIG* except SIGNAL_H - and *add* - #define PY_NO_SHORT_FLOAT_REPR - make -It will fail on lack of permissions to run Parser/pgen. - -Go to the native one, do - ./configure --without-threads --without-pymalloc - make - (Note: you don't need to let it complete, just enough for Parse/pgen is sufficient.) - cp Parser/pgen ../YOUR_JS_DIR/Parser/ - -Return to the JS one, do - chmod +x Parser/pgen - make -You will get an error on lack of permissions to run ./python. Ignore that, and do - llvm-link libpython2.7.so python -o python.bc - -That's it! - -Thanks to rasjidw for helping with this! - |