Wire up rustler_precompiled for v0.3.0#2
Draft
qweliant wants to merge 1 commit into
Draft
Conversation
Switch lib/lib_raw/nif.ex from plain Rustler to RustlerPrecompiled so end users on supported targets (aarch64/x86_64 macOS and Linux gnu) download a precompiled NIF instead of compiling Rust from source. libraw is still dynamically linked at runtime (LGPL compliance). Add .github/workflows/release.yml: builds NIF artifacts across all four targets on native runners (macos-latest, macos-13, ubuntu-22.04, ubuntu-24.04-arm) for NIF versions 2.15/2.16/2.17, then publishes a GitHub Release containing every .tar.gz artifact. https://claude.ai/code/session_01WCfYosaDqCSoSDbK5vLUSx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
lib/lib_raw/nif.exSwitched from
use Rustlertouse RustlerPrecompiled. On install, Hex willnow download a precompiled
.sofrom the GitHub release instead of invokingthe Rust toolchain. Key options:
cratelibraw_nifversionMix.Project.config()[:version](currently"0.3.0")base_urlhttps://github.com/qweliant/libraw/releases/download/v<version>nif_versions["2.15", "2.16", "2.17"](OTP 23 / 24-25 / 26+)targetsforce_buildtruewhenLIBRAW_BUILD=1(source-build opt-in):rustleris kept as a dep —rustler_precompiledneeds it for source-build fallback..github/workflows/release.ymlTriggers on any
v*tag push. Build matrix: 4 targets × 3 NIF versions = 12 jobs, all on native runners.aarch64-apple-darwinmacos-latest(Apple Silicon)brew install librawx86_64-apple-darwinmacos-13(Intel)brew install librawx86_64-unknown-linux-gnuubuntu-22.04apt-get install libraw-devaarch64-unknown-linux-gnuubuntu-24.04-arm(native ARM64)apt-get install libraw-devUses
philss/rustler-precompiled-action@v1to compile and package each NIF artifact, then a separatereleasejob collects all artifacts and publishes the GitHub Release viasoftprops/action-gh-release@v1.README.md~> 0.3, new "Supported Platforms" table,LIBRAW_BUILD=1source-build instructions.mix.exs@versionbumped"0.2.0"→"0.3.0".CHANGELOG.mdAdded v0.3.0 entry.
libraw-still-required caveat
libraw is dynamically linked at runtime (LGPL). Every machine that runs
:librawmust have the shared library installed:The precompiled NIF does not bundle or statically link libraw. This is by design.
MUSL / Alpine
Intentionally excluded — libraw is not reliable on musl libc.
Pre-merge checklist
v0.3.0-rc1tag and verify all 12 workflow jobs pass.tar.gz+.sha256sumartifacts appear on the draft GitHub Releasemix deps.get && mix deps.compileon a clean macOS machine without Rust — should download precompiled NIF, no Rust invocationLIBRAW_BUILD=1 mix deps.compileforces a source build (requires Rust + libraw-dev)LibRaw.decode/2andLibRaw.metadata/1work end-to-end after precompiled installmix hex.publishpackage includeschecksum.exs(generated bymix rustler_precompiled.download LibRaw.NIF --all --print)mix hex.publish)Generated by Claude Code