xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package("nim")
  2. set_kind("toolchain")
  3. set_homepage("https://nim-lang.org/")
  4. set_description("Nim is a statically typed compiled systems programming language")
  5. local precompiled = false
  6. if is_host("windows") then
  7. if os.arch() == "x86" then
  8. add_urls("https://nim-lang.org/download/nim-$(version)_x32.zip")
  9. add_versions("2.0.2", "d076d35fdab29baf83c66f1135a1fd607eb61d4c14037706f7be3ba58fb83d87")
  10. precompiled = true
  11. elseif os.arch() == "x64" then
  12. add_urls("https://nim-lang.org/download/nim-$(version)_x64.zip")
  13. add_versions("2.0.2", "948dbf8e3fdd1b5242e3d662fd25c50e9b2586e097be8a85c22d7db2bde70bad")
  14. precompiled = true
  15. end
  16. end
  17. if not precompiled then
  18. add_urls("https://github.com/nim-lang/Nim/archive/refs/tags/v$(version).tar.gz")
  19. add_versions("2.0.2", "2ca2f559d05e29f130cb4f319ebb93a98e7c0e2187716b17b2cb4e747f5ff798")
  20. end
  21. on_install("@windows", "@msys", function (package)
  22. os.cp("*", package:installdir())
  23. end)
  24. on_install("@windows|arm64", function (package)
  25. os.vrunv("./build_all.bat", {}, {shell = true})
  26. os.cp("bin", package:installdir())
  27. end)
  28. on_install("@macosx", "@linux", function (package)
  29. os.vrunv("./build_all.sh", {}, {shell = true})
  30. os.cp("bin", package:installdir())
  31. end)
  32. on_test(function (package)
  33. os.vrun("nim --version")
  34. os.vrun("nimble --version")
  35. end)