Skip to content

Commit

Permalink
Add aarch64-unknown-linux-musl as a default target (#36)
Browse files Browse the repository at this point in the history
People using Alpine Linux containers on Apple machines
with M1/M2 processors should benefit from this.

Closes #35
  • Loading branch information
philss authored Jan 26, 2023
1 parent 6565cde commit e2a661c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
5 changes: 2 additions & 3 deletions lib/rustler_precompiled/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ defmodule RustlerPrecompiled.Config do

@default_targets ~w(
aarch64-apple-darwin
aarch64-unknown-linux-musl
x86_64-apple-darwin
x86_64-unknown-linux-gnu
x86_64-unknown-linux-musl
Expand Down Expand Up @@ -110,7 +111,5 @@ defmodule RustlerPrecompiled.Config do
raise "`#{inspect(field)}` is required for `RustlerPrecompiled`"
end

defp pre_release?(version) do
"dev" in Version.parse!(version).pre
end
defp pre_release?(version), do: "dev" in Version.parse!(version).pre
end
1 change: 1 addition & 0 deletions test/rustler_precompiled/config_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ defmodule RustlerPrecompiled.ConfigTest do

assert config.targets == [
"aarch64-apple-darwin",
"aarch64-unknown-linux-musl",
"x86_64-apple-darwin",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
Expand Down
15 changes: 14 additions & 1 deletion test/rustler_precompiled_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,20 @@ defmodule RustlerPrecompiledTest do
}

error_message =
"precompiled NIF is not available for this target: \"i686-unknown-linux-gnu\".\nThe available targets are:\n - aarch64-apple-darwin\n - x86_64-apple-darwin\n - x86_64-unknown-linux-gnu\n - x86_64-unknown-linux-musl\n - arm-unknown-linux-gnueabihf\n - aarch64-unknown-linux-gnu\n - x86_64-pc-windows-msvc\n - x86_64-pc-windows-gnu"
"""
precompiled NIF is not available for this target: \"i686-unknown-linux-gnu\".
The available targets are:
- aarch64-apple-darwin
- aarch64-unknown-linux-musl
- x86_64-apple-darwin
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- arm-unknown-linux-gnueabihf
- aarch64-unknown-linux-gnu
- x86_64-pc-windows-msvc
- x86_64-pc-windows-gnu
"""
|> String.trim()

assert {:error, ^error_message} = RustlerPrecompiled.target(config, @available_targets)
end
Expand Down

0 comments on commit e2a661c

Please sign in to comment.