xmake.lua 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package("appimage")
  2. set_kind("binary")
  3. set_homepage("https://appimage.org/")
  4. set_description("AppImage packaging tool (appimagetool) for creating AppImage files")
  5. set_license("MIT")
  6. if is_host("linux") then
  7. local arch
  8. if os.arch() == "x86_64" then
  9. arch = "x86_64"
  10. elseif os.arch():find("arm64.*") then
  11. arch = "aarch64"
  12. elseif os.arch() == "i386" then
  13. arch = "i686"
  14. end
  15. if arch then
  16. add_urls("https://github.com/AppImage/AppImageKit/releases/download/$(version)", {version = function (version)
  17. local ver = version:gsub("%.0$", "")
  18. local prefix = (ver == "13" and "obsolete-" or "")
  19. return ver .. "/" .. prefix .. "appimagetool-" .. arch .. ".AppImage"
  20. end})
  21. if arch == "x86_64" then
  22. add_versions("13.0", "df3baf5ca5facbecfc2f3fa6713c29ab9cefa8fd8c1eac5d283b79cab33e4acb")
  23. add_versions("12.0", "d918b4df547b388ef253f3c9e7f6529ca81a885395c31f619d9aaf7030499a13")
  24. elseif arch == "aarch64" then
  25. add_versions("13.0", "334e77beb67fc1e71856c29d5f3f324ca77b0fde7a840fdd14bd3b88c25c341f")
  26. add_versions("12.0", "c9d058310a4e04b9fbbd81340fff2b5fb44943a630b31881e321719f271bd41a")
  27. elseif arch == "i686" then
  28. add_versions("13.0", "104978205c888cb2ad42d1799e03d4621cb9a6027cfb375d069b394a82ff15d1")
  29. add_versions("12.0", "3af6839ab6d236cd62ace9fbc2f86487f0bf104f521d82da6dea4dab8d3ce4ca")
  30. end
  31. end
  32. end
  33. add_configs("extract_and_run", {description = "Enable APPIMAGE_EXTRACT_AND_RUN environment variable.", default = true, type = "boolean"})
  34. on_load(function (package)
  35. if package:config("extract_and_run") then
  36. package:addenv("APPIMAGE_EXTRACT_AND_RUN", "1")
  37. end
  38. end)
  39. on_install("@linux", function (package)
  40. local appimage_file = package:originfile()
  41. os.mv(appimage_file, "appimagetool")
  42. os.vrunv("chmod", {"+x", "appimagetool"})
  43. os.cp("appimagetool", package:installdir("bin"))
  44. end)
  45. on_test(function (package)
  46. os.vrun("appimagetool --version")
  47. end)