|
1 | 1 | #!/bin/bash |
2 | 2 | reset |
3 | 3 | . /etc/lsb-release |
4 | | -export CIVER=${CIVER:-$DISTRIB_ID} |
| 4 | +DISTRIB="${DISTRIB_ID}-${DISTRIB_RELEASE}" |
| 5 | + |
5 | 6 | export SDKDIR=/opt/python-wasm-sdk |
6 | | -export PYBUILD=3.11 |
| 7 | +export CIVER=${CIVER:-$DISTRIB} |
| 8 | +export CI=true |
7 | 9 |
|
8 | 10 |
|
9 | 11 | sudo mkdir -p ${SDKDIR} |
10 | 12 | sudo chmod 777 ${SDKDIR} |
11 | 13 |
|
12 | | -cp -Rf * ${SDKDIR}/ |
13 | | - |
14 | | -if cd ${SDKDIR}/ |
15 | | -then |
16 | | - pwd |
17 | | - mkdir -p build/pycache |
18 | | - export PYTHONDONTWRITEBYTECODE=1 |
| 14 | +ORIGIN=$(pwd) |
19 | 15 |
|
20 | | - # make install cpython will force bytecode generation |
21 | | - export PYTHONPYCACHEPREFIX="$(realpath build/pycache)" |
| 16 | +# 3.12 3.11 3.10 |
22 | 17 |
|
23 | | - . ${CONFIG:-config} |
| 18 | +for PYBUILD in 3.12 3.11 |
| 19 | +do |
| 20 | + cd "$ORIGIN" |
24 | 21 |
|
25 | | - . scripts/cpython-fetch.sh |
26 | | - . support/__EMSCRIPTEN__.sh |
27 | | - . scripts/cpython-build-host.sh |
28 | | -# >/dev/null |
29 | | - . scripts/cpython-build-host-deps.sh |
30 | | -# >/dev/null |
| 22 | + rm -rf ${SDKDIR}/* |
31 | 23 |
|
32 | | - # use ./ or emsdk will pollute env |
33 | | - ./scripts/emsdk-fetch.sh |
| 24 | + cp -Rf * ${SDKDIR}/ |
34 | 25 |
|
35 | | - echo " ------------------- building cpython wasm $PYBUILD $CIVER -----------------------" |
36 | | - if ./scripts/cpython-build-emsdk.sh > /dev/null |
| 26 | + if cd ${SDKDIR}/ |
37 | 27 | then |
38 | | - echo " ------------------- building cpython wasm plus $PYBUILD $CIVER -------------------" |
39 | | - if ./scripts/cpython-build-emsdk-deps.sh > /dev/null |
| 28 | + pwd |
| 29 | + mkdir -p build/pycache |
| 30 | + export PYTHONDONTWRITEBYTECODE=1 |
| 31 | + |
| 32 | + # make install cpython will force bytecode generation |
| 33 | + export PYTHONPYCACHEPREFIX="$(realpath build/pycache)" |
| 34 | + |
| 35 | + . ${CONFIG:-config} |
| 36 | + |
| 37 | + . scripts/cpython-fetch.sh |
| 38 | + . support/__EMSCRIPTEN__.sh |
| 39 | + . scripts/cpython-build-host.sh |
| 40 | + # >/dev/null |
| 41 | + . scripts/cpython-build-host-deps.sh |
| 42 | + # >/dev/null |
| 43 | + |
| 44 | + # use ./ or emsdk will pollute env |
| 45 | + ./scripts/emsdk-fetch.sh |
| 46 | + |
| 47 | + echo " ------------------- building cpython wasm $PYBUILD $CIVER -----------------------" |
| 48 | + if ./scripts/cpython-build-emsdk.sh > /dev/null |
40 | 49 | then |
41 | | - echo "making tarball" |
42 | | - cd / |
43 | | - mkdir -p /tmp/sdk |
44 | | - tar -cpPR \ |
45 | | - ${SDKDIR}/config \ |
46 | | - ${SDKDIR}/build/pycache/.??* \ |
47 | | - ${SDKDIR}/build/pycache/sysconfig/_sysconfigdata__emscripten_debug.py \ |
48 | | - ${SDKDIR}/python3-wasm \ |
49 | | - ${SDKDIR}/wasm32-*-shell.sh \ |
50 | | - ${SDKDIR}/emsdk \ |
51 | | - ${SDKDIR}/devices/* \ |
52 | | - ${SDKDIR}/prebuilt/* \ |
53 | | - > /tmp/sdk/python${PYBUILD}-wasm-sdk-${CIVER}.tar |
54 | | - lz4 -c --favor-decSpeed --best /tmp/sdk/python${PYBUILD}-wasm-sdk-${CIVER}.tar \ |
55 | | - > /tmp/sdk/python${PYBUILD}-wasm-sdk-${CIVER}.tar.lz4 |
56 | | - # bzip2 will remove original |
57 | | - bzip2 -9 /tmp/sdk/python${PYBUILD}-wasm-sdk-${CIVER}.tar |
| 50 | + echo " ------------------- building cpython wasm plus $PYBUILD $CIVER -------------------" |
| 51 | + if ./scripts/cpython-build-emsdk-deps.sh > /dev/null |
| 52 | + then |
| 53 | + echo "making tarball" |
| 54 | + cd / |
| 55 | + mkdir -p /tmp/sdk |
| 56 | + tar -cpPR \ |
| 57 | + ${SDKDIR}/config \ |
| 58 | + ${SDKDIR}/build/pycache/.??* \ |
| 59 | + ${SDKDIR}/build/pycache/sysconfig/_sysconfigdata__emscripten_debug.py \ |
| 60 | + ${SDKDIR}/python3-wasm \ |
| 61 | + ${SDKDIR}/wasm32-*-shell.sh \ |
| 62 | + ${SDKDIR}/emsdk \ |
| 63 | + ${SDKDIR}/devices/* \ |
| 64 | + ${SDKDIR}/prebuilt/* \ |
| 65 | + > /tmp/sdk/python${PYBUILD}-wasm-sdk-${CIVER}.tar |
| 66 | + lz4 -c --favor-decSpeed --best /tmp/sdk/python${PYBUILD}-wasm-sdk-${CIVER}.tar \ |
| 67 | + > /tmp/sdk/python${PYBUILD}-wasm-sdk-${CIVER}.tar.lz4 |
| 68 | + # bzip2 will remove original |
| 69 | + bzip2 -9 /tmp/sdk/python${PYBUILD}-wasm-sdk-${CIVER}.tar |
| 70 | + else |
| 71 | + echo " cpython-build-emsdk-deps failed" |
| 72 | + exit 2 |
| 73 | + fi |
58 | 74 | else |
59 | | - echo " cpython-build-emsdk-deps failed" |
60 | | - exit 2 |
| 75 | + echo " cpython-build-emsdk failed" |
| 76 | + exit 1 |
61 | 77 | fi |
| 78 | + |
| 79 | + echo done |
62 | 80 | else |
63 | | - echo " cpython-build-emsdk failed" |
64 | | - exit 1 |
| 81 | + echo failed |
65 | 82 | fi |
66 | | - |
67 | | - echo done |
68 | | -else |
69 | | - echo failed |
70 | | -fi |
| 83 | +done |
0 commit comments