From 16aa92512edf3b5b8bf457e6436be6099b85f630 Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Fri, 2 Dec 2016 19:16:30 +0000 Subject: [PATCH] Add AppImage builder --- .hgignore | 3 +++ README.md | 7 +++++++ appimage/build.sh | 50 +++++++++++++++++++++++++++++++++++++++++++++++ appimage/wrapper | 4 ++++ 4 files changed, 64 insertions(+) create mode 100755 appimage/build.sh create mode 100755 appimage/wrapper diff --git a/.hgignore b/.hgignore index 6bab422..f4debab 100644 --- a/.hgignore +++ b/.hgignore @@ -1,3 +1,6 @@ ^snap/love-prepared/ ^snap/love_.*\.snap$ ^tarball/love-.*\.tar\.gz$ +^appimage/love-prepared/ +^appimage/.*\.AppImage$ +^appimage/AppRun$ diff --git a/README.md b/README.md index d5ea7ef..7fe2759 100644 --- a/README.md +++ b/README.md @@ -20,4 +20,11 @@ to do everything for you, why not just do it manually?! Seriously though, you can still use snapcraft to build this, but at that point it just acts like a fancy mksquashfs, and an extra dependency at that. +## appimage ## +`appimage` builds [AppImages][AppImage], unsurprisingly. It uses binaries from +[AppImageKit][], though you can build them yourself if you want to. And hey, +this actually seems to work, too! + [snap]: http://snapcraft.io/ +[AppImage]: http://appimage.org/ +[AppImageKit]: https://github.com/probonopd/AppImageKit diff --git a/appimage/build.sh b/appimage/build.sh new file mode 100755 index 0000000..c23bb69 --- /dev/null +++ b/appimage/build.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +set -eo >/dev/null + +if [[ $# -lt 1 ]]; then + echo "Usage: $0 " + exit 0 +fi + +VERSION="$1" +if ! test -f ../tarball/love-${VERSION}-amd64.tar.gz; then + echo "No tarball found for $VERSION" + exit 1 +fi + +download_if_needed() { + if ! test -f "$1"; then + if ! curl -L -o "$1" https://github.com/probonopd/AppImageKit/releases/download/continuous/"$1"; then + echo "Failed to download appimagetool" + echo "Please supply it manually" + exit 1 + fi + chmod +x "$1" + fi +} + +download_if_needed appimagetool-x86_64.AppImage +download_if_needed AppRun + +# Extract the tarball build into a folder +rm -rf love-prepared +mkdir love-prepared +tar xf ../tarball/love-${VERSION}-amd64.tar.gz -C love-prepared --strip-components=1 + +cd love-prepared + +# Add our small wrapper script (yay, more wrappers), and AppRun +cp ../wrapper usr/bin/wrapper-love +cp ../AppRun . + +# Add our desktop file +sed -e 's/%BINPREFIX%/wrapper-/' -e 's/%ICONPREFIX%//' love.desktop.in > love.desktop +rm love.desktop.in + +# Add a DirIcon +cp love.svg .DirIcon + +# Now build the final AppImage +cd .. +./appimagetool-x86_64.AppImage love-prepared love-${VERSION}-x86_64.AppImage diff --git a/appimage/wrapper b/appimage/wrapper new file mode 100755 index 0000000..2a634c1 --- /dev/null +++ b/appimage/wrapper @@ -0,0 +1,4 @@ +#!/bin/sh + +# For some reason this runs from the usr subdirectory +exec ../love "$@"