xmake.lua 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package("llvm-mingw")
  2. set_kind("toolchain")
  3. set_homepage("https://github.com/mstorsjo/llvm-mingw")
  4. set_description("An LLVM/Clang/LLD based mingw-w64 toolchain")
  5. if is_host("windows") then
  6. if os.arch() == "x86" then
  7. set_urls("https://github.com/mstorsjo/llvm-mingw/releases/download/$(version)/llvm-mingw-$(version)-ucrt-i686.zip")
  8. add_versions("20201020", "4f07721a81a3ba0980fc089e839d1f1a5784bbc8cee1332c15cf1b6ba24525d6")
  9. add_versions("20211002", "e4faaea995c980f4b0808cc4ec17d5ea9fc2c83449f0cb3a8af07e52abe26679")
  10. add_versions("20220323", "34889c54195c3d677c3751fd53fa49d005e9750651f3ce994817a3c7670e7eb5")
  11. elseif os.arch() == "arm64" then
  12. set_urls("https://github.com/mstorsjo/llvm-mingw/releases/download/$(version)/llvm-mingw-$(version)-ucrt-aarch64.zip")
  13. add_versions("20201020", "57d6e0fff94774ccd958a3d0174686189d3ec1cb5981eb4ea37fc82a007cc674")
  14. add_versions("20211002", "1f618c4323a7e64df8a97d4fe8a933e6c8bdc131c91f90b89888927ebd179f83")
  15. add_versions("20220323", "f8d7d30a5eb50e9e9769d8c544644e6d25c822913e0944b21c94b75421942085")
  16. elseif os.arch():find("arm.*") then
  17. set_urls("https://github.com/mstorsjo/llvm-mingw/releases/download/$(version)/llvm-mingw-$(version)-ucrt-armv7.zip")
  18. add_versions("20201020", "c086562124fc79e157d2cb01eacd7bd3e937d488bacdac138ee45ed6a39d3b6c")
  19. add_versions("20211002", "a37c4cbd4b7c53f7c931d4ca84e1f9847315b528129310fefeafae48edd65407")
  20. add_versions("20220323", "1008e8eeef74194c4662bef5a2afa4691a31d894fdad8ebf2ddc27dbf6e98c86")
  21. else
  22. set_urls("https://github.com/mstorsjo/llvm-mingw/releases/download/$(version)/llvm-mingw-$(version)-ucrt-x86_64.zip")
  23. add_versions("20201020", "8f619911b61554d0394537305157f63284fab949ad0abed137b84440689fa77e")
  24. add_versions("20211002", "cd0c506789eb2fd3179836e55a7dd13ceade810ec094aeec28fa5a531423e7f8")
  25. add_versions("20220323", "3014a95e4ec4d5c9d31f52fbd6ff43174a0d9c422c663de7f7be8c2fcc9d837a")
  26. end
  27. elseif is_host("linux") then
  28. -- Built on Ubuntu but hopefully run on other distributions
  29. if os.arch() == "x86_64" then
  30. set_urls("https://github.com/mstorsjo/llvm-mingw/releases/download/$(version)/llvm-mingw-$(version)-ucrt-ubuntu-18.04-x86_64.tar.xz")
  31. add_versions("20211002", "30e9400783652091d9278ce21e5c170d01a5f44e4f1a25717b63cd9ad9fbe13b")
  32. add_versions("20220323", "6d69ab28a3a9a2b7159178ff11cae8545fd44c9343573900fcf60434539695d8")
  33. elseif os.arch() == "arm64" then
  34. set_urls("https://github.com/mstorsjo/llvm-mingw/releases/download/$(version)/llvm-mingw-$(version)-ucrt-ubuntu-18.04-aarch64.tar.xz")
  35. add_versions("20211002", "9a26079af16713894e8a11c77e38896c4040b98daceca4408333bd1053c1a3d5")
  36. add_versions("20220323", "89d4dc4515d7203b658f8257b19943a4055831a3738ed79bc179a1abcc83cde6")
  37. end
  38. end
  39. on_install("@windows", "@linux|x86_64", "@linux|arm64", function (package)
  40. os.cp("*", package:installdir())
  41. end)
  42. on_test(function (package)
  43. local gcc
  44. if package:is_targetarch("i386", "x86", "i686") then
  45. gcc = "i686-w64-mingw32-gcc"
  46. elseif package:is_targetarch("arm64", "aarch64") then
  47. gcc = "aarch64-w64-mingw32-gcc"
  48. elseif package:is_targetarch("armv7", "arm.*") then
  49. gcc = "armv7-w64-mingw32-gcc"
  50. else
  51. gcc = "x86_64-w64-mingw32-gcc"
  52. end
  53. if gcc and is_host("windows") then
  54. gcc = gcc .. ".exe"
  55. end
  56. os.vrunv(gcc, {"--version"})
  57. end)