Files
curl-wasm/justfile
T

45 lines
1.2 KiB
Makefile

set positional-arguments
default:
@just --list
build:
wasm-tools parse curl.wat -o curl.wasm
wasm-tools validate curl.wasm --features component-model
native: build
python3 native/build_native.py
test: build
python3 tests/test_curl.py
test-native: native
CURL_WASM_NATIVE=./curl-native python3 tests/test_curl.py
# Spike: static x86-64 ELF via wasm2elf (no libc/runtime; plain HTTP only, no TLS yet)
elf:
#!/usr/bin/env bash
set -euo pipefail
W=build/wasm2elf
if [ ! -d $W ]; then
git clone https://git.site.latha.org/nandi/wasm2elf-mb $W
git -C $W checkout "$(cat elf/wasm2elf.rev)"
fi
(cd $W && moon build --target native)
python3 elf/flatten.py curl.wat elf/shim.wat build/curl-flat.wat
wasm-tools parse build/curl-flat.wat -o build/curl-flat.wasm
wasm-tools validate build/curl-flat.wasm
$W/_build/native/debug/build/cmd/main/main.exe build/curl-flat.wasm curl-elf run
test-elf: elf
CURL_WASM_NATIVE=./curl-elf python3 tests/test_curl.py
run *args: build
wasmtime run -S http --dir=. -- ./curl.wasm "$@"
run-native *args: native
./curl-native "$@"
clean:
rm -rf curl.wasm curl-native curl-elf build