Skip to content

Commit

Permalink
wasm wheel support
Browse files Browse the repository at this point in the history
  • Loading branch information
pmp-p committed Sep 8, 2022
1 parent fe5132d commit 3041672
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 7 deletions.
5 changes: 4 additions & 1 deletion config
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@ fi

export EMFLAVOUR=${EMFLAVOUR:-tot}

# no extra wasm features
export WASMFLAVOUR=mvp

#temp fix for oom on CI (Error: Process completed with exit code 143.)
export EMSDK_NUM_CORES=1


export PYDK_PYTHON_HOST_PLATFORM=wasm32-$EMFLAVOUR-emscripten
export PYDK_PYTHON_HOST_PLATFORM=wasm32-$WASMFLAVOUR-emscripten

if echo $LD_LIBRARY_PATH |grep -q ${HOST_PREFIX}/lib
then
Expand Down
1 change: 1 addition & 0 deletions pkg_list
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
patchelf wget lz4 pv clang libffi-dev libssl-dev libsqlite3-dev pkg-config git
6 changes: 6 additions & 0 deletions python-wasm-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ do
if ./scripts/cpython-build-emsdk-deps.sh > /dev/null
then
[ -f /lowend ] && sleep 45


echo " --------- adding some usefull pkg ${PYBUILD} ${CIVER} ---------" 1>&2
./scripts/cpython-build-emsdk-prebuilt.sh


echo "
==========================================================
Expand Down
67 changes: 67 additions & 0 deletions scripts/cpython-build-emsdk-prebuilt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash

. ${CONFIG:-config}

PIP="$(realpath python3-wasm) -m pip"

echo "
* cpython-build-emsdk-prebuilt pip==$PIP *
" 1>&2

# make wheels
# /opt/python-wasm-sdk/python3-wasm setup.py bdist_wheel

for pkg in wheel installer
do
if [ -d prebuilt/emsdk/${PYBUILD}/site-packages/$pkg ]
then
echo "
$pkg already set to prebuilt
"
else
$PIP install $pkg
mv $PREFIX/lib/python${PYBUILD}/site-packages/${pkg} prebuilt/emsdk/${PYBUILD}/site-packages/
mv $PREFIX/lib/python${PYBUILD}/site-packages/${pkg}-* prebuilt/emsdk/${PYBUILD}/site-packages/
fi
done


pushd src

CYTHON=Cython-3.0.0a11-py2.py3-none-any.whl

wget -q -c https://github.com/cython/cython/releases/download/3.0.0a11/${CYTHON}
$PIP install $CYTHON
































popd
10 changes: 6 additions & 4 deletions scripts/cpython-build-emsdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export PYTHON_FOR_BUILD=${PYTHON_FOR_BUILD:-${HPY}}

. ./scripts/emsdk-fetch.sh


REBUILD_WASM=${REBUILD_WASMPY:-false}

if $REBUILD || $REBUILD_WASMPY
Expand All @@ -37,7 +36,6 @@ then
popd 2>&1 >/dev/null
fi


if [ -f $EMSDK/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libffi.a ]
then
echo "
Expand Down Expand Up @@ -119,7 +117,6 @@ echo "
********** TESTSUITE test-modules == $TESTSUITE *******************
Expand Down Expand Up @@ -338,6 +335,11 @@ export PYBUILD=\${PYBUILD:-$PYBUILD}
export PYMAJOR=\$(echo -n \$PYBUILD|cut -d. -f1)
export PYMINOR=\$(echo -n \$PYBUILD|cut -d. -f2)
export CARGO_HOME=\${CARGO_HOME:-/opt/python-rust-sdk}
export RUSTUP_HOME=\${RUSTUP_HOME:-/opt/python-rust-sdk}
export PATH=\${CARGO_HOME}/bin:$PATH
if [[ ! -z \${EMSDK+z} ]]
then
# emsdk_env already parsed
Expand All @@ -352,7 +354,7 @@ fi
export SYS_PYTHON=${SYS_PYTHON}
export EMSDK_PYTHON=${SYS_PYTHON}
export PATH=${HOST_PREFIX}/bin:\$PATH
export PATH=${HOST_PREFIX}/bin:\$PATH:${SDKROOT}/devices/emsdk/usr/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
export HOME=${SDKROOT}
export PLATFORM_TRIPLET=${PYDK_PYTHON_HOST_PLATFORM}
Expand Down
2 changes: 1 addition & 1 deletion scripts/cpython-build-host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ then
unset CPPFLAGS
unset LDFLAGS


#export OPT="$CPOPTS -DNDEBUG -fwrapv"
mkdir -p $ROOT/src/cpython${PYBUILD}/Tools/wasm
cat > $ROOT/src/cpython${PYBUILD}/Tools/wasm/config.host-wasm32-emscripten <<END
ac_cv_lib_intl_textdomain=no
ac_cv_func_bind_textdomain_codeset=no
Expand Down
1 change: 0 additions & 1 deletion scripts/emsdk-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,3 @@ else
echo "emsdk: config already set !" 1>&2
fi


0 comments on commit 3041672

Please sign in to comment.