22reset
33
44if [ $UID -ne 0 ]; then
5- echo " not UID 0, assuming not docker"
5+ echo " not UID 0, assuming no docker/proot "
66else
7- echo " UID 0, assuming docker debian:stable"
8- apt-get update && apt-get --yes install build-essential clang autoconf wget curl lz4 lsb-release zlib1g-dev libssl-dev git
7+ if [ -f /alpine ]
8+ then
9+ echo " UID 0, with alpine proot"
10+
11+ else
12+ echo " UID 0, assuming docker debian:stable"
13+ apt-get update && apt-get --yes install build-essential clang autoconf wget curl lz4 lsb-release zlib1g-dev libssl-dev git
14+ fi
915fi
1016
17+
1118[ -f ../config ] && . ../config
1219
1320# TODO: check how dbg tools work with default settings
2027 SYS_PYTHON=$( which python)
2128fi
2229
30+ which strip || cp /bin/true /usr/bin/strip
31+
32+ pause () {
33+ if ${CI}
34+ then
35+ echo -n
36+ else
37+ echo " <paused> press enter ..."
38+ read
39+ fi
40+ }
41+
42+
2343DISTRIB_RELEASE=${DISTRIB_RELEASE:- any}
2444
2545# is it linux enough ?
3959 export DISTRIB_ID=$( $SYS_PYTHON -E -c " print(__import__('sysconfig').get_config_var('HOST_GNU_TYPE'))" )
4060 export PLATFORM=$( $SYS_PYTHON -E -c " print(__import__('sys').platform)" )
4161 echo no /etc/lsb-release found, please identify platform $PLATFORM : \" ${DISTRIB_ID} -${DISTRIB_RELEASE} \" or hit enter to continue
42- read
62+ pause
4363 fi
4464fi
4565
@@ -48,7 +68,7 @@ export DISTRIB="${DISTRIB_ID}-${DISTRIB_RELEASE}"
4868export SDKROOT=${SDKROOT:-/ tmp/ sdk}
4969
5070# default is behave like a CI
51- export CI={CI:-true}
71+ export CI=$ {CI:- true}
5272
5373# maybe have ci flavours later
5474export CIVER=${CIVER:- $DISTRIB }
156176 cd ${SDKROOT}
157177 . scripts/cpython-fetch.sh
158178
179+ pause
180+
159181 cd ${SDKROOT}
160182
161183 # generic wasm patchwork
162184 . support/__EMSCRIPTEN__.sh
163185
186+ pause
187+
164188 . scripts/cpython-build-host.sh 2>&1 > /tmp/python-wasm-sdk.log
165189
166- [ -f $HPY ] || exit 100
190+ pause
191+
192+ if [ -f $HPY ]
193+ then
194+ pause
195+ else
196+ cat /tmp/python-wasm-sdk.log
197+ exit 192
198+ fi
167199
168200 . scripts/cpython-build-host-deps.sh > /dev/null
169201
202+ pause
203+
170204 fi
171205
172- [ -f $HPY ] || exit 106
173206
174207
175- cat > /opt/python-wasm-sdk /devices/$( arch) /usr/bin/py << END
208+ cat > ${SDKROOT} /devices/$( arch) /usr/bin/py << END
176209#!/bin/bash
177210export XDG_SESSION_TYPE=x11
178211export SDKROOT=${SDKROOT}
@@ -183,20 +216,20 @@ export PATH=${SDKROOT}/devices/$(arch)/usr/bin:\$PATH
183216export LD_LIBRARY_PATH=${SDKROOT} /devices/$( arch) /usr/lib:${SDKROOT} /devices/$( arch) /usr/lib64:$LD_LIBRARY_PATH
184217${SDKROOT} /devices/$( arch) /usr/bin/python\$ {PYBUILD:-$PYBUILD } \$ @
185218END
186- chmod +x /opt/python-wasm-sdk /devices/$( arch) /usr/bin/py
219+ chmod +x ${SDKROOT} /devices/$( arch) /usr/bin/py
187220
188221 # always install wasmtime because wasm-objdump needs it.
189- if [ -f ${SDKROOT} /devices/$( arch) /usr/bin/wastime ]
222+ if [ -f ${SDKROOT} /devices/$( arch) /usr/bin/wasmtime ]
190223 then
191224 echo " keeping installed wasmtime and wasi binaries"
192225 else
193226 # wget https://github.com/bytecodealliance/wasmtime/releases/download/v22.0.0/wasmtime-v22.0.0-x86_64-linux.tar.xz
194227 # wget https://github.com/bytecodealliance/wasmtime/releases/download/v26.0.1/wasmtime-v26.0.1-$(arch)-$(PLATFORM).tar.xz
195228 # wget https://github.com/bytecodealliance/wasmtime/releases/download/v27.0.0/wasmtime-v27.0.0-$(arch)-${PLATFORM}.tar.xz
196- #
229+ # wget https://github.com/bytecodealliance/wasmtime/releases/download/v29.0.1/wasmtime-v29.0.1-$(arch)-${PLATFORM}.tar.xz
197230# TODO: window only has a zip archive, better use wasmtime-py instead.
198231
199- wget https://github.com/bytecodealliance/wasmtime/releases/download/v29 .0.1 /wasmtime-v29 .0.1 -$( arch) -${PLATFORM} .tar.xz \
232+ wget https://github.com/bytecodealliance/wasmtime/releases/download/v33 .0.0 /wasmtime-v33 .0.0 -$( arch) -${PLATFORM} .tar.xz \
200233 -O-| xzcat| tar xfv -
201234 mv -vf $( find wasmtime* | grep /wasmtime$) ${SDKROOT} /devices/$( arch) /usr/bin
202235 fi
209242
210243 mkdir -p src build ${SDKROOT} /devices/${TARGET} ${SDKROOT} /prebuilt/${TARGET}
211244
212- if [ -f /tmp/emsdk.tar ]
213- then
214- echo "
215-
216-
217- ===========================================================================
218-
219- Using emsdk cache from :
220-
221- $( cat /tmp/sdk/emsdk.version)
222-
223-
224- ===========================================================================
225-
226-
227-
228- "
229- pushd /
230- tar xfp /tmp/emsdk.tar
231- mkdir -p ${SDKROOT} /src ${SDKROOT} /build
232- popd
233- fi
234-
235245 # use ./ or emsdk will pollute env
236246 if echo $EMFLAVOUR | grep -q ^3\\ .
237247 then
@@ -321,14 +331,12 @@ END
321331
322332 > ${SDKROOT} /python3-${TARGET}
323333
324- # ROOT=/opt/python-wasm-sdk SDKROOT=/opt/python-wasm-sdk
325- # HOST_PREFIX=/opt/python-wasm-sdk/devices/$(arch)/usr
326334 > ${SDKROOT} /wasm32-${TARGET} -shell.sh
327335
328336 CPU=wasm32
329337 CPU=$CPU TARGET=$TARGET PYDK_PYTHON_HOST_PLATFORM=${CPU} -${TARGET} \
330338 PYDK_SYSCONFIG_PLATFORM=${CPU} -${TARGET} \
331- PREFIX=/opt/python-wasm-sdk /devices/${TARGET} sdk/usr \
339+ PREFIX=${SDKROOT} /devices/${TARGET} sdk/usr \
332340 ./scripts/make-shells.sh
333341
334342 cat >> $ROOT /${CPU} -${TARGET} -shell.sh << END
0 commit comments