Make wasm2c native build portably discover runtime and OpenSSL
Add native/build_native.py to auto-discover WABT's wasm2c runtime headers and sources (wasm-rt.h, wasm-rt-*.c, and .inc files, with WASM2C_RUNTIME_DIR override) and OpenSSL flags across Linux distros and macOS, instead of assuming /usr/include/wasm-rt.h and -lwasm-rt-impl. Guard _DARWIN_C_SOURCE vs _POSIX_C_SOURCE in native/wasi_host.c, delegate just native to native/build_native.py, and document WASM2C_RUNTIME_DIR in README.md.
This commit is contained in:
1 parent
2ff249ff89
commit
dba2cbcdca
4 files changed
+232
-8
No files matched your search
@@ -8,14 +8,7 @@ build:
|
||||
wasm-tools validate curl.wasm --features component-model
|
||||
|
||||
native: build
|
||||
mkdir -p build
|
||||
python3 native/extract_core.py curl.wasm build
|
||||
wasm2c build/mem_mod.wasm -n mem_mod -o build/mem_mod.c
|
||||
wasm2c build/curl_core.wasm -n curl_core -o build/curl_core.c
|
||||
cc -O2 -w -Ibuild -c build/mem_mod.c -o build/mem_mod.o
|
||||
cc -O2 -w -Ibuild -c build/curl_core.c -o build/curl_core.o
|
||||
cc -O2 -Wall -Wextra -Werror -Wno-unused-parameter -Ibuild -c native/wasi_host.c -o build/wasi_host.o
|
||||
cc -O2 build/mem_mod.o build/curl_core.o build/wasi_host.o -lwasm-rt-impl -lssl -lcrypto -lm -o curl-native
|
||||
python3 native/build_native.py
|
||||
|
||||
test: build
|
||||
python3 tests/test_curl.py
|
||||
|
||||
Reference in new issue
Block a user