Browse Source

Show a message explaining how to build LLVM when a pre-built package is unavailable.

pull/1529/head
josetr 5 years ago
parent
commit
b455772f40
  1. 19
      build/scripts/LLVM.lua
  2. 12
      build/scripts/Utils.lua

19
build/scripts/LLVM.lua

@ -186,9 +186,22 @@ function download_llvm() @@ -186,9 +186,22 @@ function download_llvm()
-- check if we already have the file downloaded
if os.isfile(archive) then
print("Archive " .. archive .. " already exists.")
else
download(base .. archive, archive)
print("Archive " .. archive .. " already exists.")
else
msg, code = download(base .. archive, archive, true)
if msg ~= "OK" then
if code == 404 then
print("Error: " .. archive .. " is unavailable.")
print("Please create your own LLVM package by executing the following commands:")
print("./build.sh clone_llvm")
print("./build.sh build_llvm")
print("./build.sh package_llvm")
os.exit(1)
end
error(msg)
end
end
-- extract the package

12
build/scripts/Utils.lua

@ -93,19 +93,23 @@ function http.progress (total, prev, curr) @@ -93,19 +93,23 @@ function http.progress (total, prev, curr)
end
end
function download(url, file)
function download(url, file, try)
print("Downloading: " .. url)
local prev = 0
local res = http.download(url, file, function(total, curr)
local res, code = http.download(url, file, function(total, curr)
http.progress(total, prev, curr)
prev = curr
end)
if res ~= "OK" then
os.remove(file)
error(res)
if not try then
error(res)
end
end
return res
return res, code
end
--

Loading…
Cancel
Save