Skip to content

Commit

Permalink
Add alpine to unknown (#81)
Browse files Browse the repository at this point in the history
* Add alpine to unknown

* Add test case for alpine linux
  • Loading branch information
zacksiri committed Aug 27, 2024
1 parent d1223ad commit f56cca4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/rustler_precompiled.ex
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,8 @@ defmodule RustlerPrecompiled do
arch = normalize_arch(target_system.arch)

vendor =
with vendor when vendor in ~w(pc redhat suse) <- target_system.vendor, do: "unknown"
with vendor when vendor in ~w(pc redhat suse alpine) <- target_system.vendor,
do: "unknown"

%{target_system | arch: arch, vendor: vendor}

Expand Down
13 changes: 13 additions & 0 deletions test/rustler_precompiled_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@ defmodule RustlerPrecompiledTest do
RustlerPrecompiled.target(config, @available_targets, @available_nif_versions)
end

test "x86_64 in a PC running Alpine Linux" do
target_system = %{arch: "x86_64", vendor: "alpine", os: "linux", abi: "musl"}

config = %{
target_system: target_system,
nif_version: "2.14",
os_type: {:unix, :linux}
}

assert {:ok, "nif-2.14-x86_64-unknown-linux-musl"} =
RustlerPrecompiled.target(config, @available_targets, @available_nif_versions)
end

test "x86_64 or amd64 in a PC running Linux" do
target_system = %{arch: "amd64", vendor: "pc", os: "linux", abi: "gnu"}

Expand Down

0 comments on commit f56cca4

Please sign in to comment.