diff --git a/lib/mix/tasks/compile.rambo.ex b/lib/mix/tasks/compile.rambo.ex index 08dc408..b94ccc3 100644 --- a/lib/mix/tasks/compile.rambo.ex +++ b/lib/mix/tasks/compile.rambo.ex @@ -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" } @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/priv/Dockerfile.aarch64-unknown-linux-musl b/priv/Dockerfile.aarch64-unknown-linux-musl new file mode 100644 index 0000000..51db84b --- /dev/null +++ b/priv/Dockerfile.aarch64-unknown-linux-musl @@ -0,0 +1,6 @@ +FROM rustembedded/cross:aarch64-unknown-linux-musl + +WORKDIR /app + +COPY . /app +CMD ["cargo", "build", "--release", "--target", "aarch64-unknown-linux-musl"] \ No newline at end of file