xmake.lua 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package("qtifw")
  2. set_kind("binary")
  3. set_homepage("https://doc.qt.io/qtinstallerframework/")
  4. set_description("The Qt Installer Framework provides a set of tools and utilities to create installers for the supported desktop Qt platforms: Linux, Microsoft Windows, and macOS.")
  5. set_license("GPL-3")
  6. add_versions("4.7.0", "dummy")
  7. add_deps("aqt")
  8. on_fetch(function (package, opt)
  9. if opt.system then
  10. return import("lib.detect.find_tool")("binarycreator", {check = "--help"})
  11. end
  12. end)
  13. on_install("@windows", "@msys", "@macosx", function (package)
  14. local host
  15. if is_host("windows", "msys") then
  16. host = "windows"
  17. elseif is_host("linux") then
  18. host = "linux"
  19. elseif is_host("macosx") then
  20. host = "mac"
  21. else
  22. raise("unhandled host " .. os.host())
  23. end
  24. local target = "desktop"
  25. local version = package:version()
  26. local installdir = package:installdir()
  27. local qtifw_version = "qt.tools.ifw." .. version:major() .. version:minor()
  28. if is_host("windows") and (not is_subhost("msys")) then
  29. os.vrunv("aqt", {"install-tool", "-O", installdir, host, target, "tools_ifw", qtifw_version, "--external", "7z"})
  30. else
  31. os.vrunv("aqt", {"install-tool", "-O", installdir, host, target, "tools_ifw", qtifw_version})
  32. end
  33. os.mv(path.join(installdir, "Tools", "*", version:major() .. "." .. version:minor(), "*"), installdir)
  34. os.rmdir(path.join(installdir, "Tools"))
  35. end)
  36. on_test(function (package)
  37. local function assertbin(name)
  38. if is_host("windows") then
  39. name = name .. ".exe"
  40. end
  41. local exec = path.join(package:installdir(), "bin", name)
  42. assert(os.isexec(exec), name .. " not found!")
  43. end
  44. os.vrun("binarycreator --help")
  45. os.vrun("archivegen --help")
  46. os.vrun("devtool --help")
  47. assertbin("repogen")
  48. end)