Files
hackdex-website/docs/xdelta-wasm.md
Jared Schoeny c7c88d1840
Some checks failed
Deploy Supabase Migrations to Production / migrate (push) Has been cancelled
Xdelta patching (#71)
* Add xdelta patch support

* Fix potential race on reupload to new format + update typings

* Fix waiting too long to call showSaveFilePicker

* Allow seeing patch format in version history
2026-08-03 10:56:45 -06:00

1.9 KiB

Building and vendoring xdelta WASM

Hackdex patches xdelta (VCDIFF) files in the browser using a WebAssembly build of xdelta3. That binary is not built inside this repo. You build it from a local checkout of the Hackdex fork of xdelta-wasm (forked from kotcrab/xdelta-wasm), then copy two artifacts into public/xdelta/.

Use this guide when you need to rebuild or update those artifacts.


Prerequisites

git submodule update --init

This populates native/xdelta.


One-time setup (XZ / liblzma)

Secondary LZMA compression (xdelta3 -S lzma) needs static liblzma. Run this if native/xz/ is missing:

./native/build-xz.sh

That downloads XZ Utils and builds it with emconfigure / emmake.


Building

From the xdelta-wasm checkout root:

./native/build.sh

This compiles native/xdelta/xdelta3/xdelta3.c and native/xdelta3-wasm.c, links liblzma, and writes:

  • public/xdelta3.js (ES6 module)
  • public/xdelta3.wasm (Companion WASM binary)

Vendoring into Hackdex

Copy only those two files into this repo (overwrite existing):

cp public/xdelta3.js public/xdelta3.wasm \
  /path/to/hackdex-website/public/xdelta/

Do not overwrite these Hackdex-owned files in public/xdelta/:

  • xdelta3.worker.js: Hackdex worker (protocol differs from upstream)
  • LICENSE-xdelta3.txt
  • NOTICE.txt

Licensing

See public/xdelta/LICENSE-xdelta3.txt and public/xdelta/NOTICE.txt.