diff --git a/bundlex.exs b/bundlex.exs index 97fd1e0..fcaca95 100644 --- a/bundlex.exs +++ b/bundlex.exs @@ -13,11 +13,28 @@ defmodule Membrane.Agora.BundlexProject do end def project do - case get_target() do - %{os: "linux"} -> - System.shell("./install.sh") + url = case get_target() do + %{os: "linux", architecture: "x86_64"} -> + "https://download.agora.io/sdk/release/Agora-RTC-x86_64-linux-gnu-v3.8.202.20-20220627_152601-214165.tgz" + other_target -> - IO.warn("Agora's Server Gateway SDK is unavailable for this target: #{inspect(other_target)}") + url = System.get_env("AGORA_SDK_URL") + if url do + url + else + IO.warn(""" + Agora's Server Gateway SDK build location unknown for target #{inspect(other_target)}. + You can pass the URL as AGORA_SDK_URL environmental variable. + """) + "" + end + end + + {_output, result} = System.shell("./install.sh #{url}") + if result != 0 do + IO.warn(""" + Couldn't get SDK with the following URL: #{url} + """) end [ diff --git a/install.sh b/install.sh index 2648dbe..59ad79e 100755 --- a/install.sh +++ b/install.sh @@ -1,9 +1,13 @@ #! /bin/bash if ! test -d ./agora_sdk; then - wget https://download.agora.io/sdk/release/Agora-RTC-x86_64-linux-gnu-v3.8.202.20-20220627_152601-214165.tgz - tar xvf Agora-RTC-x86_64-linux-gnu-v3.8.202.20-20220627_152601-214165.tgz - rm Agora-RTC-x86_64-linux-gnu-v3.8.202.20-20220627_152601-214165.tgz + if [[ $1 == http* ]]; then + wget -qO- $1 | tar xvz + else + tar xvf $1 + fi + mv agora_rtc_sdk/agora_sdk . - rm -r agora_rtc_sdk + rm -r agora_rtc_sdk + fi