Skip to content

Commit ac2b4b6

Browse files
committed
switch to multiversion and stick to /etc/lsb-release codes
1 parent c99358d commit ac2b4b6

File tree

6 files changed

+72
-57
lines changed

6 files changed

+72
-57
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ jobs:
3737
- name: Install dependencies
3838
run: |
3939
sudo apt-get update --fix-missing
40-
# git clang libffi-dev libssl-dev zlib1g-dev libncursesw5-dev python3-pip make
41-
sudo apt-get install -y bash wget lz4
40+
# git clang libffi-dev libssl-dev zlib1g-dev pkg-config libncursesw5-dev python3-pip make
41+
sudo apt-get install -y bash patchelf wget lz4
4242
4343
- name: Build sdk
4444
run: |
4545
chmod +x ./python-wasm-sdk.sh
46-
bash -c "CIVER=ubuntu-22.04 ./python-wasm-sdk.sh"
46+
bash -c "./python-wasm-sdk.sh"
4747
4848
- name: Upload sdk to Github artifacts
4949
uses: actions/upload-artifact@v2

python-wasm-sdk.sh

Lines changed: 63 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,83 @@
11
#!/bin/bash
22
reset
33
. /etc/lsb-release
4-
export CIVER=${CIVER:-$DISTRIB_ID}
4+
DISTRIB="${DISTRIB_ID}-${DISTRIB_RELEASE}"
5+
56
export SDKDIR=/opt/python-wasm-sdk
6-
export PYBUILD=3.11
7+
export CIVER=${CIVER:-$DISTRIB}
8+
export CI=true
79

810

911
sudo mkdir -p ${SDKDIR}
1012
sudo chmod 777 ${SDKDIR}
1113

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)
1915

20-
# make install cpython will force bytecode generation
21-
export PYTHONPYCACHEPREFIX="$(realpath build/pycache)"
16+
# 3.12 3.11 3.10
2217

23-
. ${CONFIG:-config}
18+
for PYBUILD in 3.12 3.11
19+
do
20+
cd "$ORIGIN"
2421

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}/*
3123

32-
# use ./ or emsdk will pollute env
33-
./scripts/emsdk-fetch.sh
24+
cp -Rf * ${SDKDIR}/
3425

35-
echo " ------------------- building cpython wasm $PYBUILD $CIVER -----------------------"
36-
if ./scripts/cpython-build-emsdk.sh > /dev/null
26+
if cd ${SDKDIR}/
3727
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
4049
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
5874
else
59-
echo " cpython-build-emsdk-deps failed"
60-
exit 2
75+
echo " cpython-build-emsdk failed"
76+
exit 1
6177
fi
78+
79+
echo done
6280
else
63-
echo " cpython-build-emsdk failed"
64-
exit 1
81+
echo failed
6582
fi
66-
67-
echo done
68-
else
69-
echo failed
70-
fi
83+
done

scripts/cpython-build-host-deps.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
. ${CONFIG:-config}
22

33
echo "
4-
*cpython-build-host-deps pip==$PIP *
4+
* cpython-build-host-deps pip==$PIP *
55
" 1>&2
66

77

scripts/cpython-build-host.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ mkdir -p build/cpython-host
99
if $REBUILD
1010
then
1111
echo "
12-
* building cpython $PYBUILD $CIVER
12+
* building CPython $PYBUILD for $CIVER
1313
"
1414
else
1515
if [ -f ${PYTHON_FOR_BUILD} ]

scripts/cpython-fetch.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
. ${CONFIG:-config}
44

55
echo "
6-
*cpython-fetch $PYBUILD*
6+
* cpython-fetch $PYBUILD *
77
"
88

99

@@ -31,7 +31,7 @@ then
3131
#cat $ROOT/support/compilenone.py > ./Lib/compileall.py
3232
popd
3333
else
34-
git clone --depth 1 https://github.com/python/cpython.git cpython-git
34+
git clone --no-tags --depth 1 --single-branch --branch main https://github.com/python/cpython.git cpython-git
3535
export REBUILD=true
3636
fi
3737

scripts/emsdk-fetch.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ then
8181
embuilder --pic build sdl2
8282
embuilder build sdl2
8383
rm -rf ${SDKDIR}/emsdk/upstream/emscripten/cache/ports/sdl2/SDL-*
84+
rm -rf ${SDKDIR}/emsdk/upstream/emscripten/cache/ports
85+
rm -rf ${SDKDIR}/emsdk/upstream/emscripten/cache/ports-builds
8486
rm -rf ${SDKDIR}/emsdk/upstream/emscripten/tests
8587
fi
8688

0 commit comments

Comments
 (0)