Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions lib/mix/tasks/compile.rambo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ defmodule Mix.Tasks.Compile.Rambo do
@mac "x86_64-apple-darwin"
@macarm "aarch64-apple-darwin"
@linux "x86_64-unknown-linux-musl"
@linuxarm "aarch64-unknown-linux-musl"
@windows "x86_64-pc-windows-gnu"

@filenames %{
@mac => "rambo-mac",
@macarm => "rambo-macarm",
@linux => "rambo-linux",
@linuxarm => "rambo-linuxarm",
@windows => "rambo.exe",
:custom => "rambo"
}
Expand All @@ -29,6 +31,9 @@ defmodule Mix.Tasks.Compile.Rambo do
String.starts_with?(@environment, "x86_64") and String.contains?(@environment, "linux") ->
@linux

String.starts_with?(@environment, "aarch64") and String.contains?(@environment, "linux") ->
@linuxarm

@environment == "win32" ->
@windows

Expand All @@ -47,6 +52,7 @@ defmodule Mix.Tasks.Compile.Rambo do
with :ok <- compile(@mac),
:ok <- compile(@macarm),
:ok <- compile_in_docker(@linux),
:ok <- compile_in_docker(@linuxarm),
:ok <- compile_in_docker(@windows) do
:ok
else
Expand All @@ -70,8 +76,10 @@ defmodule Mix.Tasks.Compile.Rambo do
case platform do
"mac" -> compile(@mac)
"macarm" -> compile(@macarm)
"linux" -> compile(@linux)
"windows" -> compile(@windows)
"linux" -> compile_in_docker(@linux)
"linuxarm" -> compile_linuxarm()
"linuxarm-docker" -> compile_in_docker(@linuxarm)
"windows" -> compile_in_docker(@windows)
_ -> :ok
end
end
Expand Down Expand Up @@ -136,6 +144,16 @@ defmodule Mix.Tasks.Compile.Rambo do
end
end

defp compile_linuxarm do
use_docker = System.get_env("RAMBO_LINUXARM_DOCKER", "false") == "true"

if use_docker do
compile_in_docker(@linuxarm)
else
compile(@linuxarm)
end
end

defp move_executable(target) do
target_executable =
case target do
Expand Down
6 changes: 6 additions & 0 deletions priv/Dockerfile.aarch64-unknown-linux-musl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM rustembedded/cross:aarch64-unknown-linux-musl

WORKDIR /app

COPY . /app
CMD ["cargo", "build", "--release", "--target", "aarch64-unknown-linux-musl"]