Skip to content

Commit c740403

Browse files
committed
3.1.52pre
1 parent 9f18675 commit c740403

File tree

10 files changed

+155
-136
lines changed

10 files changed

+155
-136
lines changed

python-wasi-sdk.sh

Lines changed: 52 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,19 @@ ORIGIN=$(pwd)
3232

3333
# 3.12 3.11 3.10
3434

35-
BUILDS=${BUILDS:-3.12 3.11}
35+
BUILDS=${BUILDS:-3.11 3.12}
3636

3737
for PYBUILD in $BUILDS
3838
do
3939
cd "$ORIGIN"
4040

41+
if echo $PYBUILD|grep -q 12$
42+
then
43+
wasisdk=true
44+
else
45+
wasisdk=false
46+
fi
47+
4148
if [ -f ${SDKROOT}/dev ]
4249
then
4350
echo "${SDKROOT}/dev found : using build cache"
@@ -77,36 +84,14 @@ do
7784

7885
fi
7986

80-
cd ${SDKROOT}
81-
82-
if $wasisdk
83-
then
84-
echo WASI SDK TODO
85-
> ${SDKROOT}/python3-wasi
8687

87-
# ROOT=/opt/python-wasm-sdk SDKROOT=/opt/python-wasm-sdk
88-
# HOST_PREFIX=/opt/python-wasm-sdk/devices/$(arch)/usr
89-
> ${SDKROOT}/wasm32-wasi-shell.sh
90-
91-
CPU=wasm32 TARGET=wasi \
92-
PYDK_PYTHON_HOST_PLATFORM=wasm32-wasi \
93-
PREFIX=/opt/python-wasm-sdk/devices/wasi/usr \
94-
./scripts/make-shells.sh
95-
96-
cat >> $ROOT/wasm32-wasi-shell.sh <<END
97-
98-
export PS1="[PyDK:wasisdk] \w $ "
99-
100-
END
101-
102-
chmod +x ${SDKROOT}/python3-wasi ${SDKROOT}/wasm32-wasi-shell.sh
103-
104-
mkdir -p src build ${SDKROOT}/devices/wasi ${SDKROOT}/prebuilt/wasisdk
105-
106-
fi
10788

10889
if $emsdk
10990
then
91+
cd ${SDKROOT}
92+
93+
mkdir -p src build ${SDKROOT}/devices/emsdk ${SDKROOT}/prebuilt/emsdk
94+
11095
# use ./ or emsdk will pollute env
11196
./scripts/emsdk-fetch.sh
11297

@@ -140,16 +125,54 @@ END
140125
fi
141126
else
142127
echo " cpython-build-emsdk failed" 1>&2
143-
exit 128
128+
exit 119
144129
fi
145130

131+
fi
132+
133+
# compile wasi last because of configure patches
134+
135+
if $wasisdk
136+
then
137+
cd ${SDKROOT}
138+
139+
mkdir -p src build ${SDKROOT}/devices/wasisdk ${SDKROOT}/prebuilt/wasisdk
140+
141+
# do not source to protect env
142+
./scripts/cpython-build-wasisdk.sh
143+
144+
> ${SDKROOT}/python3-wasi
145+
146+
# ROOT=/opt/python-wasm-sdk SDKROOT=/opt/python-wasm-sdk
147+
# HOST_PREFIX=/opt/python-wasm-sdk/devices/$(arch)/usr
148+
> ${SDKROOT}/wasm32-wasi-shell.sh
149+
150+
CPU=wasm32 TARGET=wasi \
151+
PYDK_PYTHON_HOST_PLATFORM=wasm32-wasi \
152+
PREFIX=/opt/python-wasm-sdk/devices/wasi/usr \
153+
./scripts/make-shells.sh
154+
155+
cat >> $ROOT/wasm32-wasi-shell.sh <<END
156+
#!/bin/bash
157+
pushd ${SDKROOT}
158+
. scripts/wasisdk-fetch.sh
159+
popd
160+
161+
export PS1="[PyDK:wasisdk] \w $ "
162+
163+
END
164+
165+
chmod +x ${SDKROOT}/python3-wasi ${SDKROOT}/wasm32-wasi-shell.sh
166+
167+
168+
146169
fi
147170

148171
. ${SDKROOT}/scripts/pack-sdk.sh
149172

150173
else
151174
echo "cd failed" 1>&2
152-
exit 137
175+
exit 156
153176
fi
154177
done
155178

python-wasm-sdk.sh

Lines changed: 52 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,19 @@ ORIGIN=$(pwd)
3232

3333
# 3.12 3.11 3.10
3434

35-
BUILDS=${BUILDS:-3.12 3.11}
35+
BUILDS=${BUILDS:-3.11 3.12}
3636

3737
for PYBUILD in $BUILDS
3838
do
3939
cd "$ORIGIN"
4040

41+
if echo $PYBUILD|grep -q 12$
42+
then
43+
wasisdk=true
44+
else
45+
wasisdk=false
46+
fi
47+
4148
if [ -f ${SDKROOT}/dev ]
4249
then
4350
echo "${SDKROOT}/dev found : using build cache"
@@ -77,36 +84,14 @@ do
7784

7885
fi
7986

80-
cd ${SDKROOT}
81-
82-
if $wasisdk
83-
then
84-
echo WASI SDK TODO
85-
> ${SDKROOT}/python3-wasi
8687

87-
# ROOT=/opt/python-wasm-sdk SDKROOT=/opt/python-wasm-sdk
88-
# HOST_PREFIX=/opt/python-wasm-sdk/devices/$(arch)/usr
89-
> ${SDKROOT}/wasm32-wasi-shell.sh
90-
91-
CPU=wasm32 TARGET=wasi \
92-
PYDK_PYTHON_HOST_PLATFORM=wasm32-wasi \
93-
PREFIX=/opt/python-wasm-sdk/devices/wasi/usr \
94-
./scripts/make-shells.sh
95-
96-
cat >> $ROOT/wasm32-wasi-shell.sh <<END
97-
98-
export PS1="[PyDK:wasisdk] \w $ "
99-
100-
END
101-
102-
chmod +x ${SDKROOT}/python3-wasi ${SDKROOT}/wasm32-wasi-shell.sh
103-
104-
mkdir -p src build ${SDKROOT}/devices/wasi ${SDKROOT}/prebuilt/wasisdk
105-
106-
fi
10788

10889
if $emsdk
10990
then
91+
cd ${SDKROOT}
92+
93+
mkdir -p src build ${SDKROOT}/devices/emsdk ${SDKROOT}/prebuilt/emsdk
94+
11095
# use ./ or emsdk will pollute env
11196
./scripts/emsdk-fetch.sh
11297

@@ -140,16 +125,54 @@ END
140125
fi
141126
else
142127
echo " cpython-build-emsdk failed" 1>&2
143-
exit 128
128+
exit 119
144129
fi
145130

131+
fi
132+
133+
# compile wasi last because of configure patches
134+
135+
if $wasisdk
136+
then
137+
cd ${SDKROOT}
138+
139+
mkdir -p src build ${SDKROOT}/devices/wasisdk ${SDKROOT}/prebuilt/wasisdk
140+
141+
# do not source to protect env
142+
./scripts/cpython-build-wasisdk.sh
143+
144+
> ${SDKROOT}/python3-wasi
145+
146+
# ROOT=/opt/python-wasm-sdk SDKROOT=/opt/python-wasm-sdk
147+
# HOST_PREFIX=/opt/python-wasm-sdk/devices/$(arch)/usr
148+
> ${SDKROOT}/wasm32-wasi-shell.sh
149+
150+
CPU=wasm32 TARGET=wasi \
151+
PYDK_PYTHON_HOST_PLATFORM=wasm32-wasi \
152+
PREFIX=/opt/python-wasm-sdk/devices/wasi/usr \
153+
./scripts/make-shells.sh
154+
155+
cat >> $ROOT/wasm32-wasi-shell.sh <<END
156+
#!/bin/bash
157+
pushd ${SDKROOT}
158+
. scripts/wasisdk-fetch.sh
159+
popd
160+
161+
export PS1="[PyDK:wasisdk] \w $ "
162+
163+
END
164+
165+
chmod +x ${SDKROOT}/python3-wasi ${SDKROOT}/wasm32-wasi-shell.sh
166+
167+
168+
146169
fi
147170

148171
. ${SDKROOT}/scripts/pack-sdk.sh
149172

150173
else
151174
echo "cd failed" 1>&2
152-
exit 137
175+
exit 156
153176
fi
154177
done
155178

scripts/cpython-fetch.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ then
6666
# export REBUILD=true
6767
# fi
6868

69-
wget -q -c https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tar.xz
70-
tar xf Python-3.12.0.tar.xz
71-
ln -s Python-3.12.0 cpython${PYBUILD}
69+
wget -q -c https://www.python.org/ftp/python/3.12.1/Python-3.12.1.tar.xz
70+
tar xf Python-3.12.1.tar.xz
71+
ln -s Python-3.12.1 cpython${PYBUILD}
7272
export REBUILD=true
7373
fi
7474

scripts/wasisdk-fetch.sh

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ then
1212

1313

1414
export CMAKE_TOOLCHAIN_FILE=${SDKROOT}/wasisdk/share/cmake/Modules/Platform/WASI.cmake
15-
export CMAKE_INSTALL_PREFIX="${SDKROOT}/devices/wasi/usr"
15+
export CMAKE_INSTALL_PREFIX="${SDKROOT}/devices/wasisdk/usr"
1616

1717
if [ -d ${WASI_SDK_PREFIX} ]
1818
then
@@ -24,19 +24,21 @@ then
2424
else
2525
export LC_ALL=C
2626
pushd wasisdk
27-
wget -c https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz
28-
tar xfz wasi-sdk-20.0-linux.tar.gz
29-
mv wasi-sdk-20.0 upstream && rm wasi-sdk-20.0-linux.tar.gz
27+
WASI_SDK=21
28+
wget -c https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK}/wasi-sdk-${WASI_SDK}.0-linux.tar.gz
29+
tar xfz wasi-sdk-${WASI_SDK}.0-linux.tar.gz
30+
mv wasi-sdk-${WASI_SDK}.0 upstream && rm wasi-sdk-${WASI_SDK}.0-linux.tar.gz
31+
3032
ln ${SDKROOT}/wasisdk/bin/wasi ${SDKROOT}/wasisdk/bin/wasi-c
3133
ln ${SDKROOT}/wasisdk/bin/wasi ${SDKROOT}/wasisdk/bin/wasi-cpp
3234
ln ${SDKROOT}/wasisdk/bin/wasi ${SDKROOT}/wasisdk/bin/wasi-c++
3335
popd
3436

3537
$HPIP install cmake wasmtime
3638

37-
mkdir -p ${SDKROOT}/wasisdk/share/cmake/Modules/Platform/
39+
mkdir -p ${SDKROOT}/wasisdk/share/cmake/Modules/Platform/
3840

39-
cat > ${CMAKE_TOOLCHAIN_FILE} <<END
41+
cat > ${CMAKE_TOOLCHAIN_FILE} <<END
4042
# Cmake toolchain description file for the Makefile
4143
4244
# set(CMAKE_TOOLCHAIN_FILE "${CMAKE_TOOLCHAIN_FILE}")
@@ -146,12 +148,12 @@ set(CMAKE_CROSSCOMPILING_EMULATOR "${WASISDK}/bin/wasi-run" FILEPATH "Path to th
146148
147149
END
148150

149-
# cp ${SDKROOT}/wasisdk/share/cmake/Modules/Platform/WASI.cmake ${SDKROOT}/devices/$(arch)/usr/lib/python${PYBUILD}/site-packages/cmake/data/share/cmake-*/Modules/Platform/
151+
# cp ${SDKROOT}/wasisdk/share/cmake/Modules/Platform/WASI.cmake ${SDKROOT}/devices/$(arch)/usr/lib/python${PYBUILD}/site-packages/cmake/data/share/cmake-*/Modules/Platform/
150152

151-
pushd ${WASI_SYSROOT}
152-
wget "https://github.com/vmware-labs/webassembly-language-runtimes/releases/download/libs%2Flibpng%2F1.6.39%2B20230629-ccb4cb0/libpng-1.6.39-wasi-sdk-20.0.tar.gz" -O-| tar xvfz -
153-
wget "https://github.com/vmware-labs/webassembly-language-runtimes/releases/download/libs%2Fzlib%2F1.2.13%2B20230623-2993864/libz-1.2.13-wasi-sdk-20.0.tar.gz" -O-| tar xvfz -
154-
popd
153+
pushd ${WASI_SYSROOT}
154+
wget "https://github.com/vmware-labs/webassembly-language-runtimes/releases/download/libs%2Flibpng%2F1.6.39%2B20230629-ccb4cb0/libpng-1.6.39-wasi-sdk-20.0.tar.gz" -O-| tar xvfz -
155+
wget "https://github.com/vmware-labs/webassembly-language-runtimes/releases/download/libs%2Fzlib%2F1.2.13%2B20230623-2993864/libz-1.2.13-wasi-sdk-20.0.tar.gz" -O-| tar xvfz -
156+
popd
155157

156158

157159
fi
@@ -181,25 +183,6 @@ END
181183
export CPP="${WASISDK}/bin/wasi-cpp"
182184
export CXX="${WASISDK}/bin/wasi-c++"
183185

184-
185-
# WASI_CFG="--sysroot=${WASI_SDK_PREFIX}/share/wasi-sysroot -I${WASISDK}/hotfix"
186-
# WASI_DEF="-D_WASI_EMULATED_MMAN -D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_PROCESS_CLOCKS -D_WASI_EMULATED_GETPID"
187-
188-
# # wasi assembly
189-
# WASI_ALL="${WASI_CFG} ${WASI_DEF} -fPIC -fno-rtti -fno-exceptions"
190-
191-
# WASI_ALL="$WASI_ALL -Wno-unused-but-set-variable -Wno-unused-command-line-argument -Wno-unsupported-floating-point-opt"
192-
193-
# # wasi linking
194-
# WASI_LNK="-lwasi-emulated-getpid -lwasi-emulated-mman -lwasi-emulated-signal -lwasi-emulated-process-clocks -lc++experimental -fno-exceptions"
195-
196-
# CXX_LIBS="-lc++ -lc++abi -lc++experimental"
197-
198-
# export CC="${WASI_SDK_PREFIX}/bin/clang ${WASI_ALL}"
199-
# export CXX="${WASI_SDK_PREFIX}/bin/clang++ ${WASI_ALL} ${CXX_LIBS}"
200-
# export CPP="${WASI_SDK_PREFIX}/bin/clang-cpp ${WASI_CFG} ${WASI_DEF}"
201-
202-
203186
else
204187
echo "wasidk: config already set !" 1>&2
205188
fi

support/__EMSCRIPTEN__.patches/3.11/asyncio/wasm_events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ def _set_nodelay(sock):
538538

539539
class EmPipe:
540540
def _close_self_pipe(self):
541-
pdb("_close_self_pipe(self)")
541+
#pdb("_close_self_pipe(self)")
542542
return
543543

544544
self._remove_reader(self._ssock.fileno())

support/__EMSCRIPTEN__.patches/3.12/asyncio/wasm_events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def _set_nodelay(sock):
142142

143143
class EmPipe:
144144
def _close_self_pipe(self):
145-
pdb("_close_self_pipe(self)")
145+
#pdb("_close_self_pipe(self)")
146146
return
147147

148148
self._remove_reader(self._ssock.fileno())

support/__EMSCRIPTEN__.patches/3.13/asyncio/wasm_events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def _set_nodelay(sock):
142142

143143
class EmPipe:
144144
def _close_self_pipe(self):
145-
pdb("_close_self_pipe(self)")
145+
#pdb("_close_self_pipe(self)")
146146
return
147147

148148
self._remove_reader(self._ssock.fileno())

0 commit comments

Comments
 (0)