From a7409268327f9bd6a1ebf95933231a45f114869e Mon Sep 17 00:00:00 2001 From: noobhappylife Date: Thu, 6 Aug 2026 11:39:54 +0000 Subject: [PATCH 1/4] feat(scripts): add package-tarball.sh local release packaging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mirrors build-release.yml's packaging step so releases can be built and published locally (gh release create) — the fast path used for v1.0.0. --- scripts/package-tarball.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 scripts/package-tarball.sh diff --git a/scripts/package-tarball.sh b/scripts/package-tarball.sh new file mode 100755 index 0000000..27c6511 --- /dev/null +++ b/scripts/package-tarball.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Package the assembled site-packages tree into the release tarball + SHA256SUMS.txt. +# +# Usage: +# scripts/package-tarball.sh # -> dist-wasm/ (tarball + SHA256SUMS.txt) +# scripts/package-tarball.sh /path/out +# +# Env: WASI_BUILD (default /tmp/wasi-build) +# +# This mirrors the packaging step of .github/workflows/build-release.yml, for +# building + publishing a release locally: +# gh release create dist-wasm/python-site-packages-cp314-wasm32-wasip2.tar.gz dist-wasm/SHA256SUMS.txt +set -euo pipefail + +WASI_BUILD="${WASI_BUILD:-/tmp/wasi-build}" +SITE="$WASI_BUILD/matplotlib-build/mpl-site" +[ -d "$SITE/numpy" ] || { + echo "ERROR: $SITE is not the assembled site-packages tree (run scripts/wasm_setup.sh first)." >&2 + exit 1 +} + +OUT="${1:-dist-wasm}" +mkdir -p "$OUT" +TARBALL="$OUT/python-site-packages-cp314-wasm32-wasip2.tar.gz" + +echo "Packaging $SITE -> $TARBALL" +tar czf "$TARBALL" -C "$SITE" . +sha256sum "$TARBALL" > "$OUT/SHA256SUMS.txt" +ls -lh "$TARBALL" +cat "$OUT/SHA256SUMS.txt" + +echo "" +echo "Publish with:" +echo " gh release create $TARBALL $OUT/SHA256SUMS.txt" From f44b5cb92ba472d28c2eb79c1c413487f201bc99 Mon Sep 17 00:00:00 2001 From: noobhappylife Date: Thu, 6 Aug 2026 12:02:01 +0000 Subject: [PATCH 2/4] fix: raqm stub compile missing fake-headers isystem raqm_stub.c pulls setjmp.h via freetype's ftstdlib.h; the fake setjmp header (-isystem fake-headers, the deliberate wasm-EH workaround every other native dep uses) was omitted from this one direct clang call, so a cold build hits the sysroot's 'Setjmp requires Exception handling' #error. Local artifacts were stale (Jul 21) and masked it. Verified: the exact compile now succeeds. --- build/matplotlib-pipeline/02-native-deps.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/matplotlib-pipeline/02-native-deps.sh b/build/matplotlib-pipeline/02-native-deps.sh index e57811b..aef65bd 100755 --- a/build/matplotlib-pipeline/02-native-deps.sh +++ b/build/matplotlib-pipeline/02-native-deps.sh @@ -103,7 +103,8 @@ cp "$MPL_BUILD/raqm.h" "$MPL_BUILD/raqm-stub/" 2>/dev/null || true cp "$MPL_BUILD/raqm-version.h" "$MPL_BUILD/raqm-stub/" 2>/dev/null || true cp "$MPL_BUILD/raqm_stub.c" "$MPL_BUILD/raqm-stub/" $WASI_SDK/bin/clang --target=wasm32-wasip2 --sysroot=$WASI_SDK/share/wasi-sysroot \ - -O2 -fPIC -I"$MPL_BUILD/raqm-stub" \ + -O2 -fPIC -isystem "$MPL_BUILD/fake-headers" \ + -I"$MPL_BUILD/raqm-stub" \ -I"$MPL_BUILD/freetype-install/include/freetype2" \ -c "$MPL_BUILD/raqm-stub/raqm_stub.c" -o "$MPL_BUILD/raqm-stub/raqm_stub.o" $WASI_SDK/bin/llvm-ar rcs "$MPL_BUILD/raqm-stub/libraqm.a" "$MPL_BUILD/raqm-stub/raqm_stub.o" From 8c237546666a22605f408987b3b9e1ae25d24fe0 Mon Sep 17 00:00:00 2001 From: noobhappylife Date: Thu, 6 Aug 2026 14:32:13 +0000 Subject: [PATCH 3/4] docs: list unzip as pipeline prerequisite --- build/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/README.md b/build/README.md index 3d73b47..0e9ec1d 100644 --- a/build/README.md +++ b/build/README.md @@ -27,6 +27,6 @@ targets, superseded by the pipelines but kept for reference. - `WASI_BUILD` — build root (default `/tmp/wasi-build`) - Pipelines need a native toolchain (curl, git, gcc, make) to build the host CPython that runs the cross-compile's codegen, plus **jq** (the extras - scripts resolve PyPI sdist/wheel URLs with it) and **cmake/ninja** (pinned - via pip into the build venv). + scripts resolve PyPI sdist/wheel URLs with it), **unzip** (wheel extraction + in extras/01 + 07), and **cmake/ninja** (pinned via pip into the build venv). - `assemble-extra.sh` needs a venv python for `pip download` of pure wheels. From b040e591f117fafb13c8098a26de6a5418b2dddc Mon Sep 17 00:00:00 2001 From: noobhappylife Date: Thu, 6 Aug 2026 14:33:32 +0000 Subject: [PATCH 4/4] fix: orjson ensures wasm32-wasip1 rustup target before cargo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Runners/containers lack the target by default (only the dev machine had it installed) — first from-scratch gate run failed with E0463 can't find crate for std. rustup target add is idempotent; tiktoken (06) uses -Zbuild-std and needs no preinstalled target. --- build/extras/05-orjson.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build/extras/05-orjson.sh b/build/extras/05-orjson.sh index ab8b925..a9666b0 100755 --- a/build/extras/05-orjson.sh +++ b/build/extras/05-orjson.sh @@ -59,6 +59,13 @@ WASI_SYSROOT="$WASI_SDK/share/wasi-sysroot" \ RUSTFLAGS="-C relocation-model=pic -C link-arg=--experimental-pic \ -C link-arg=--shared -C link-self-contained=no \ -C link-arg=-L$WASI_SDK/share/wasi-sysroot/lib/wasm32-wasip1" \ +# Ensure the Rust toolchain + wasm32-wasip1 target exist (runners/containers +# lack it by default; the local dev machine had it installed — gate caught the +# gap on the first from-scratch CI run, 2026-08-06). +if ! rustup target list --installed 2>/dev/null | grep -q "^wasm32-wasip1$"; then + echo ">>> [extras/05] installing wasm32-wasip1 target..." + rustup target add wasm32-wasip1 +fi cargo +1.95 build --release --target wasm32-wasip1 echo ">>> [extras/05] Assembling orjson package..."