On Wednesday, 25 January 2023 at 10:15, Vít Ondruch wrote:
>
> Dne 24. 01. 23 v 21:48 Dominik 'Rathann' Mierzejewski napsal(a):
>> On Tuesday, 24 January 2023 at 18:30, Vít Ondruch wrote:
>>> Dne 24. 01. 23 v 15:26 Michael Dawson napsal(a):
>>>>> I think that the bundling in Node.js should not be forgotten.
>>>> Thanks for identifying that. To clarify do you mean Node.js
>>>> needs to be able to bundle in externalized WASM so we can
>>>> rebuild it, or something else?
>>>
>>> I mean that when there is some WASM file included in Node.js, we
>>> have to be able to replace this file with file compiled from plain
>>> sources. IOW, we must adhere to this guideline:
>>>
>>>
https://docs.fedoraproject.org/en-US/packaging-guidelines/what-can-be-pac...
>>>
>>> Actually I think that the guideline should be extended to include
>>> the WASM files.
>> The precompiled .wasm files should be removed in %prep and recompiled
>> with wat2wasm (from wabt package) from .wat sources. Possibly, they
>> could be further optimized with wasm-opt (from binaryen package).
>
> Never heard of this and I am not entirely sure how that would look in
> practice.
>
> So this is one of the cases AFAIK. Node.js bundles llhttp:
>
>
https://github.com/nodejs/node/tree/main/deps/undici/src/lib/llhttp
>
> And there are various WASM files. And this is llhttp source:
>
>
https://github.com/nodejs/llhttp
>
> Now how would the wat2wasm help here? Could you please elaborate?
It would help if they were built from WAT sources. WAT is like ASM
sources for regular binaries. llhttp seems to be written partially in
TypeScript which I'm not familiar with. However, WASM files must be
treated like any other binaries. They must not be packaged directly from
upstream in a Fedora package. In case of llhttp, it seems one needs
a C-to-WASM compiler as C sources are generated with llparse from
TypeScript sources.
So, let me rephrase:
The precompiled .wasm files should be removed in %prep and recompiled
with appropriate compiler from source.
Example compilers:
WAT : wat2wasm (wabt)
C : ???