66# fix /pip/_internal/operations/install/wheel.py
77# for allowing to avoid pyc creation
88
9+ echo "
10+ * building cpython-wasm EMSDK_PYTHON=$SYS_PYTHON
11+ "
12+
913
1014export PYTHON_FOR_BUILD=${PYTHON_FOR_BUILD:- ${HOST_PREFIX} / bin/ python3}
1115
@@ -21,7 +25,7 @@ REBUILD_WASM=${REBUILD_WASMPY:-false}
2125if $REBUILD || $REBUILD_WASMPY
2226then
2327 rm -rf build/cpython-wasm/ build/pycache/config.cache
24- rm build/cpython-wasm/libpython3.?? .a
28+ rm build/cpython-wasm/libpython3.?? .a 2> /dev/null
2529 REBUILD=true
2630fi
2731
6367
6468 emmake make install > /dev/null
6569
70+ unset EMCC_CFLAGS
6671 popd
6772
6873 cp -fv ${PREFIX} /lib/libffi.a $EMSDK /upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/
@@ -126,13 +131,13 @@ else
126131 --build=$( $ROOT /src/cpython/config.guess) \
127132 --with-emscripten-target=browser \
128133 --prefix=$PREFIX \
129- --with-build-python=${PYTHON_FOR_BUILD} $VERBOSE
134+ --with-build-python=${PYTHON_FOR_BUILD} $QUIET
130135
131136 # echo "#define HAVE_NCURSES_H" >> pyconfig.h
132137
133- if EMCC_CFLAGS=" -sUSE_ZLIB -sUSE_BZIP2" eval emmake make -j$( nproc) $VERBOSE
138+ if EMCC_CFLAGS=" -sUSE_ZLIB -sUSE_BZIP2" eval emmake make -j$( nproc) $QUIET
134139 then
135- EMCC_CFLAGS=" -sUSE_ZLIB -sUSE_BZIP2" eval emmake make install $VERBOSE
140+ EMCC_CFLAGS=" -sUSE_ZLIB -sUSE_BZIP2" eval emmake make install $QUIET
136141 else
137142 echo " **** cpython wasm build failed *** "
138143 exit 1
226231 # emsdk_env already parsed
227232 echo -n
228233else
229- pushd $ROOT
230- . scripts/emsdk-fetch.sh
231- popd
234+ . ${ROOT} /config
235+ . ${ROOT} /emsdk/emsdk_env.sh
232236fi
233237
234238export PATH=${HOST_PREFIX} /bin:\$ PATH
@@ -248,19 +252,17 @@ export _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata__emscripten_
248252
249253cat >${PYTHONPYCACHEPREFIX} /.numpy-site.cfg <<NUMPY
250254[DEFAULT]
251- library_dirs = $PREFIX // lib
255+ library_dirs = $PREFIX /lib
252256include_dirs = $PREFIX /include
253257NUMPY
254258
255-
256259END
257260
258261cat > $HOST_PREFIX /bin/python3-wasm << END
259262#!/bin/bash
260263. $ROOT /${PYDK_PYTHON_HOST_PLATFORM} -shell.sh
261264
262265# most important
263- #export EMCC_CFLAGS="-sSIDE_MODULE -DBUILD_STATIC -fPIC"
264266export CC=cc
265267export _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata__emscripten_debug
266268
@@ -280,30 +282,11 @@ export PYTHONPATH=$PYTHONPYCACHEPREFIX/sysconfig:$(echo -n ${HOST_PREFIX}/lib/py
280282export _PYTHON_HOST_PLATFORM=${PYDK_PYTHON_HOST_PLATFORM}
281283export PYTHON_FOR_BUILD=${PYTHON_FOR_BUILD}
282284
283- $HOST_PREFIX /bin/python3.?? -u -B \$ @
285+ $HPY -u -B \$ @
284286END
285287
286288chmod +x $HOST_PREFIX /bin/python3-wasm
287-
288-
289-
290-
291-
292-
293-
294-
295-
296-
297-
298-
299-
300-
301-
302-
303-
304-
305-
306-
289+ cp -f $HOST_PREFIX /bin/python3-wasm ${ROOT} /
307290
308291
309292unset PYTHON_FOR_BUILD
@@ -312,19 +295,3 @@ unset EMCC_CFLAGS
312295
313296
314297
315-
316-
317-
318-
319-
320-
321-
322-
323-
324-
325-
326-
327-
328-
329-
330-
0 commit comments