| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -66,6 +66,8 @@ emscripten () { | |||
| 66 | 66 | # OPT=-Oz: TODO | |
| 67 | 67 | # CONFIG_SITE: deals with cross-compilation https://bugs.python.org/msg136962 | |
| 68 | 68 | # not needed as emcc has a single arch: BASECFLAGS=-m32 LDFLAGS=-m32 | |
| 69 | + # PATH: detect our Python, beware of conflict with emcc's python3 | ||
| 70 | + # don't use PYTHON_FOR_BUILD which is high-level / lots of options | ||
| 69 | 71 | # --without-threads: pthreads experimental as of 2020-05 | |
| 70 | 72 | # cf. https://emscripten.org/docs/porting/pthreads.html | |
| 71 | 73 | # --without-signal-module: no process signals in Emscripten | |
@@ -74,14 +76,14 @@ emscripten () { | |||
| 74 | 76 | # --disable-shared: compile statically for Emscripten perfs + incomplete PIC support | |
| 75 | 77 | if [ ! -e config.status ]; then | |
| 76 | 78 | CONFIG_SITE=../config.site BASECFLAGS='-s USE_ZLIB=1' \ | |
| 77 | - PYTHON_FOR_BUILD=$BUILD/Python-$VERSION/native/python \ | ||
| 79 | + PATH=$BUILD/Python-$VERSION/native:$PATH \ | ||
| 78 | 80 | emconfigure ../configure \ | |
| 79 | 81 | --host=asmjs-unknown-emscripten --build=$(../config.guess) \ | |
| 80 | 82 | --prefix='' \ | |
| 81 | 83 | --without-threads --without-pymalloc --without-signal-module --disable-ipv6 \ | |
| 82 | 84 | --disable-shared | |
| 83 | 85 | fi | |
| 84 | - # Fix bad detection | ||
| 86 | + # Fix bad detection | ||
| 85 | 87 | sed -i -e 's,^#define HAVE_GCC_ASM_FOR_X87.*,/* & */,' pyconfig.h | |
| 86 | 88 | ||
| 87 | 89 | # pgen native setup | |
@@ -96,13 +98,15 @@ emscripten () { | |||
| 96 | 98 | # drop -I/-L/-lz, we USE_ZLIB=1 (keep it in SETUPLOCAL for mock) | |
| 97 | 99 | sed -i -e 's/^\(zlib zlibmodule.c\).*/\1/' Modules/Setup.local | |
| 98 | 100 | ||
| 99 | - emmake make -j$(nproc) | ||
| 100 | - | ||
| 101 | - # setup.py install_lib doesn't respect DESTDIR | ||
| 102 | - echo -e 'sharedinstall:\n\ttrue' >> Makefile | ||
| 103 | - # decrease .pyo size by dropping docstrings | ||
| 104 | - sed -i -e '/compileall.py/ s/ -O / -OO /' Makefile | ||
| 105 | - emmake make install DESTDIR=$DESTDIR | ||
| 101 | + ( | ||
| 102 | + export PATH=$BUILD/Python-$VERSION/native:$PATH | ||
| 103 | + emmake make -j$(nproc) | ||
| 104 | + # setup.py install_lib doesn't respect DESTDIR | ||
| 105 | + echo -e 'sharedinstall:\n\ttrue' >> Makefile | ||
| 106 | + # decrease .pyo size by dropping docstrings | ||
| 107 | + sed -i -e '/compileall.py/ s/ -O / -OO /' Makefile | ||
| 108 | + emmake make install DESTDIR=$DESTDIR | ||
| 109 | + ) | ||
| 106 | 110 | ||
| 107 | 111 | # Basic trimming | |
| 108 | 112 | # Disabled for now, better cherry-pick the files we need | |
@@ -201,7 +205,7 @@ case "$1" in | |||
| 201 | 205 | crosspython | |
| 202 | 206 | ;; | |
| 203 | 207 | *) | |
| 204 | - echo "Usage: $0 unpack|native|emscripten" | ||
| 208 | + echo "Usage: $0 unpack|hostpython|emscripten|mock|crosspython" | ||
| 205 | 209 | exit 1 | |
| 206 | 210 | ;; | |
| 207 | 211 | esac | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -56,12 +56,14 @@ emscripten () { | |||
| 56 | 56 | cd emscripten/ | |
| 57 | 57 | # OPT=-Oz: TODO | |
| 58 | 58 | # CONFIG_SITE: deals with cross-compilation https://bugs.python.org/msg136962 | |
| 59 | + # PATH: detect our Python, beware of conflict with emcc's python3 | ||
| 60 | + # don't use PYTHON_FOR_BUILD which is high-level / lots of options | ||
| 59 | 61 | # --without-pymalloc: ? | |
| 60 | 62 | # --disable-ipv6: ? | |
| 61 | - # --disable-shared: compile statically for Emscripten perfs + incomplete PIC support | ||
| 63 | + # --disable-shared: compile statically for Emscripten perfs + incomplete PIC support | ||
| 62 | 64 | if [ ! -e config.status ]; then | |
| 63 | 65 | CONFIG_SITE=../config-emscripten.site BASECFLAGS='-s USE_ZLIB=1' READELF=true \ | |
| 64 | - PYTHON_FOR_BUILD=$BUILD/Python-$VERSION/native/python \ | ||
| 66 | + PATH=$BUILD/Python-$VERSION/native:$PATH \ | ||
| 65 | 67 | emconfigure ../configure \ | |
| 66 | 68 | --host=asmjs-unknown-emscripten --build=$(../config.guess) \ | |
| 67 | 69 | --prefix='' \ | |
@@ -84,11 +86,13 @@ EOF | |||
| 84 | 86 | # decrease .pyo size by dropping docstrings | |
| 85 | 87 | sed -i -e '/compileall.py/ s/ -O / -OO /' Makefile | |
| 86 | 88 | ||
| 87 | - # Trigger setup.py:CROSS_COMPILING (introduced in 3.8) | ||
| 88 | - export _PYTHON_HOST_PLATFORM=emscripten | ||
| 89 | - | ||
| 90 | - emmake make -j$(nproc) | ||
| 91 | - emmake make install DESTDIR=$DESTDIR | ||
| 89 | + ( | ||
| 90 | + export PATH=$BUILD/Python-$VERSION/native:$PATH | ||
| 91 | + # Trigger setup.py:CROSS_COMPILING (introduced in 3.8) | ||
| 92 | + export _PYTHON_HOST_PLATFORM=emscripten | ||
| 93 | + emmake make -j$(nproc) | ||
| 94 | + emmake make install DESTDIR=$DESTDIR | ||
| 95 | + ) | ||
| 92 | 96 | ||
| 93 | 97 | # Basic trimming | |
| 94 | 98 | # Disabled for now, better cherry-pick the files we need | |
@@ -166,14 +170,14 @@ crosspython () { | |||
| 166 | 170 | # Use Python.h configured for WASM | |
| 167 | 171 | ln -s $DESTDIR/include include | |
| 168 | 172 | ||
| 169 | - # TODO: Use compiler settings configured for WASM | ||
| 170 | - #rm lib/python3.8/_sysconfigdata.* | ||
| 171 | - #cp -a $DESTDIR/lib/python3.8/_sysconfigdata.* lib/python3.8/ | ||
| 173 | + # Use compiler settings configured for WASM | ||
| 174 | + cp -a $DESTDIR/lib/python3.8/_sysconfigdata__emscripten_.py \ | ||
| 175 | + lib/python3.8/_sysconfigdata_*.py | ||
| 172 | 176 | ) | |
| 173 | 177 | done | |
| 174 | - # TODO: 'CCSHARED': 'xxx', | ||
| 175 | - #sed -i -e "s/'CCSHARED': .*/'CCSHARED': '-fPIC -s SIDE_MODULE=1',/" \ | ||
| 176 | - # crosspython-dynamic/lib/python3.8/_sysconfigdata.py | ||
| 178 | + # 'CCSHARED': 'xxx', | ||
| 179 | + sed -i -e "s/'CCSHARED': .*/'CCSHARED': '-fPIC -s SIDE_MODULE=1',/" \ | ||
| 180 | + crosspython-dynamic/lib/python3.8/_sysconfigdata_*.py | ||
| 177 | 181 | } | |
| 178 | 182 | ||
| 179 | 183 | case "$1" in | |
@@ -187,7 +191,7 @@ case "$1" in | |||
| 187 | 191 | crosspython | |
| 188 | 192 | ;; | |
| 189 | 193 | *) | |
| 190 | - echo "Usage: $0 unpack|native|emscripten" | ||
| 194 | + echo "Usage: $0 unpack|hostpython|emscripten|mock|crosspython" | ||
| 191 | 195 | exit 1 | |
| 192 | 196 | ;; | |
| 193 | 197 | esac | |
| Back | FazBrowse Home | New Git URL |
0 commit comments