Skip to content

Commit 93239f5

Browse files
committed
emsdk tot + cpython 3.11b1
1 parent 8a086c4 commit 93239f5

File tree

12 files changed

+1213
-129
lines changed

12 files changed

+1213
-129
lines changed

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
open_collective: pythonseverywhere
2+

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on: [push, workflow_dispatch]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v1
10+
- name: pygame-wasm-builder prepare
11+
run: |
12+
WD=$(pwd)
13+
python3 -V
14+
echo $WD
15+
clang --version | head -n 1
16+
echo
17+
gcc --version | head -n 1
18+
echo
19+
env|grep GITHUB
20+
echo
21+
grep "^Pkg.Revision =" ${ANDROID_HOME}/ndk-bundle/source.properties
22+
sudo apt-get update
23+
# git clang libffi-dev libssl-dev zlib1g-dev libncursesw5-dev make
24+
sudo apt-get install -y bash wget
25+
cd $GITHUB_WORKSPACE
26+
time bash ./python-wasm-sdk.sh
27+
28+
- name : "Upload to GitHub pages"
29+
uses: JamesIves/github-pages-deploy-action@4.1.7
30+
with:
31+
branch: gh-pages
32+
folder: sdk

.gitignore

Lines changed: 13 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,13 @@
1-
# Byte-compiled / optimized / DLL files
2-
__pycache__/
3-
*.py[cod]
4-
*$py.class
5-
6-
# C extensions
7-
*.so
8-
9-
# Distribution / packaging
10-
.Python
11-
build/
12-
develop-eggs/
13-
dist/
14-
downloads/
15-
eggs/
16-
.eggs/
17-
lib/
18-
lib64/
19-
parts/
20-
sdist/
21-
var/
22-
wheels/
23-
pip-wheel-metadata/
24-
share/python-wheels/
25-
*.egg-info/
26-
.installed.cfg
27-
*.egg
28-
MANIFEST
29-
30-
# PyInstaller
31-
# Usually these files are written by a python script from a template
32-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33-
*.manifest
34-
*.spec
35-
36-
# Installer logs
37-
pip-log.txt
38-
pip-delete-this-directory.txt
39-
40-
# Unit test / coverage reports
41-
htmlcov/
42-
.tox/
43-
.nox/
44-
.coverage
45-
.coverage.*
46-
.cache
47-
nosetests.xml
48-
coverage.xml
49-
*.cover
50-
*.py,cover
51-
.hypothesis/
52-
.pytest_cache/
53-
54-
# Translations
55-
*.mo
56-
*.pot
57-
58-
# Django stuff:
59-
*.log
60-
local_settings.py
61-
db.sqlite3
62-
db.sqlite3-journal
63-
64-
# Flask stuff:
65-
instance/
66-
.webassets-cache
67-
68-
# Scrapy stuff:
69-
.scrapy
70-
71-
# Sphinx documentation
72-
docs/_build/
73-
74-
# PyBuilder
75-
target/
76-
77-
# Jupyter Notebook
78-
.ipynb_checkpoints
79-
80-
# IPython
81-
profile_default/
82-
ipython_config.py
83-
84-
# pyenv
85-
.python-version
86-
87-
# pipenv
88-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91-
# install all needed dependencies.
92-
#Pipfile.lock
93-
94-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95-
__pypackages__/
96-
97-
# Celery stuff
98-
celerybeat-schedule
99-
celerybeat.pid
100-
101-
# SageMath parsed files
102-
*.sage.py
103-
104-
# Environments
105-
.env
106-
.venv
107-
env/
108-
venv/
109-
ENV/
110-
env.bak/
111-
venv.bak/
112-
113-
# Spyder project settings
114-
.spyderproject
115-
.spyproject
116-
117-
# Rope project settings
118-
.ropeproject
119-
120-
# mkdocs documentation
121-
/site
122-
123-
# mypy
124-
.mypy_cache/
125-
.dmypy.json
126-
dmypy.json
127-
128-
# Pyre type checker
129-
.pyre/
1+
/keystore
2+
/devices
3+
/src
4+
/build
5+
/emsdk/
6+
/wasm32-tot-emscripten-shell.sh
7+
/python-wasm-plus.epj
8+
/.eric6project
9+
/demos
10+
/tests/code
11+
/support/sim.links
12+
/scratchbook/
13+
ATTIC

config

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
export LC_ALL=C
3+
export PYTHONDONTWRITEBYTECODE=1
4+
export REBUILD=${REBUILD:-false}
5+
export ROOT=${ROOT:-$(pwd)}
6+
export HOST_PREFIX=${HOST_PREFIX:-$ROOT/devices/$(arch)/usr}
7+
export PREFIX=${PREFIX:-${ROOT}/devices/emsdk/usr}
8+
export PYTHONPYCACHEPREFIX=$(realpath ${ROOT}/build/pycache)
9+
10+
export HPY=$(echo -n ${HOST_PREFIX}/bin/python3.1?)
11+
export PIP=$(echo -n ${HOST_PREFIX}/bin/pip3.$(echo $HPY|cut -d. -f2))
12+
13+
14+
export CI=${CI:-false}
15+
16+
# cpython build opts
17+
export CPOPTS="-Os -g0 -fPIC"
18+
export CPPFLAGS="-I$PREFIX/include"
19+
export LDFLAGS="-L$PREFIX/lib"
20+
21+
# module build opts
22+
export CFLDPFX="$CPPFLAGS $LDFLAGS -Wno-unused-command-line-argument"
23+
24+
if [ -f dev ]
25+
then
26+
export COPTS="-O0 -g3 -fPIC"
27+
export VERBOSE=""
28+
else
29+
export COPTS="-Os -g0 -fPIC"
30+
export VERBOSE="2>&1 > $PYTHONPYCACHEPREFIX/.log"
31+
fi
32+
33+
#stable
34+
# EMFLAVOUR=latest
35+
#git
36+
EMFLAVOUR=tot
37+
38+
export PYDK_PYTHON_HOST_PLATFORM=wasm32-$EMFLAVOUR-emscripten
39+
40+
if echo $LD_LIBRARY_PATH |grep -q ${HOST}/lib
41+
then
42+
# config already set
43+
echo -n
44+
else
45+
#export LD_LIBRARY_PATH="${HOST_PREFIX}/lib:$LD_LIBRARY_PATH"
46+
export LD_LIBRARY_PATH="${HOST_PREFIX}/lib"
47+
fi
48+
49+
if [[ ! -z ${PYDK+z} ]]
50+
then
51+
# config already set
52+
echo -n
53+
else
54+
mkdir -p src
55+
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
56+
export PATH="${HOST_PREFIX}/bin:$PATH"
57+
export PYDK=minimal
58+
fi

python-wasm-sdk.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
reset
3+
4+
mkdir -p build/pycache
5+
export PYTHONDONTWRITEBYTECODE=1
6+
7+
# make install cpython will force bytecode generation
8+
export PYTHONPYCACHEPREFIX="$(realpath build/pycache)"
9+
10+
. ${CONFIG:-config}
11+
12+
. scripts/cpython-fetch.sh
13+
. support/__EMSCRIPTEN__.sh
14+
. scripts/cpython-build-host.sh >/dev/null
15+
. scripts/cpython-build-host-deps.sh >/dev/null
16+
17+
# use ./ or emsdk will pollute env
18+
./scripts/emsdk-fetch.sh
19+
20+
echo " ------------------- building cpython wasm -----------------------"
21+
if ./scripts/cpython-build-emsdk.sh > /dev/null
22+
then
23+
echo " ------------------- building cpython wasm plus -------------------"
24+
if ./scripts/cpython-build-emsdk-deps.sh > /dev/null
25+
then
26+
echo "make tarball"
27+
mkdir -p sdk
28+
tar -cpR emsdk devices/* prebuilt/* > sdk/stable.tar
29+
else
30+
echo " cpython-build-emsdk-deps failed"
31+
exit 2
32+
fi
33+
34+
else
35+
echo " cpython-build-emsdk failed"
36+
exit 1
37+
fi
38+
39+
echo done

0 commit comments

Comments
 (0)