|
1 | 1 | #!/usr/bin/bash |
2 | | -set -e |
3 | | -cd pyodide |
4 | | -make |
5 | | -cd .. |
| 2 | +set -ex |
| 3 | + |
| 4 | +# Install uv. |
| 5 | +curl -LsSf https://astral.sh/uv/install.sh | sh |
| 6 | +uv venv --python 3.13 |
| 7 | +source .venv/bin/activate |
| 8 | + |
| 9 | +# Install pyodide cross build environment. |
| 10 | +# Instructions: https://pyodide.org/en/stable/development/building-packages.html |
| 11 | +uv pip install pyodide-build |
| 12 | +# `uv run` is required, so xbuildenv would skip using `pip`. |
| 13 | +uv run pyodide xbuildenv install |
| 14 | + |
| 15 | +# Emscripten doesn't come with xbuildenv. |
| 16 | +git clone https://github.com/emscripten-core/emsdk |
| 17 | +pushd emsdk |
| 18 | +PYODIDE_EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version) |
| 19 | +./emsdk install ${PYODIDE_EMSCRIPTEN_VERSION} |
| 20 | +./emsdk activate ${PYODIDE_EMSCRIPTEN_VERSION} |
| 21 | +source emsdk_env.sh |
| 22 | +which emcc |
| 23 | +popd |
| 24 | + |
6 | 25 | mkdir -p packages/ifcopenshell |
| 26 | +VERSION=`cat IfcOpenShell/VERSION` |
7 | 27 | cp IfcOpenShell/pyodide/meta.yaml packages/ifcopenshell |
8 | | -# Required, otherwise pyodide will create new temp pyodide environment. |
9 | | -export PYODIDE_ROOT=/src/pyodide |
10 | | -# Ensure emsdk tools are in PATH. |
11 | | -export PATH=$PYODIDE_ROOT/emsdk/emsdk:$PYODIDE_ROOT/emsdk/emsdk/node/22.16.0_64bit/bin:$PYODIDE_ROOT/emsdk/emsdk/upstream/emscripten:$PATH |
| 28 | +sed -i s/0.8.0/$VERSION/g packages/ifcopenshell/meta.yaml |
| 29 | + |
12 | 30 | # Use custom build ifcopenshell directory in build-all to make caching simpler |
13 | 31 | # Otherwise pyodide build path typically includes package version, so cached cmake configs might break. |
14 | | -export BUILD_DIR=/src/ifcopenshell_build |
| 32 | +export BUILD_DIR=`readlink -f ifcopenshell_build` |
| 33 | + |
15 | 34 | # Use build-recipes-no-deps first, so logs would be printed to stdout. |
16 | 35 | pyodide build-recipes-no-deps ifcopenshell |
17 | 36 | pyodide build-recipes ifcopenshell --install |
0 commit comments