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()
-- check if we already have the file downloaded -- check if we already have the file downloaded
if os.isfile(archive) then if os.isfile(archive) then
print("Archive " .. archive .. " already exists.") print("Archive " .. archive .. " already exists.")
else else
download(base .. archive, archive) 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 end
-- extract the package -- extract the package

12
build/scripts/Utils.lua

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

Loading…
Cancel
Save