Subject: [bug#77653] [PATCH 2/4] gnu: Add wasm32-wasi-clang-runtime.

From: Maxim Cournoyer <[email-masked]>
Date: Fri, 25 Apr 2025 17:05:52 +0900

Hi,

Ian Eure <[email-masked]> writes:

> * gnu/packages/wasm.scm (wasm32-wasi-clang-runtime): New variable.

[...]

> +(define-public wasm32-wasi-clang-runtime
> +  (package (inherit clang-runtime-16)

This reminds me that this should be documented, but when creating
variants (packages issued from the same source but with different build
flags, say), you must use package/inherit for the grafts machinery to
work correctly.

> +    (native-inputs
> +     (list clang-16
> +           wasi-libc))

I'd format these on one line, like you did below, since there are less
than 5 and it fits.

> +    (inputs (list llvm-16))
> +    (arguments
> +     (list
> +      #:build-type "Release"
> +      #:tests? #f

Need an explanatory comment, e.g.:   ;no test suite

> +      ;; Stripping binaries breaks wasm linking, resulting in the following
> +      ;; error: "archive has no index; run ranlib to add one".
> +      #:strip-binaries? #f
> +      #:configure-flags
> +      #~(list "-DCMAKE_C_COMPILER=clang"
> +              "-DCMAKE_C_COMPILER_TARGET=wasm32-wasi"
> +              (string-append
> +               "-DCMAKE_SYSROOT=" #$wasi-libc "/wasm32-wasi")
> +              (string-append
> +               "-DCMAKE_C_FLAGS=-I " #$wasi-libc "/wasm32-wasi/include")

As Z572 mentioned, this shouldn't reference the packages directly, to be
input-rewrite friendly.

-- 
Thanks,
Maxim