summaryrefslogtreecommitdiffstats
path: root/debian/nodejs/build
blob: ddf238b256166df8684656699d802714564366b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
node scripts/generate-undici-types-package-json.js
mkdir -p deps/llhttp/include deps/llhttp/src
cp llhttp/build/c/llhttp.c deps/llhttp/src/
cp llhttp/src/native/*.c deps/llhttp/src/
cp llhttp/build/llhttp.h deps/llhttp/include/

# Reproduce this build without Node.js dependency:
#  - original build
#WASI_ROOT=/usr CLANG=/usr/bin/clang node build/wasm.js
#  - direct clang call
clang -nodefaultlibs --sysroot=/usr -target wasm32-unknown-wasi \
	-Ofast -fno-exceptions -fvisibility=hidden \
	-mexec-model=reactor -Wl,-lc -Wl,--error-limit=0 -Wl,-O3 \
	-Wl,--lto-O3 -Wl,--strip-all -Wl,--allow-undefined \
	-Wl,--export-dynamic -Wl,--export-table -Wl,--export=malloc \
	-Wl,--export=free \
	deps/llhttp/src/*.c \
	-Ideps/llhttp/include \
	-o lib/llhttp/llhttp-wasm
echo 'module.exports = "'`perl -MMIME::Base64 -000 -ne 'print encode_base64($_,"")' lib/llhttp/llhttp-wasm`'";' > lib/llhttp/llhttp-wasm.js

# Build bundle
esbuild index-fetch.js --bundle --platform=node --outfile=undici-fetch.js --define:esbuildDetection=1 --keep-names