love launcher script

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
monolifed
Party member
Posts: 192
Joined: Sat Feb 06, 2016 9:42 pm

love launcher script

Post by monolifed »

This is a launcher script for love to be used with extracted AppImage on linux

Flavor1 (run love directly):

Code: Select all

#!/bin/sh
SCRIPT_PATH="$(dirname "$(readlink -f "$0")")"
#assuming extracted path is lovedir (relative to this script)
APPDIR="$SCRIPT_PATH/lovedir"
LIBPATHS="$APPDIR/usr/lib:$APPDIR/usr/lib/x86_64-linux-gnu:$APPDIR/lib/x86_64-linux-gnu"

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIBPATHS"
exec "$APPDIR/usr/bin/love" "$@"
Flavor2 (run wrapper-love)

Code: Select all

#!/bin/sh
OWD=$PWD
SCRIPT_PATH="$(dirname "$(readlink -f "$0")")"
#assuming extracted path is lovedir (relative to this script)
APPDIR="$SCRIPT_PATH/lovedir"
LIBPATHS="$APPDIR/usr/lib:$APPDIR/usr/lib/x86_64-linux-gnu:$APPDIR/lib/x86_64-linux-gnu"

export OWD="$OWD"
export APPDIR="$APPDIR"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIBPATHS"
exec "$APPDIR/usr/bin/wrapper-love" "$@"
Last edited by monolifed on Wed Sep 22, 2021 12:14 pm, edited 1 time in total.
monolifed
Party member
Posts: 192
Joined: Sat Feb 06, 2016 9:42 pm

Re: love launcher script

Post by monolifed »

Code: Select all

#!/bin/sh
# Name of the app binary
BINNAME="love"
# Names of the data folder and package file
DATANAME="data"
PACKNAME="game.love"

SCRIPTPATH="$(dirname "$(readlink -f "$0")")"
APPDIR="$SCRIPTPATH"

if [ -n DATANAME ]; then
	DATADIR="$APPDIR/$DATANAME"
else
	DATADIR="$APPDIR"
fi

if [ -f "$DATADIR/main.lua" ]; then
	FUSEPATH="$DATADIR"
elif [ -n "$PACKNAME" -a -f "$DATADIR/$PACKNAME" ]; then
	FUSEPATH="$DATADIR/$PACKNAME"
else
	FUSEPATH="$(find $DATADIR -type f \( -name "*.love" -o -name "*.zip" \) 2>/dev/null|sort|head -n 1)"
fi

ARCH="$(arch)"
LIBPATHS="$APPDIR/$ARCH/lib"
BINPATH="$APPDIR/$ARCH/$BINNAME"

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIBPATHS"

if [ -n "$FUSEPATH" ]; then
	exec "$BINPATH" --fused "$FUSEPATH" "$@"
else
	exec "$BINPATH" "$@"
fi
Current version of the script:
It will try to fuse the game in data dir if there is a packed or unpacked game
Otherwise it will just work normally
Can be made multiarch

directory structure

Code: Select all

./love.sh (the above script)
./x86_64/love (x86_64 love binary)
./x86_64/lib/  (contains all the x86_64 .so library files)
.so libraries I placed in ./x86_64/lib/ from the love 12 build

Code: Select all

_libfreetype.so.6 (removed, causes error)
_libopenal.so.1 (removed, causes warnings at startup)
liblove.so
liblove-12.0.so (symlink to liblove.so)
libogg.so.0
libSDL2-2.0.so.0
libvorbisfile.so.3
libgcc_s.so.1
libluajit-5.1.so.2
libsndio.so.6.1
libvorbis.so.0
libmodplug.so.1
libpng16.so.16
libtheoradec.so.1
libz.so.1
Post Reply

Who is online

Users browsing this forum: No registered users and 23 guests