xmake.lua 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package("mingw-w64")
  2. set_kind("toolchain")
  3. set_homepage("https://sourceforge.net/projects/mingw-w64/")
  4. set_description("The mingw-w64 project is a complete runtime environment for gcc to support binaries native to Windows 64-bit and 32-bit operating systems.")
  5. if is_arch("x86") then
  6. local filenames = {
  7. ["11.2.0"] = "11.2.0-rt_v9-rev1/i686-11.2.0-release-posix-sjlj-rt_v9-rev1",
  8. ["15.2.0"] = "15.2.0-rt_v13-rev0/i686-15.2.0-release-posix-dwarf-ucrt-rt_v13-rev0"
  9. }
  10. add_urls("https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/$(version)/threads-posix/sjlj/i686-$(version)-release-posix-sjlj-rt_v6-rev0.7z", {alias = "sourceforge"})
  11. add_urls("https://github.com/niXman/mingw-builds-binaries/releases/download/$(version).7z", {alias = "github", version = function(version) return filenames[tostring(version)] end})
  12. add_versions("sourceforge:8.1.0", "f5b97d1a8c15f527c0f0397d0f128ff0af6acc9fab1ecd79ad403661c0a425ac")
  13. add_versions("github:11.2.0", "578fe0ffce6110cbff56b4028d10d6e5fdb61e3aa2d02dc71bd4230c56096ef5")
  14. add_versions("github:15.2.0", "8559c1e27c48f139400b4d7da848ca30a7bdb9f1fbe06e241b1b53baa6149d2a")
  15. else
  16. local filenames = {
  17. ["11.2.0"] = "11.2.0-rt_v9-rev1/x86_64-11.2.0-release-posix-seh-rt_v9-rev1",
  18. ["15.2.0"] = "15.2.0-rt_v13-rev0/x86_64-15.2.0-release-posix-seh-ucrt-rt_v13-rev0"
  19. }
  20. add_urls("https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/$(version)/threads-posix/seh/x86_64-$(version)-release-posix-seh-rt_v6-rev0.7z", {alias = "sourceforge"})
  21. add_urls("https://github.com/niXman/mingw-builds-binaries/releases/download/$(version).7z", {alias = "github", version = function(version) return filenames[tostring(version)] end})
  22. add_versions("sourceforge:8.1.0", "853970527b5de4a55ec8ca4d3fd732c00ae1c69974cc930c82604396d43e79f8")
  23. add_versions("github:11.2.0", "2c943b1a9231ce09f227b0c8fc6cabc61da3581f4ef2f7682f9393f5a1d70ae8")
  24. add_versions("github:15.2.0", "05b3361a3a3e20a5789db37fc2bb6a70d0b02e4667b5a31d9a6672ea40d22c69")
  25. end
  26. add_configs("python2", {description = "Export builtin python2.", default = false, type = "boolean"})
  27. on_fetch("@windows", function (package, opt)
  28. if opt.system then
  29. local mingw = import("detect.sdks.find_mingw")()
  30. if mingw then
  31. package:addenv("PATH", mingw.bindir)
  32. return mingw
  33. end
  34. end
  35. end)
  36. on_install("@windows", function (package)
  37. os.cp("*", package:installdir())
  38. if package:config("python2") then
  39. package:addenv("PATH", path.join("opt", "bin"))
  40. end
  41. end)
  42. on_test(function (package)
  43. os.vrun("gcc -v")
  44. os.vrun("gfortran -v")
  45. if package:config("python2") then
  46. os.vrun("python2 --version")
  47. end
  48. end)