From 4780f7a931c03a3f6849536ee8a89e7e6ee0572a Mon Sep 17 00:00:00 2001 From: Gonzalo <456459+grzuy@users.noreply.github.com> Date: Mon, 30 Oct 2023 18:09:33 -0300 Subject: [PATCH] docs: explain building from source in README --- .github/workflows/ci.yml | 2 +- README.md | 19 +++++++++++++++++++ lib/candlex/native.ex | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c06aff8..c177466 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: main: runs-on: ubuntu-latest env: - CANDLE_BUILD: true + NATIVE_BUILD: true strategy: fail-fast: false matrix: diff --git a/README.md b/README.md index fd7d905..394a2af 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,25 @@ Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_do and published on [HexDocs](https://hexdocs.pm). Once published, the docs can be found at . +## Usage + +#### `NATIVE_BUILD` + +Defaults to `false`. If `true` the native binary is built locally, which may be useful +if no precompiled binary is available for your target environment. Once set, you +must run `mix deps.clean candlex --build` explicitly to force to recompile. +Building has a number of dependencies, see *Building from source* below. + +## Building from source + +To build the native binary locally you need to set `NATIVE_BUILD=true`. +Keep in mind that the compilation usually takes time. + +You will need the following installed in your system for the compilation: + + * [Git](https://git-scm.com) for fetching candle-core source + * [Rust](https://www.rust-lang.org) with cargo to compile rustler NIFs + ## Releasing To publish a new version of this package: diff --git a/lib/candlex/native.ex b/lib/candlex/native.ex index 268e96f..bdceb36 100644 --- a/lib/candlex/native.ex +++ b/lib/candlex/native.ex @@ -10,7 +10,7 @@ defmodule Candlex.Native do otp_app: :candlex, features: Application.compile_env(:candlex, :crate_features, []), base_url: "#{source_url}/releases/download/v#{version}", - force_build: System.get_env("CANDLE_BUILD") in ["1", "true"], + force_build: System.get_env("NATIVE_BUILD") in ["1", "true"], mode: mode, version: version, nif_versions: ["2.16"],