update llvm

pull/1109/head
xq114 3 years ago
parent e5b6b059bf
commit ed854d6762
  1. 147
      packages/l/llvm/xmake.lua

@ -4,107 +4,109 @@ package("llvm")
set_homepage("https://llvm.org/")
set_description("The LLVM Compiler Infrastructure")
if is_host("macosx") then
if os.arch() == "x86_64" then
set_urls("https://github.com/llvm/llvm-project/releases/download/llvmorg-$(version)/clang+llvm-$(version)-x86_64-apple-darwin.tar.xz")
add_versions("11.0.0", "b93886ab0025cbbdbb08b46e5e403a462b0ce034811c929e96ed66c2b07fe63a")
if is_host("windows") then
if os.arch() == "x86" then
set_urls("https://github.com/xmake-mirror/llvm-windows/releases/download/$(version)/clang+llvm-$(version)-win32.zip")
add_versions("11.0.0", "268043ae0b656cf6272ccb9b8e3f21f51170b74ed8997ddc0b99587983b821ca")
add_versions("14.0.0", "63afc3c472cb279978c5a7efc25b8783a700aeb416df67886b7057eba52a8742")
else
set_urls("https://github.com/xmake-mirror/llvm-windows/releases/download/$(version)/clang+llvm-$(version)-win64.zip")
add_versions("11.0.0", "db5b3a44f8f784ebc71f716b54eb63c0d8d21aead12449f36291ab00820271c7")
add_versions("14.0.0", "c1e1ddf11aa73c58073956d9217086550544328ed5e6ec64c1a709badb231711")
end
elseif is_host("macosx") and os.arch() == "x86_64" then
set_urls("https://github.com/llvm/llvm-project/releases/download/llvmorg-$(version)/clang+llvm-$(version)-x86_64-apple-darwin.tar.xz")
add_versions("11.0.0", "b93886ab0025cbbdbb08b46e5e403a462b0ce034811c929e96ed66c2b07fe63a")
add_versions("14.0.0", "cf5af0f32d78dcf4413ef6966abbfd5b1445fe80bba57f2ff8a08f77e672b9b3")
elseif is_host("bsd") then
if os.arch() == "x86_64" then
set_urls("https://github.com/llvm/llvm-project/releases/download/llvmorg-$(version)/clang+llvm-$(version)-amd64-unknown-freebsd11.tar.xz")
add_versions("11.0.0", "3a3bcac4da7d1ed431fef469fe52ccf9a525016d6900718a447986c7ab850d45")
set_urls("https://github.com/llvm/llvm-project/releases/download/llvmorg-$(version)/clang+llvm-$(version)-amd64-unknown-freebsd13.tar.xz")
add_versions("14.0.0", "b68d73fd57be385e7f06046a87381f7520c8861f492c294e6301d2843d9a1f57")
elseif os.arch() == "i386" then
set_urls("https://github.com/llvm/llvm-project/releases/download/llvmorg-$(version)/clang+llvm-$(version)-i386-unknown-freebsd11.tar.xz")
add_versions("11.0.0", "649ae62e8b85cd44b872678b118c8cbc75e2e29d94d995fddd9149fc6c3a4040")
end
elseif is_host("windows") then
if os.arch() == "x86" then
set_urls("https://github.com/xmake-mirror/llvm-project/releases/download/llvmorg-$(version)/clang+llvm-$(version)-win32.tar.xz")
add_versions("11.0.0", "fd7f3862e6d2a7ed1855e4692702f60d0f49c04514202c8b1d6659ce1872ecb9")
else
set_urls("https://github.com/xmake-mirror/llvm-project/releases/download/llvmorg-$(version)/clang+llvm-$(version)-win64.tar.xz")
add_versions("11.0.0", "de2dce781b70a66c28b389905ae825998b18b33b7b1e3e94f947a2ec57fb328d")
end
elseif is_host("linux") then
if linuxos.name() == "ubuntu" and linuxos.version():eq("20.04") and os.arch() == "x86_64" then
set_urls("https://github.com/llvm/llvm-project/releases/download/llvmorg-$(version)/clang+llvm-$(version)-x86_64-linux-gnu-ubuntu-20.04.tar.xz")
add_versions("11.0.0", "829f5fb0ebda1d8716464394f97d5475d465ddc7bea2879c0601316b611ff6db")
else
set_urls("https://github.com/llvm/llvm-project/releases/download/llvmorg-$(version)/llvm-project-$(version).tar.xz")
add_versions("11.0.0", "b7b639fc675fa1c86dd6d0bc32267be9eb34451748d2efd03f674b773000e92b")
set_urls("https://github.com/llvm/llvm-project/releases/download/llvmorg-$(version)/clang+llvm-$(version)-i386-unknown-freebsd13.tar.xz")
add_versions("14.0.0", "81f49eb466ce9149335ac8918a5f02fa724d562a94464ed13745db0165b4a220")
end
else
set_urls("https://github.com/llvm/llvm-project/releases/download/llvmorg-$(version)/llvm-project-$(version).src.tar.xz")
add_versions("11.0.0", "b7b639fc675fa1c86dd6d0bc32267be9eb34451748d2efd03f674b773000e92b")
add_versions("14.0.0", "35ce9edbc8f774fe07c8f4acdf89ec8ac695c8016c165dd86b8d10e7cba07e23")
end
add_configs("clang", {description = "Enable clang project.", default = true, type = "boolean"})
add_configs("clang-tools-extra", {description = "Enable extra clang tools project.", default = false, type = "boolean"})
add_configs("lld", {description = "Enable lld project.", default = false, type = "boolean"})
add_configs("lldb", {description = "Enable lldb project.", default = false, type = "boolean"})
add_configs("openmp", {description = "Enable openmp project.", default = false, type = "boolean"})
add_configs("polly", {description = "Enable polly project.", default = false, type = "boolean"})
add_configs("mlir", {description = "Enable mlir project.", default = false, type = "boolean"})
add_configs("compiler-rt", {description = "Enable compiler-rt runtime.", default = true, type = "boolean"})
add_configs("libunwind", {description = "Enable libunwind runtime.", default = true, type = "boolean"})
add_configs("libcxxabi", {description = "Enable clang runtime.", default = true, type = "boolean"})
add_configs("all", {description = "Enable all projects.", default = false, type = "boolean"})
add_configs("bolt", {description = "Enable bolt project.", default = false, type = "boolean"})
add_configs("clang", {description = "Enable clang project.", default = true, type = "boolean"})
add_configs("clang-tools-extra", {description = "Enable extra clang tools project.", default = false, type = "boolean"})
add_configs("libclc", {description = "Enable libclc project.", default = false, type = "boolean"})
add_configs("lld", {description = "Enable lld project.", default = false, type = "boolean"})
add_configs("lldb", {description = "Enable lldb project.", default = false, type = "boolean"})
add_configs("polly", {description = "Enable polly project.", default = false, type = "boolean"})
add_configs("pstl", {description = "Enable pstl project.", default = false, type = "boolean"})
add_configs("mlir", {description = "Enable mlir project.", default = false, type = "boolean"})
add_configs("flang", {description = "Enable flang project.", default = false, type = "boolean"})
add_configs("compiler-rt", {description = "Enable compiler-rt project.", default = true, type = "boolean"})
add_configs("libunwind", {description = "Enable libunwind runtime.", default = true, type = "boolean"})
add_configs("libc", {description = "Enable libc runtime.", default = false, type = "boolean"})
add_configs("libcxx", {description = "Enable libcxx runtime.", default = true, type = "boolean"})
add_configs("libcxxabi", {description = "Enable libcxxabi runtime.", default = true, type = "boolean"})
add_configs("openmp", {description = "Enable openmp runtime.", default = false, type = "boolean"})
if is_host("linux") then
if linuxos.name() == "ubuntu" and linuxos.version():eq("20.04") and os.arch() == "x86_64" then
-- use binary directly
else
add_deps("cmake")
add_deps("libffi", {host = true})
add_deps("binutils", {host = true}) -- needed for gold and strip
end
add_deps("cmake")
add_deps("python 3.x", {kind = "binary", host = true})
add_deps("zlib", "libffi", {host = true})
add_deps("binutils", {host = true}) -- needed for gold and strip
end
on_load("@linux", function (package)
if linuxos.name() == "ubuntu" and linuxos.version():eq("20.04") and os.arch() == "x86_64" then
return
elseif package:config("openmp") then
on_load("@linux", "@bsd", function (package)
if package:config("openmp") then
package:add("deps", "libelf", {host = true})
end
end)
if on_fetch then
on_fetch(function (package, opt)
if opt.system then
local version = try {function() return os.iorunv("llvm-config --version") end}
if version then
return {version = version:trim()}
end
on_fetch(function (package, opt)
if opt.system then
local version = try {function() return os.iorunv("llvm-config --version") end}
if version then
return {version = version:trim()}
end
end)
end
end
end)
on_install("@macosx", "@windows", "@msys", "@bsd", function (package)
on_install("@macosx|x86_64", "@windows", "@msys", "@bsd", function (package)
os.cp("*", package:installdir())
end)
on_install("@linux", function (package)
if linuxos.name() == "ubuntu" and linuxos.version():eq("20.04") and os.arch() == "x86_64" then
os.cp("*", package:installdir())
return
end
local projects = {
"bolt",
"clang",
"clang-tools-extra",
"libclc",
"lld",
"lldb",
"openmp",
"polly",
"pstl",
"mlir",
"flang",
"compiler-rt",
"openmp"
}
local projects_enabled = {}
for _, project in ipairs(projects) do
if package:config(project) then
table.insert(projects_enabled, project)
if package:config("all") then
table.insert(projects_enabled, "all")
else
for _, project in ipairs(projects) do
if package:config(project) then
table.insert(projects_enabled, project)
end
end
end
local runtimes = {
"compiler-rt",
"libc",
"libunwind",
"libcxx",
"libcxxabi"
}
local runtimes_enabled = {}
@ -135,17 +137,14 @@ package("llvm")
"-DLLDB_ENABLE_PYTHON=OFF",
"-DLLDB_ENABLE_LUA=OFF",
"-DLLDB_ENABLE_LZMA=OFF",
"-DLIBOMP_INSTALL_ALIASES=OFF",
"-DCLANG_PYTHON_BINDINGS_VERSIONS=#{py_ver}"
"-DLIBOMP_INSTALL_ALIASES=OFF"
}
if package:is_plat("macosx") then
table.insert(configs, "-DLLVM_BUILD_LLVM_C_DYLIB=ON")
table.insert(configs, "-DLLVM_CREATE_XCODE_TOOLCHAIN=" .. (package:is_plat("macosx") and "ON" or "OFF")) -- TODO
table.insert(configs, "-DLLVM_BUILD_LLVM_C_DYLIB=" .. (package:is_plat("macosx") and "ON" or "OFF"))
if package:has_tool("cxx", "clang", "clangxx") then
table.insert(configs, "-DLLVM_ENABLE_LIBCXX=ON")
table.insert(configs, "-DLLVM_CREATE_XCODE_TOOLCHAIN=ON") -- TODO
else
table.insert(configs, "-DLLVM_BUILD_LLVM_C_DYLIB=OFF")
table.insert(configs, "-DLLVM_ENABLE_LIBCXX=OFF")
table.insert(configs, "-DLLVM_CREATE_XCODE_TOOLCHAIN=OFF")
table.insert(configs, "-DCLANG_DEFAULT_CXX_STDLIB=libstdc++")
-- enable llvm gold plugin for LTO
table.insert(configs, "-DLLVM_BINUTILS_INCDIR=" .. package:dep("binutils"):installdir("include"))
@ -155,7 +154,7 @@ package("llvm")
end)
on_test(function (package)
if not package:is_plat("windows", "mingw") then
if not is_host("windows") then
os.vrun("llvm-config --version")
end
if package:config("clang") then

Loading…
Cancel
Save