# Relinking showreels with your own FFmpeg

showreels's web module (index.wasm, showreels.mjs) links FFmpeg, under the LGPL 2.1, and libwebp statically.
This kit is everything else that link takes, and the link itself, so you can link it again with an FFmpeg you changed.
FFmpeg and libwebp are not in it: you build them from source (LIBRARIES.md).

## Steps

1. Install emscripten. The module was linked with `emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 6.0.5 (1db513782be24469589d7cb8a1f1834e9a33f271)`;
   with that version and the unmodified sources the result is byte for byte the one served.
2. Build libwebp and FFmpeg into a prefix, from their sources (LIBRARIES.md
   says which, and how). The scripts that built the served one are in
   `build-ffmpeg/`:

   ```
   FFMPEG_SRC=<ffmpeg-9.0.1 source> LIBWEBP_SRC=<libwebp-1.4.0 source> \
   WEB_FFMPEG=<prefix> build-ffmpeg/targets/web/ffmpeg.sh
   ```

   (It empties <prefix> first.)
3. Link: `./link.sh <prefix> [out-dir]`. You get `showreels.mjs`, `index.wasm`
   and `index.data` in out-dir (`./out`), equivalent to the ones served,
   linked with your FFmpeg. Put them where the served ones are.

## What is here

- `link.sh`: the commands odin's `./build.sh showreels web-module` ran (odin
  bf3e0dfb6d2b), its paths made this kit's: the accessor shim compiled against your
  prefix's headers, the emcc link, then the module's one-file join.
- `objects/`: the app's own wasm object, the shim's source, raylib's and
  raygui's archives, the JS libraries, the assets and the join's three files.
  Nothing of FFmpeg or libwebp.
  In one archive, objects.tar.xz, which link.sh unpacks.
- `LIBRARIES.md`: the libraries' versions, sources, sha256 and configure lines.
- `build-ffmpeg/`: the scripts that built the prefix.
