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