2
0

xmake.lua 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package("msys2-base")
  2. set_kind("toolchain")
  3. set_homepage("https://www.msys2.org/")
  4. set_description("Software Distribution and Building Platform for Windows")
  5. add_urls("https://github.com/msys2/msys2-installer/releases/download/$(version).tar.xz", {version = function (version)
  6. return version:gsub("%.", "-") .. "/msys2-base-x86_64-" .. version:gsub("%.", "")
  7. end})
  8. add_versions("2025.08.30", "780d7546aa86b781e0ded37c7b8f71f1b8572219494fe88259d8d4b78752b2e2")
  9. add_versions("2024.01.13", "04456a44a956d3c0b5f9b6c754918bf3a8c3d87c858be7a0c94c9171ab13c58c")
  10. set_policy("package.precompiled", false)
  11. on_install("@windows|x64", function (package)
  12. -- reduce time required to install packages by disabling pacman's disk space checking
  13. io.gsub("etc/pacman.conf", "^CheckSpace", "#CheckSpace")
  14. -- disable key refresh
  15. io.replace("etc/post-install/07-pacman-key.post", "--refresh-keys", "--version", {plain = true})
  16. -- install files
  17. os.cp("*", package:installdir())
  18. package:addenv("PATH", "usr/bin")
  19. -- starting MSYS2 for the first time
  20. local bash = path.join(package:installdir("usr/bin"), "bash.exe")
  21. os.vrunv(bash, {"-leo", "pipefail", "-c", "uname -a"})
  22. local pacman_update_cmd = "pacman --noconfirm -Syuu --overwrite '*'"
  23. -- updating packages
  24. try { function () os.vrunv(bash, {"-leo", "pipefail", "-c", pacman_update_cmd}) end}
  25. -- killing remaining tasks
  26. os.vrunv("taskkill", {"/F", "/FI", "MODULES eq msys-2.0.dll"})
  27. -- final system upgrade
  28. os.vrunv(bash, {"-leo", "pipefail", "-c", pacman_update_cmd})
  29. end)
  30. on_test(function (package)
  31. os.vrun("sh --version")
  32. os.vrun("perl --version")
  33. os.vrun("ls -l")
  34. os.vrun("grep --version")
  35. os.vrun("uname -a")
  36. end)