Skip to content

Commit

Permalink
docs: explain building from source in README
Browse files Browse the repository at this point in the history
  • Loading branch information
grzuy committed Oct 30, 2023
1 parent 02c1bb6 commit 4780f7a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
main:
runs-on: ubuntu-latest
env:
CANDLE_BUILD: true
NATIVE_BUILD: true
strategy:
fail-fast: false
matrix:
Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://hexdocs.pm/candlex>.

## 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:
Expand Down
2 changes: 1 addition & 1 deletion lib/candlex/native.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down

0 comments on commit 4780f7a

Please sign in to comment.