xmake.lua 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 is_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. elseif is_arch("arm64") then
  10. set_urls("https://github.com/mstorsjo/llvm-mingw/releases/download/$(version)/llvm-mingw-$(version)-ucrt-aarch64.zip")
  11. add_versions("20201020", "57d6e0fff94774ccd958a3d0174686189d3ec1cb5981eb4ea37fc82a007cc674")
  12. elseif is_arch("arm.*") then
  13. set_urls("https://github.com/mstorsjo/llvm-mingw/releases/download/$(version)/llvm-mingw-$(version)-ucrt-armv7.zip")
  14. add_versions("20201020", "c086562124fc79e157d2cb01eacd7bd3e937d488bacdac138ee45ed6a39d3b6c")
  15. else
  16. set_urls("https://github.com/mstorsjo/llvm-mingw/releases/download/$(version)/llvm-mingw-$(version)-ucrt-x86_64.zip")
  17. add_versions("20201020", "8f619911b61554d0394537305157f63284fab949ad0abed137b84440689fa77e")
  18. end
  19. elseif is_host("linux") then
  20. if linuxos.name() == "ubuntu" and linuxos.version():eq("18.04") then
  21. set_urls("https://github.com/mstorsjo/llvm-mingw/releases/download/$(version)/llvm-mingw-$(version)-ucrt-ubuntu-18.04.tar.xz")
  22. add_versions("20201020", "b41769e8c1511adb093de9f0b8bc340aa85e91f40343bbb8894cd12aca3a7543")
  23. end
  24. end
  25. on_install("@windows", "@linux", function (package)
  26. if is_host("linux") then
  27. assert(linuxos.name() == "ubuntu" and linuxos.version():eq("18.04"))
  28. end
  29. os.cp("*", package:installdir())
  30. end)
  31. on_test(function (package)
  32. local gcc
  33. if is_arch("i386", "x86", "i686") then
  34. gcc = "i686-w64-mingw32-gcc"
  35. elseif is_arch("arm64", "aarch64") then
  36. gcc = "aarch64-w64-mingw32-gcc"
  37. elseif is_arch("armv7", "arm.*") then
  38. gcc = "armv7-w64-mingw32-gcc"
  39. else
  40. gcc = "x86_64-w64-mingw32-gcc"
  41. end
  42. if gcc and is_host("windows") then
  43. gcc = gcc .. ".exe"
  44. end
  45. os.vrunv(gcc, {"--version"})
  46. end)