Skip to content

Commit 8a459f0

Browse files
authored
Merge pull request #80 from ausimian/docs/maintaining-build-cache-update
Update MAINTAINING.md build/caching docs to reflect 0.3.x
2 parents ad52daa + db20af4 commit 8a459f0

1 file changed

Lines changed: 17 additions & 11 deletions

File tree

MAINTAINING.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,20 @@ built from source (in this repo / CI) or consumed as a hex package:
1212
`:emily_mlx → :elixir_make`. The `compile.emily_mlx` alias calls
1313
`scripts/build-mlx.sh`, which cmake-builds libmlx.a + mlx.metallib
1414
from the `:mlx_src` Mix git dep (`deps/mlx_src/`) and installs into
15-
`~/Library/Caches/emily/mlx-<v>-<variant>`. `elixir_make` then
16-
compiles `c_src/*.cpp` against that MLX install and links
17-
`priv/libemily.{so,dylib}`.
15+
`$EMILY_CACHE/mlx-<v>-<variant>` (default
16+
`$(getconf DARWIN_USER_CACHE_DIR)emily/mlx-<v>-<variant>` on macOS,
17+
`${XDG_CACHE_HOME:-~/.cache}/emily/mlx-<v>-<variant>` on Linux).
18+
`elixir_make` then compiles `c_src/*.cpp` against that MLX install
19+
and links `priv/libemily.{so,dylib}`.
1820

1921
- **Hex consumer (no `c_src/` in the tarball).** `mix compile` runs
2022
`:emily_nif`. The `compile.emily_nif` alias downloads the matching
2123
`emily-nif-<v>-<variant>-<target>.tar.gz` from the emily GitHub
22-
release for the tag, verifies its SHA256 against `@nif_checksums`
23-
in mix.exs, and extracts into `priv/`. No compilation; no MLX
24-
source tree on the consumer side.
24+
release for the tag, verifies its SHA256 against the `.sha256`
25+
sidecar fetched alongside it (no checksums baked into mix.exs —
26+
the sidecar is the source of truth for the published asset), and
27+
extracts into `priv/`. No compilation; no MLX source tree on the
28+
consumer side.
2529

2630
The switch is driven by a `File.dir?("c_src")` check in mix.exs's
2731
`compilers/0` — the hex `package[:files]` list ships only `lib/` and
@@ -121,7 +125,8 @@ so changing the attribute is the entire pin.
121125
2. `mix deps.update mlx_src`.
122126
3. Force a local MLX rebuild to sanity-check:
123127
```sh
124-
rm -rf ~/Library/Caches/emily/mlx-<new>-*
128+
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)emily/"mlx-<new>-* # macOS default
129+
# or: rm -rf "${EMILY_CACHE:-${XDG_CACHE_HOME:-$HOME/.cache}/emily}/"mlx-<new>-*
125130
mix precommit
126131
```
127132
4. Note the bump in `RELEASE.md`.
@@ -145,10 +150,11 @@ mix hex.build # produces emily-<v>.tar
145150
# (see prior scripts/smoke-test-package.sh for the pattern)
146151
```
147152

148-
The consumer will hit the real `compile.emily_nif` step — if
149-
`@nif_checksums` is populated and the tarball is on the GitHub
150-
release, it downloads + extracts; otherwise you get a clear
151-
"No precompiled NIF pinned" error.
153+
The consumer will hit the real `compile.emily_nif` step — if the
154+
tarball and its `.sha256` sidecar are present on the published
155+
GitHub release for the tag, it downloads + verifies + extracts;
156+
otherwise the sidecar fetch 404s with a clear `NIF download failed
157+
(HTTP 404 Not Found)` error pointing at the missing asset URL.
152158

153159
## Why the JIT lane can't roam across macOS versions
154160

0 commit comments

Comments
 (0)