summaryrefslogtreecommitdiffstats
path: root/debian/nodejs/build
diff options
context:
space:
mode:
Diffstat (limited to 'debian/nodejs/build')
-rw-r--r--debian/nodejs/build23
1 files changed, 23 insertions, 0 deletions
diff --git a/debian/nodejs/build b/debian/nodejs/build
new file mode 100644
index 0000000..ddf238b
--- /dev/null
+++ b/debian/nodejs/build
@@ -0,0 +1,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