Skip to content

Commit 2688a17

Browse files
committed
Use make python.html and config.site
CPython upstream now has a config.site for WASM `and make python.html`. See: python/cpython#29984 Signed-off-by: Christian Heimes <christian@python.org>
1 parent 725e017 commit 2688a17

File tree

1 file changed

+6
-50
lines changed

1 file changed

+6
-50
lines changed

build-python-host-emscripten.sh

+6-50
Original file line numberDiff line numberDiff line change
@@ -3,61 +3,17 @@
33
shopt -s extglob
44

55
mkdir -p cpython/builddir/host
6-
mkdir -p cpython/builddir/usr/local
76

87
# install emcc ports so configure is able to detect the dependencies
98
embuilder build zlib
109

1110
pushd cpython/builddir/host
12-
cp ../../../config.site-wasm config.site-wasm
13-
CONFIG_SITE=config.site-wasm READELF=true ZLIB_LIBS="-s USE_ZLIB" emconfigure ../../configure -C --without-pymalloc --with-pydebug --host=wasm32-unknown-emscripten --build=$(../../config.guess) --with-build-python=$(pwd)/../build/python --with-freeze-module=$(pwd)/../build/Programs/_freeze_module
11+
CONFIG_SITE=../../Tools/wasm/config.site-wasm32-emscripten \
12+
emconfigure ../../configure -C \
13+
--host=wasm32-unknown-emscripten \
14+
--build=$(../../config.guess) \
15+
--with-build-python=$(pwd)/../build/python
1416

15-
# Use Setup.stdlib and force rebuild of Makefile
16-
ln -sfr Modules/Setup.stdlib Modules/Setup.local
17-
rm Modules/config.c
18-
make Modules/config.c
17+
emmake make -j$(nproc) python.html
1918

20-
emmake make -j$(nproc)
21-
make altinstall prefix=../usr/local
22-
23-
pushd ../usr/local
24-
# not needed, as the binary is already loaded by the .html
25-
# includes aren't need for distribution, various libraries
26-
# won't be used in the web (at least for now)
27-
rm -rf bin include lib/pkgconfig lib/libpython3.11d.a
28-
rm -f lib/python3.11/_aix_support.py
29-
rm -f lib/python3.11/_bootsubprocess.py
30-
rm -rf lib/python3.11/_osx_support.py
31-
rm -f lib/python3.11/antigravity.py
32-
rm -rf lib/python3.11/asyncio
33-
rm -rf lib/python3.11/concurrent
34-
rm -rf lib/python3.11/config-3.11*
35-
rm -rf lib/python3.11/ctypes
36-
rm -rf lib/python3.11/curses
37-
rm -rf lib/python3.11/dbm
38-
rm -rf lib/python3.11/distutils
39-
rm -rf lib/python3.11/encoding/*.py
40-
rm -rf lib/python3.11/ensurepip
41-
rm -rf lib/python3.11/idlelib
42-
rm -rf lib/python3.11/lib2to3
43-
rm -rf lib/python3.11/multiprocessing
44-
rm -rf lib/python3.11/pydoc_data
45-
rm -rf lib/python3.11/test
46-
rm -rf lib/python3.11/tkinter
47-
rm -rf lib/python3.11/turtle.py
48-
rm -rf lib/python3.11/turtledemo
49-
rm -rf lib/python3.11/venv
50-
rm -f lib/python3.11/webbrowser.py
51-
rm -rf lib/python3.11/wsgiref
52-
find lib/python3.11 -type f \( -iname \*.opt-1.pyc -o -iname \*.opt-2.pyc \) -delete
53-
# os.py is a marker for finding the correct lib directory
54-
# so its important to keep
55-
cd lib/python3.11
56-
zip -9 -r ../python311.zip * -x lib/python3.11/os.py
57-
rm -vrf !(os.py|encoding/__pycache__)
58-
cd ../..
59-
mkdir -p lib/python3.11/lib-dynload
60-
touch lib/python3.11/lib-dynload/.gitignore
61-
popd
62-
emcc -Os -o python.html Programs/python.o libpython3.11d.a Modules/_decimal/libmpdec/libmpdec.a Modules/expat/libexpat.a -ldl -lm -s USE_ZLIB -s ASSERTIONS=1 --preload-file ../usr
6319
popd

0 commit comments

Comments
 (0)