# Install


effects is built from source. It runs on Linux (x86-64) and uses [Nix](https://nixos.org/download/) to fetch Skia and the libraries Skia needs, so those do not have to be installed by hand.

## What you need

| Tool | Used for |
| --- | --- |
| `nix` | `build.sh` asks it for Skia, HarfBuzz, ICU, fontconfig and SDL3. |
| `odin` | The compiler. Also needed at run time: the renderer compiles your project every time it loads it. |
| `ffmpeg`, `ffprobe` | Encoding, and decoding footage and audio. Needed at run time. |
| `g++` | Compiles the Skia shim once. |

If `odin` and `ffmpeg` are not installed system-wide, a Nix shell provides them:

```bash
$ nix shell nixpkgs#odin nixpkgs#ffmpeg
```

Run the renderer and the editor from a shell that has both on its `PATH`.

## Build

```bash
$ git clone https://github.com/fipso/effects
$ cd effects
$ ./build.sh              # shim + CLI + editor → build/
```

The first build compiles Skia with clang and takes a few minutes; later builds take seconds. To rebuild one part, name it: `./build.sh shim`, `./build.sh cli`, `./build.sh edit`.

| Output | What it is |
| --- | --- |
| `build/libskshim.so` | The C layer over Skia, with Skia linked in statically. |
| `build/effects` | The command-line renderer. |
| `build/effects-edit` | The editor. |

The binaries find the shim through an rpath, so they run from anywhere without `LD_LIBRARY_PATH`. They do remember where the repository is (to find `fx` and the bundled fonts), so rebuild after moving it.

> **Why clang?** Skia only fully vectorizes its raster pipeline under clang. A full-screen gradient took about 20 ms with a gcc build of Skia and about 5 ms with the clang one, so `nix/skia.nix` rebuilds nixpkgs' Skia with clang, as static libraries.

To use a Skia you built yourself, point `SKIA` at the built libraries and `SKIA_SRC` at its source tree before running `build.sh`.

## Check that it works

The repository contains one project, `projects/fable`. Draw a frame of it:

```bash
$ build/effects still projects/fable 31.6
built fable in 0.41s (-o:none)
/…/projects/fable/.effects/stills/0031.60.png
```

Open the PNG. If it shows a frame of the film, everything works: the project compiled, Skia drew, and the fonts loaded. Then open it in the editor:

```bash
$ build/effects-edit projects/fable
```

A full render of fable is a long one (3,600 frames, most of them full-screen shaders: about 13 minutes on 8 cores). Render a few seconds of it instead:

```bash
$ build/effects render projects/fable --from 30 --to 34
```

## If something fails

| Symptom | Cause |
| --- | --- |
| `cannot run odin` | `odin` is not on `PATH` in this shell. |
| `build/effects: cannot execute: required file not found` | The Nix store paths the binary was linked against were garbage-collected. Run `./build.sh shim cli` again. |
| Text is missing or in the wrong font | A font file was not found; the renderer prints `fx: cannot load font` with the path. |
| `ffmpeg failed for …seg000.mp4` | `ffmpeg` is missing, or it was built without libx264. |
