diff --git a/build/scripts/LLVM.lua b/build/scripts/LLVM.lua index 595f24e6..96b132ef 100644 --- a/build/scripts/LLVM.lua +++ b/build/scripts/LLVM.lua @@ -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 diff --git a/build/scripts/Utils.lua b/build/scripts/Utils.lua index cfb55b49..afccb4e7 100644 --- a/build/scripts/Utils.lua +++ b/build/scripts/Utils.lua @@ -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 --