Skip to content

Commit

Permalink
feat: add build environment info
Browse files Browse the repository at this point in the history
Refs: nodejs#2157

- adds generation of a wasm_build_env.txt file which contains
  information about version of tools used to build wasm
- updates the docuementation to make it clear that all files
  in lib/llhttp should be committed when an update is done
- fixes build/wasm.js to generate JS that passes the
  current linting configured for the project

Signed-off-by: Michael Dawson <[email protected]>
  • Loading branch information
mhdawson committed Jun 21, 2023
1 parent 593c56c commit e546bd9
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ cd <your-path-to-undici>
npm run build:wasm
```

#### Commit the contents of lib/llhttp

Create a commit which includes all of the updated files in lib/llhttp.

<a id="update-wpts"></a>
### Update `WPTs`

Expand Down
7 changes: 5 additions & 2 deletions build/wasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ if (process.argv[2] === '--docker') {
process.exit(0)
}

// Gather information about the tools used for the build
execSync(`apk info -vv >${join(WASM_OUT, 'wasm_build_env.txt')}`, { stdio: 'inherit' })

// Build wasm binary
execSync(`clang \
--sysroot=/usr/share/wasi-sysroot \
Expand All @@ -60,7 +63,7 @@ execSync(`clang \
const base64Wasm = readFileSync(join(WASM_OUT, 'llhttp.wasm')).toString('base64')
writeFileSync(
join(WASM_OUT, 'llhttp-wasm.js'),
`module.exports = "${base64Wasm}";\n`
`module.exports = '${base64Wasm}'\n`
)

// Build wasm simd binary
Expand Down Expand Up @@ -89,5 +92,5 @@ execSync(`clang \
const base64WasmSimd = readFileSync(join(WASM_OUT, 'llhttp_simd.wasm')).toString('base64')
writeFileSync(
join(WASM_OUT, 'llhttp_simd-wasm.js'),
`module.exports = "${base64WasmSimd}";\n`
`module.exports = '${base64WasmSimd}'\n`
)
2 changes: 1 addition & 1 deletion lib/llhttp/llhttp-wasm.js

Large diffs are not rendered by default.

Binary file modified lib/llhttp/llhttp.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/llhttp/llhttp_simd-wasm.js

Large diffs are not rendered by default.

Binary file modified lib/llhttp/llhttp_simd.wasm
Binary file not shown.
32 changes: 32 additions & 0 deletions lib/llhttp/wasm_build_env.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
alpine-baselayout-data-3.4.0-r0 - Alpine base dir structure and init scripts
musl-1.2.3-r4 - the musl c library (libc) implementation
busybox-1.35.0-r29 - Size optimized toolbox of many common UNIX utilities
busybox-binsh-1.35.0-r29 - busybox ash /bin/sh
alpine-baselayout-3.4.0-r0 - Alpine base dir structure and init scripts
alpine-keys-2.4-r1 - Public keys for Alpine Linux packages
ca-certificates-bundle-20220614-r4 - Pre generated bundle of Mozilla certificates
libcrypto3-3.0.8-r3 - Crypto library from openssl
libssl3-3.0.8-r3 - SSL shared libraries
ssl_client-1.35.0-r29 - EXternal ssl_client for busybox wget
zlib-1.2.13-r0 - A compression/decompression Library
apk-tools-2.12.10-r1 - Alpine Package Keeper - package manager for alpine
scanelf-1.3.5-r1 - Scan ELF binaries for stuff
musl-utils-1.2.3-r4 - the musl c library (libc) implementation
libc-utils-0.7.2-r3 - Meta package to pull in correct libc
libgcc-12.2.1_git20220924-r4 - GNU C compiler runtime libraries
libstdc++-12.2.1_git20220924-r4 - GNU C++ standard runtime library
libffi-3.4.4-r0 - portable, high level programming interface to various calling conventions.
xz-libs-5.2.9-r0 - Library and CLI tools for XZ and LZMA compressed files (libraries)
libxml2-2.10.4-r0 - XML parsing library, version 2
zstd-libs-1.5.5-r0 - Zstandard - Fast real-time compression algorithm (libraries)
llvm15-libs-15.0.7-r0 - LLVM 15 runtime library
clang15-libs-15.0.7-r0 - A C language family front-end for LLVM (libraries)
libstdc++-dev-12.2.1_git20220924-r4 - GNU C++ standard runtime library (development files)
clang15-15.0.7-r0 - A C language family front-end for LLVM
lld-libs-15.0.7-r0 - The LLVM Linker (libraries)
lld-15.0.7-r0 - The LLVM Linker
wasi-libc-0.20220525-r1 - WASI libc implementation for WebAssembly
wasi-libcxx-15.0.7-r0 - WASI LLVM C++ standard library
wasi-libcxxabi-15.0.7-r0 - WASI Low level support for the LLVM C++ standard library.
wasi-compiler-rt-15.0.7-r0 - WASI LLVM compiler runtime
wasi-sdk-16-r0 - WASI-enabled WebAssembly C/C++ toolchain

0 comments on commit e546bd9

Please sign in to comment.