From ad2dd26a241e6c68eb91b070318bee12c66659fa Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 20 Mar 2024 17:38:33 +0800 Subject: [PATCH] update llvm (#3565) * update llvm * fix error for windows * revert windows binaries * limit macos --- packages/l/llvm/xmake.lua | 51 +++++++++++++++------------------------ 1 file changed, 20 insertions(+), 31 deletions(-) diff --git a/packages/l/llvm/xmake.lua b/packages/l/llvm/xmake.lua index 386eed5e8..2b1a3f6ff 100644 --- a/packages/l/llvm/xmake.lua +++ b/packages/l/llvm/xmake.lua @@ -1,9 +1,9 @@ package("llvm") - set_kind("toolchain") set_homepage("https://llvm.org/") set_description("The LLVM Compiler Infrastructure") + local precompiled = false if is_plat("windows") then if is_arch("x86") then set_urls("https://github.com/xmake-mirror/llvm-windows/releases/download/$(version)/clang+llvm-$(version)-win32.zip") @@ -11,45 +11,29 @@ package("llvm") add_versions("14.0.0", "63afc3c472cb279978c5a7efc25b8783a700aeb416df67886b7057eba52a8742") add_versions("15.0.7", "8dbabb2194404220f8641b4b18b24b36eca0ae751380c23fc7743097e205b95f") add_versions("16.0.6", "5e1f560f75e7a4c7a6509cf7d9a28b4543e7afcb4bcf4f747e9f208f0efa6818") + add_versions("17.0.6", "ce78b510603cb3b347788d2f52978e971cf5f55559151ca13a73fd400ad80c41") + add_versions("18.1.1", "9f59dd99d45f64a5c00b00d27da8fe8b5f162905026f5c9ef0ade6e73ae18df3") + precompiled = true 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") add_versions("15.0.7", "7d29ca82f8b73e9973209e90428ec9f3fbd3b01925bd26e34f59e959e9ea7eb3") add_versions("16.0.6", "7adb1a630b6cc676a4b983aca9b01e67f770556c6e960e9ee9aa7752c8beb8a3") + add_versions("17.0.6", "c480a4c280234b91f7796a1b73b18134ae62fe7c88d2d0c33312d33cb2999187") + add_versions("18.1.1", "28a9fbcd18f1e7e736ece6d663726bc15649f025343c3004dcbfc2d367b9924c") + precompiled = true end - elseif is_plat("macosx") then - if is_arch("x86_64") then - set_urls("https://github.com/llvm/llvm-project/releases/download/llvmorg-$(version).tar.xz", {version = function (version) - if version:lt("15.0") then - return version .. "/clang+llvm-" .. version .. "-x86_64-apple-darwin" - else - return version .. "/clang+llvm-" .. version .. "-x86_64-apple-darwin21.0" - end - end}) - add_versions("11.0.0", "b93886ab0025cbbdbb08b46e5e403a462b0ce034811c929e96ed66c2b07fe63a") - add_versions("13.0.0", "d051234eca1db1f5e4bc08c64937c879c7098900f7a0370f3ceb7544816a8b09") - add_versions("14.0.0", "cf5af0f32d78dcf4413ef6966abbfd5b1445fe80bba57f2ff8a08f77e672b9b3") - add_versions("15.0.7", "d16b6d536364c5bec6583d12dd7e6cf841b9f508c4430d9ee886726bd9983f1c") - elseif is_arch("arm64") then - set_urls("https://github.com/llvm/llvm-project/releases/download/llvmorg-$(version)/clang+llvm-$(version)-arm64-apple-darwin21.0.tar.xz") - add_versions("15.0.0", "cfd5c3fa07d7fccea0687f5b4498329a6172b7a15bbc45b547d0ac86bd3452a5") - end - elseif is_plat("bsd") then - if is_arch("x86_64") then - 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 is_arch("i386") then - 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 + end + if not precompiled then 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") add_versions("15.0.7", "8b5fcb24b4128cf04df1b0b9410ce8b1a729cb3c544e6da885d234280dedeac6") add_versions("16.0.5", "37f540124b9cfd4680666e649f557077f9937c9178489cea285a672e714b2863") add_versions("16.0.6", "ce5e71081d17ce9e86d7cbcfa28c4b04b9300f8fb7e78422b1feb6bc52c3028e") + add_versions("17.0.6", "58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813") + add_versions("18.1.1", "8f34c6206be84b186b4b31f47e1b52758fa38348565953fad453d177ef34c0ad") end add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true}) @@ -74,10 +58,12 @@ package("llvm") add_configs("openmp", {description = "Enable openmp runtime.", default = false, type = "boolean"}) on_load(function (package) - if package:is_plat("linux") then + if not package:is_plat("windows", "msys") then package:add("deps", "cmake") package:add("deps", "python 3.x", {kind = "binary", host = true}) package:add("deps", "zlib", "libffi", {host = true}) + end + if package:is_plat("linux") then package:add("deps", "binutils", {host = true}) -- needed for gold and strip end if package:is_plat("linux", "bsd") then @@ -99,11 +85,11 @@ package("llvm") on_fetch("fetch") - on_install("macosx", "windows", "msys", "bsd", function (package) + on_install("windows", "msys", function (package) os.cp("*", package:installdir()) end) - on_install("linux", function (package) + on_install("linux", "macosx|x86_64", "bsd", function (package) local projects = { "bolt", "clang", @@ -173,7 +159,10 @@ package("llvm") table.insert(configs, "-DLLVM_ENABLE_LIBCXX=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")) + local binutils = package:dep("binutils") + if binutils then + table.insert(configs, "-DLLVM_BINUTILS_INCDIR=" .. binutils:installdir("include")) + end end os.cd("llvm") import("package.tools.cmake").install(package, configs)