diff --git a/snap/build.sh b/snap/build.sh new file mode 100755 index 0000000..1c60ec0 --- /dev/null +++ b/snap/build.sh @@ -0,0 +1,35 @@ +#!/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 + +# 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 + +# Now add snap stuff +# First, our icon and desktop file +mkdir -p meta/gui +mv love.svg meta/gui/icon.svg +sed -e 's/%BINPREFIX%//' -e '/%ICONPREFIX%/d' love.desktop.in > meta/gui/love.desktop +rm love.desktop.in + +# Now the yaml and launcher +sed -e "s/%VERSION%/$VERSION/" ../snap.yaml > meta/snap.yaml +cp ../command-love.wrapper . + +# Finally, build it! +mksquashfs . ../love_${VERSION}_amd64.snap -noappend diff --git a/snap/command-love.wrapper b/snap/command-love.wrapper new file mode 100755 index 0000000..469d1c6 --- /dev/null +++ b/snap/command-love.wrapper @@ -0,0 +1,6 @@ +#!/bin/sh +export PATH="$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH" +export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu" +export LD_LIBRARY_PATH="$SNAP/usr/lib:$SNAP/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH" +export XDG_DATA_HOME="$SNAP_USER_COMMON" +exec "$SNAP/love" "$@" diff --git a/snap/snap.yaml b/snap/snap.yaml new file mode 100644 index 0000000..2795e18 --- /dev/null +++ b/snap/snap.yaml @@ -0,0 +1,35 @@ +name: love +version: "%VERSION%" +architectures: + - amd64 +summary: The unquestionably awesome 2D game engine +description: | + LÖVE was created to be a user-friendly engine in which simple (or + complicated) games could be made without having extensive knowledge + of system or graphics functions and without having to dedicate time + towards developing the same engine features time and time again. + + Developed with cross-platform implementation in mind, it utilizes the + latest open source libraries to deliver a similar game experience, + independent of operating system. By relying on the Lua scripting language + for game-specific programming, it allows even the novice game creator to + quickly and efficiently develop an idea into a fully working game. + +confinement: devmode +grade: devel + +apps: + love: + command: love + plugs: + - network + - network-bind + - opengl + - pulseaudio + - screen-inhibit-control + - x11 + +parts: + love: + plugin: dump + source: love-prepared/.