Skip to content

Commit 3111a27

Browse files
authored
Merge pull request #184 from influxdata/tm/cargo-build-wasi-sdk
feat: download WASI SDK from cargo build script
2 parents b52c8d8 + bc0f11d commit 3111a27

File tree

4 files changed

+274
-52
lines changed

4 files changed

+274
-52
lines changed

Cargo.lock

Lines changed: 145 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

guests/python/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ uuid.workspace = true
1818
wasip2.workspace = true
1919

2020
[build-dependencies]
21+
flate2 = "1.0.35"
22+
sha2 = "0.10.8"
2123
tar.workspace = true
24+
ureq = "2.12.1"
2225
walkdir = "2.5.0"
2326

2427
[lints]

guests/python/Justfile

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ export PYO3_CROSS_LIB_DIR := DOWNLOADS_DIR / "python-sdk"
2424
PYTHON_TMP_VENV := DOWNLOADS_DIR / "venv"
2525
PYTHON_SITE_PACKAGES := PYO3_CROSS_LIB_DIR / "lib" / "python" + PYO3_CROSS_PYTHON_VERSION / "site-packages"
2626

27-
export WASI_SDK_LINK_PATH := DOWNLOADS_DIR / "wasi-sysroot" / "lib" / "wasm32-wasip2"
28-
2927
# download pre-built Python WASM SDK
3028
[private]
3129
download-python-sdk:
@@ -85,43 +83,6 @@ download-python-sdk:
8583
set +x
8684
echo ::endgroup::
8785

88-
# download WASI SDK because we need some libraries during the static linking phase
89-
[private]
90-
download-wasi-sdk:
91-
#!/usr/bin/env bash
92-
set -euo pipefail
93-
94-
echo ::group::guests::python::download-wasi-sdk
95-
set -x
96-
97-
mkdir -p downloads
98-
pushd downloads >/dev/null
99-
100-
# skip if already downloaded
101-
if [ -d wasi-sysroot ]; then
102-
echo "wasi sdk already present"
103-
set +x
104-
echo ::endgroup::
105-
exit 0
106-
fi
107-
108-
curl \
109-
--fail \
110-
--show-error \
111-
--silent \
112-
--proto '=https' \
113-
--tlsv1.2 \
114-
--location \
115-
--output "wasi-sysroot.tar.gz" \
116-
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-{{WASI_SDK_VERSION_MAJOR}}/wasi-sysroot-{{WASI_SDK_VERSION_MAJOR}}.{{WASI_SDK_VERSION_MINOR}}.tar.gz"
117-
118-
echo "{{SHA256_WASI_SDK_SYSROOT}} wasi-sysroot.tar.gz" | sha256sum -c
119-
tar xf wasi-sysroot.tar.gz
120-
mv wasi-sysroot-{{WASI_SDK_VERSION_MAJOR}}.{{WASI_SDK_VERSION_MINOR}} wasi-sysroot
121-
122-
set +x
123-
echo ::endgroup::
124-
12586
[private]
12687
python-site-packages: download-python-sdk
12788
#!/usr/bin/env bash
@@ -158,7 +119,7 @@ python-site-packages: download-python-sdk
158119
echo ::endgroup::
159120

160121
[private]
161-
build-lib profile: download-python-sdk download-wasi-sdk python-site-packages
122+
build-lib profile: download-python-sdk python-site-packages
162123
@echo ::group::guests::python::build-lib {{profile}}
163124
cargo build --target=wasm32-wasip2 --profile={{replace(profile, "debug", "dev")}}
164125
@echo ::endgroup::

0 commit comments

Comments
 (0)