Skip to content

Commit 2200dfa

Browse files
committed
fix: macos prebuilt download link
1 parent 1da9687 commit 2200dfa

2 files changed

Lines changed: 29 additions & 16 deletions

File tree

hooks/post_install.lua

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ function PLUGIN:PostInstall(ctx)
2828
elseif PRE_BUILT_OS_RELEASE then
2929
print("Erlang/OTP install from prebuilt release: " .. PRE_BUILT_OS_RELEASE)
3030
local install_path = ctx.sdkInfo.erlang.path
31-
31+
3232
if RUNTIME.osType == "darwin" then
3333
-- For MacOS prebuilts from @erlef/otp_builds, the tarball contains a ready-to-use installation
3434
-- We need to move the contents to a 'release' subdirectory to match expected structure
35-
local setup_cmd = "cd " .. install_path .. " && mkdir -p release && for item in *; do if [ \"$item\" != \"release\" ]; then mv \"$item\" release/; fi; done 2>/dev/null || true"
35+
local setup_cmd = "cd " ..
36+
install_path ..
37+
" && mkdir -p release && for item in *; do if [ \"$item\" != \"release\" ]; then mv \"$item\" release/; fi; done 2>/dev/null || true"
3638
local status = os.execute(setup_cmd)
3739
if status ~= 0 then
3840
error("Erlang/OTP install failed during file organization, please check the stdout for details.")
@@ -43,7 +45,7 @@ function PLUGIN:PostInstall(ctx)
4345
local status = os.execute(install_cmd)
4446
if status ~= 0 then
4547
error(
46-
"Erlang/OTP install failed, please check the stdout for details. Make sure you have the required utilties: https://www.erlang.org/doc/installation_guide/install#required-utilities")
48+
"Erlang/OTP install failed, please check the stdout for details. Make sure you have the required utilties: https://www.erlang.org/doc/installation_guide/install#required-utilities")
4749
end
4850
end
4951
else
@@ -55,19 +57,19 @@ function PLUGIN:PostInstall(ctx)
5557
local docs_target = os.getenv("DOC_TARGETS") or "chunks"
5658

5759
print(
58-
"If you enable some Erlang/OTP features, maybe you can reference this guide: https://github.com/erlang/otp/blob/master/HOWTO/INSTALL.md#configuring-1")
60+
"If you enable some Erlang/OTP features, maybe you can reference this guide: https://github.com/erlang/otp/blob/master/HOWTO/INSTALL.md#configuring-1")
5961
os.execute("sleep " .. tonumber(3))
6062
local configure_cmd = "cd " .. path .. " && ./configure --prefix=" .. path .. "/release " .. configure_args
6163

6264
local install_erlang_cmd = "cd " .. path .. "&& make && make install"
6365
-- install with docs chunk for IDE/REPL docs hits & type hits
6466
local install_erlang_docs_cmd = "cd " ..
65-
path .. " && make docs DOC_TARGETS=" .. docs_target .. " && make install-docs DOC_TARGETS=" .. docs_target
67+
path .. " && make docs DOC_TARGETS=" .. docs_target .. " && make install-docs DOC_TARGETS=" .. docs_target
6668

6769
local status = os.execute(configure_cmd .. " && " .. install_erlang_cmd .. " && " .. install_erlang_docs_cmd)
6870
if status ~= 0 then
6971
error(
70-
"Erlang/OTP install failed, please check the stdout for details. Make sure you have the required utilties: https://www.erlang.org/doc/installation_guide/install#required-utilities")
72+
"Erlang/OTP install failed, please check the stdout for details. Make sure you have the required utilties: https://www.erlang.org/doc/installation_guide/install#required-utilities")
7173
end
7274
end
7375
end

hooks/pre_install.lua

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,46 @@ function PLUGIN:PreInstall(ctx)
2424
erlang_version .. "/otp_win32_" .. erlang_version .. ".exe"
2525
end
2626
elseif RUNTIME.osType == "linux" and PRE_BUILT_OS_RELEASE then
27-
local SUPPORT_OS_RELEASE = { "ubuntu-14.04", "ubuntu-16.04", "ubuntu-18.04", "ubuntu-20.04", "ubuntu-22.04", "ubuntu-24.04" }
27+
local SUPPORT_OS_RELEASE = { "ubuntu-14.04", "ubuntu-16.04", "ubuntu-18.04", "ubuntu-20.04", "ubuntu-22.04",
28+
"ubuntu-24.04" }
2829
if not erlangUtils.array_contains(SUPPORT_OS_RELEASE, PRE_BUILT_OS_RELEASE) then
2930
error(
3031
"Make sure the USE_PREBUILT environment variable is set to one of the following values: ubuntu-20.04, ubuntu-22.04, ubuntu-24.04")
3132
end
32-
download_url = "https://builds.hex.pm/builds/otp/" .. RUNTIME.archType .. "/" .. PRE_BUILT_OS_RELEASE .. "/" .. erlang_version .. ".tar.gz"
33+
download_url = "https://builds.hex.pm/builds/otp/" ..
34+
RUNTIME.archType .. "/" .. PRE_BUILT_OS_RELEASE .. "/" .. erlang_version .. ".tar.gz"
3335
elseif RUNTIME.osType == "darwin" and erlangUtils.get_config_from_env("USE_PREBUILT_OTP") then
3436
-- Use @erlef/otp_builds for MacOS prebuilt binaries
3537
local arch_mapping = {
3638
amd64 = "amd64",
37-
x86_64 = "x86_64",
39+
x86_64 = "x86_64",
3840
arm64 = "arm64",
3941
aarch64 = "aarch64"
4042
}
41-
43+
4244
local mapped_arch = arch_mapping[RUNTIME.archType]
4345
if not mapped_arch then
44-
error("Unsupported architecture for prebuilt MacOS binaries: " .. RUNTIME.archType .. ". Supported architectures: amd64, x86_64, arm64, aarch64")
46+
error("Unsupported architecture for prebuilt MacOS binaries: " ..
47+
RUNTIME.archType .. ". Supported architectures: amd64, x86_64, arm64, aarch64")
4548
end
46-
49+
4750
-- Use different URL patterns based on architecture
4851
if mapped_arch == "aarch64" then
49-
download_url = "https://github.com/erlef/otp_builds/releases/download/OTP-" .. erlang_version .. "/otp-aarch64-apple-darwin.tar.gz"
52+
-- https://github.com/erlef/otp_builds/releases/download/maint-25-latest/otp-aarch64-apple-darwin.tar.gz
53+
download_url = "https://github.com/erlef/otp_builds/releases/download/" ..
54+
erlang_version .. "/otp-aarch64-apple-darwin.tar.gz"
5055
elseif mapped_arch == "arm64" then
51-
download_url = "https://github.com/erlef/otp_builds/releases/download/OTP-" .. erlang_version .. "/OTP-" .. erlang_version .. "-macos-arm64.tar.gz"
56+
-- https://github.com/erlef/otp_builds/releases/download/OTP-28.0.1/OTP-28.0.1-macos-arm64.tar.gz
57+
download_url = "https://github.com/erlef/otp_builds/releases/download/" ..
58+
erlang_version .. "/" .. erlang_version .. "-macos-arm64.tar.gz"
5259
elseif mapped_arch == "amd64" then
53-
download_url = "https://github.com/erlef/otp_builds/releases/download/OTP-" .. erlang_version .. "/OTP-" .. erlang_version .. "-macos-amd64.tar.gz"
60+
-- https://github.com/erlef/otp_builds/releases/download/OTP-28.0.1/OTP-28.0.1-macos-amd64.tar.gz
61+
download_url = "https://github.com/erlef/otp_builds/releases/download/" ..
62+
erlang_version .. "/" .. erlang_version .. "-macos-amd64.tar.gz"
5463
elseif mapped_arch == "x86_64" then
55-
download_url = "https://github.com/erlef/otp_builds/releases/download/OTP-" .. erlang_version .. "/otp-x86_64-apple-darwin.tar.gz"
64+
-- https://github.com/erlef/otp_builds/releases/download/OTP-28.0.1/otp-x86_64-apple-darwin.tar.gz
65+
download_url = "https://github.com/erlef/otp_builds/releases/download/" ..
66+
erlang_version .. "/otp-x86_64-apple-darwin.tar.gz"
5667
end
5768
else
5869
download_url = "https://github.com/erlang/otp/archive/refs/tags/OTP-" .. erlang_version .. ".tar.gz"

0 commit comments

Comments
 (0)