AtlatestRepositorysigil-crypto

sigil-crypto / tree / test / wasmpackage.sgl

1;;; sigil-crypto wasm probe: builds the same checks for the host and for
2;;; wasm32-wasi so test/wasm/run-wasm-test.mjs can compare them. Not
3;;; published; it exists to prove the narrow wasm build (Ed25519, BLAKE2b,
4;;; minisign) works and that the Mbed TLS procedures fail clearly there.
5;;;
6;;; cd test/wasm && sigil deps install
7;;; node run-wasm-test.mjs (builds both configs, runs, compares)
8(package
9 name: "sigil-crypto-wasm-probe"
10 version: "0.1.0"
11 sigil: "0.22"
12 description: "wasm and host differential probe for sigil-crypto"
13 license: "BSD-3-Clause"
14 entry: '(crypto-probe main)
16 configs: (list
17 ;; Host build: the reference output.
18 (config
19 name: 'host
20 output-dir: "build/host"
21 debug?: #f
22 optimize: 2
23 bundle?: #t)
24 ;; Static musl build: the release-binary shape.
25 (config
26 name: 'static
27 output-dir: "build/static"
28 toolchain: 'zig
29 target: "x86_64-linux-musl"
30 static?: #t
31 debug?: #f
32 optimize: 2
33 bundle?: #t)
34 ;; Browser-shaped build: wasm32-wasi through zig with native codegen,
35 ;; the shape Crash The Stack ships. The eval ABI is force-exported so
36 ;; the Node harness can call the gated procedures by name.
37 (config
38 name: 'web
39 output-dir: "build/web"
40 toolchain: 'zig
41 target: "wasm32-wasi"
42 backend: 'native
43 debug?: #f
44 optimize: 2
45 c-flags: (with-sigil-c-flags '("-std=c99" "-D_GNU_SOURCE" "-D__SIGIL_WASM__" "-Wall" "-O2"))
46 link-flags: '("-Wl,--export=sigil_wasm_init"
47 "-Wl,--export=sigil_wasm_start"
48 "-Wl,--export=sigil_wasm_eval_string_length"
49 "-Wl,--export=sigil_wasm_last_result_length"
50 "-Wl,--export=sigil_wasm_copy_result"
51 "-Wl,--export=malloc"
52 "-Wl,--export=free"
53 "-lc")
54 features: '(web wasm)))
56 dependencies: (list
57 (from-path dir: "../.." package: "sigil-crypto")
58 (from-git url: "codeberg:sigil/sigil" package: "sigil-lib" version: ">=0.22")
59 (from-git url: "codeberg:sigil/sigil" package: "sigil-stdlib" version: ">=0.22")
60 (from-git url: "codeberg:sigil/sigil" package: "sigil-wasm-runtime" version: ">=0.22"))
62 tasks: (list
63 (task
64 name: 'build
65 configs: '(web)
66 description: "Build the wasm probe"
67 steps: (list
68 (compile-sigil-modules sources: "src/**/*.sgl")
69 (link-web-application name: "sigil-crypto-wasm-probe")))))