Bundle wasm file to prevent full Clang and LLVM build

This commit is contained in:
WeebDataHoarder
2025-04-01 07:04:47 +02:00
parent bfcb0ccada
commit 8ed0f69a19
5 changed files with 17 additions and 11 deletions

32
build-wasm.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
set -e
set -o pipefail
cd "$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
# Setup tinygo first
if [[ ! -d .bin/tinygo ]]; then
git clone --depth=1 --branch v0.37.0 https://github.com/tinygo-org/tinygo.git .bin/tinygo
pushd .bin/tinygo
git submodule update --init --recursive
go mod download -x && go mod verify
make binaryen STATIC=1
make wasi-libc
make llvm-source
make llvm-build
make build/release
else
pushd .bin/tinygo
fi
export TINYGOROOT="$(realpath ./build/release/tinygo/)"
export PATH="$PATH:$(realpath ./build/release/tinygo/bin/)"
popd
go generate ./...