Files
Francesco BigiariniandClaude Opus 5.5 cd724e322a Add precompiled NIFs and Windows support to the Elixir package (#194)
* Add precompiled NIFs and Windows support to the Elixir package

Download a precompiled NIF with elixir_make and cc_precompiler from the
GitHub release of the version, checked against checksum.exs, so that
installing the package needs no compiler on Linux (x86_64 and aarch64,
glibc), macOS (x86_64 and arm64), and Windows (x86_64). The NIFs target NIF
version 2.16, which OTP 24 and later load. Other platforms, packages with
fewer features, builds inside the repository, and MOJIBAKE_BUILD=1 compile
from source; MOJIBAKE_PRECOMPILED_URL selects a mirror. A hex.publish alias
refuses to publish without checksum.exs.

Build the NIF on Windows with MSVC through Makefile.win and nmake. mix.exs
passes it the sources and directories as Windows paths and keeps a flags file
so that a flag or feature change rebuilds the NIF.

Add an elixir-windows CI job, and an elixir-precompile workflow that builds
the NIFs on Ubuntu 22.04, macOS, and Windows, checks with
scripts/check_precompiled.exs that the package installs the runner's NIF
without compiling, and uploads them to a published release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Francesco Bigiarini <francesco.bigiarini@gmail.com>

* Run the precompiled NIF smoke test from a file on Windows

check_precompiled.exs passed the smoke test to `mix run -e` through
`cmd /c`, which strips the quotes from the code, so the Windows precompile
job failed with a syntax error after building and packaging the NIF. Write
the test to a file in the unpacked package and run that instead, and log the
mix command rather than the cmd.exe one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Francesco Bigiarini <francesco.bigiarini@gmail.com>

---------

Signed-off-by: Francesco Bigiarini <francesco.bigiarini@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 14:14:50 +01:00
..