Ports: Add launchers for some of the ports

This commit is contained in:
Gunnar Beutner 2021-04-20 18:36:03 +02:00 committed by Linus Groh
parent 1e5a7ca0a7
commit e72235b981
Notes: sideshowbarker 2024-07-18 19:12:11 +09:00
9 changed files with 57 additions and 5 deletions

View file

@ -68,6 +68,9 @@ shift
: "${auth_type:=md5}"
: "${auth_import_key:=}"
: "${auth_opts:=}"
: "${launcher_name:=}"
: "${launcher_category:=}"
: "${launcher_command:=}"
run_nocd() {
echo "+ $@ (nocd)"
@ -77,9 +80,34 @@ run() {
echo "+ $@"
(cd "$workdir" && "$@")
}
run_replace_in_file(){
run_replace_in_file() {
run perl -p -i -e "$1" $2
}
install_launcher() {
if [ -z "$launcher_name" ] || [ -z "${launcher_category}" ] || [ -z "${launcher_command}" ]; then
return
fi
script_name="${launcher_name,,}"
script_name="${script_name// /}"
mkdir -p $DESTDIR/usr/local/libexec
cat >$DESTDIR/usr/local/libexec/$script_name <<SCRIPT
#!/bin/sh
set -e
cd -- "\$(dirname -- "\$(which -- $(printf %q "${launcher_command%% *}"))")"
exec $(printf '%q ' $launcher_command)
SCRIPT
chmod +x $DESTDIR/usr/local/libexec/$script_name
chmod +x $DESTDIR/usr/local/libexec
mkdir -p $DESTDIR/res/apps
cat >$DESTDIR/res/apps/$script_name.af <<CONFIG
[App]
Name=$launcher_name
Executable=/usr/local/libexec/$script_name
Category=$launcher_category
CONFIG
unset script_name
}
# Checks if a function is defined. In this case, if the function is not defined in the port's script, then we will use our defaults. This way, ports don't need to include these functions every time, but they can override our defaults if needed.
func_defined() {
PATH= command -V "$1" > /dev/null 2>&1
@ -219,6 +247,7 @@ func_defined build || build() {
}
func_defined install || install() {
run make DESTDIR=$DESTDIR $installopts install
install_launcher
}
func_defined post_install || post_install() {
echo

View file

@ -7,6 +7,9 @@ workdir=SDLPoP-86988c668eeaa10f218e1d4938fc5b4e42314d68
configopts="-DCMAKE_TOOLCHAIN_FILE=$SERENITY_SOURCE_DIR/Toolchain/CMake/CMakeToolchain.txt"
files="https://github.com/NagyD/SDLPoP/archive/86988c668eeaa10f218e1d4938fc5b4e42314d68.zip PoP.zip d18cae8541fb8cbcc374fd998316993d561429a83f92061bc0754337ada774c5"
auth_type=sha256
launcher_name="Prince of Persia"
launcher_category=Games
launcher_command=/opt/PrinceOfPersia/prince
configure() {
run cmake $configopts ./src
@ -15,4 +18,5 @@ configure() {
install() {
mkdir -p "${SERENITY_INSTALL_ROOT}/opt/PrinceOfPersia"
run cp -r prince data SDLPoP.ini "${SERENITY_INSTALL_ROOT}/opt/PrinceOfPersia"
install_launcher
}

View file

@ -7,6 +7,9 @@ workdir=Super-Mario-Clone-Cpp-master
configopts="-DCMAKE_TOOLCHAIN_FILE=$SERENITY_SOURCE_DIR/Toolchain/CMake/CMakeToolchain.txt"
files="https://github.com/Bennyhwanggggg/Super-Mario-Clone-Cpp/archive/refs/heads/master.zip master.zip 11f622721d1ba504acf75c024aa0dbe3"
auth_type=md5
launcher_name="Super Mario"
launcher_category=Games
launcher_command=/opt/Super_Mario/uMario
configure() {
run cmake $configopts
@ -15,4 +18,5 @@ configure() {
install() {
run mkdir -p "${SERENITY_INSTALL_ROOT}/opt/Super_Mario"
run cp -r uMario app.ico icon2.ico files "${SERENITY_INSTALL_ROOT}/opt/Super_Mario"
install_launcher
}

View file

@ -7,6 +7,9 @@ workdir=cmatrix-master
configopts="-DCMAKE_TOOLCHAIN_FILE=$SERENITY_SOURCE_DIR/Toolchain/CMake/CMakeToolchain.txt"
files="https://github.com/abishekvashok/cmatrix/archive/refs/heads/master.zip cmatrix.zip 2541321b89149b375d5732402e52d654"
auth_type=md5
launcher_name=cmatrix
launcher_category=Games
launcher_command="Terminal -e cmatrix"
configure() {
run cmake $configopts
@ -14,4 +17,5 @@ configure() {
install() {
run cp cmatrix "${SERENITY_INSTALL_ROOT}/bin"
install_launcher
}

View file

@ -6,3 +6,6 @@ files="https://github.com/SerenityOS/SerenityDOOM/archive/master.tar.gz doom-git
auth_type=md5
makeopts="-C doomgeneric/"
installopts="-C doomgeneric/"
launcher_name=Doom
launcher_category=Games
launcher_command=doom

View file

@ -8,11 +8,10 @@ workdir="${port}-${commit}"
configopts="-DCMAKE_TOOLCHAIN_FILE=$SERENITY_SOURCE_DIR/Toolchain/CMake/CMakeToolchain.txt"
files="https://github.com/hatari/hatari/archive/${commit}.tar.gz ${commit}.tar.gz 614d8c20a06deea6df464a5de32cc795"
auth_type=md5
launcher_name=Hatari
launcher_category=Games
launcher_command=hatari
configure() {
run cmake $configopts
}
install() {
run make install
}

View file

@ -4,3 +4,6 @@ version=git
workdir=nyancat-master
files="https://github.com/klange/nyancat/archive/master.tar.gz nyancat-git.tar.gz dcb9dc135f87a4e5e0e6e72e6c3b2430"
auth_type=md5
launcher_name=Nyancat
launcher_category=Games
launcher_command="Terminal -e nyancat"

View file

@ -6,6 +6,9 @@ useconfigure=false
files="https://github.com/SerenityOS/SerenityQuake/archive/master.tar.gz quake.tar.gz"
makeopts="V=1 SYMBOLS_ON=Y "
depends=SDL2
launcher_name=Quake
launcher_category=Games
launcher_command=quake
# FIXME: Uhh, the things in this directory are not supposed to run on the host, why add this to $PATH?!
export PATH="${SERENITY_INSTALL_ROOT}/usr/bin:${PATH}"

View file

@ -5,6 +5,9 @@ version="0.59.1"
files="https://github.com/vicgeralds/vitetris/archive/refs/tags/v${version}.tar.gz vitetris.tar.gz 699443df03c8d4bf2051838c1015da72039bbbdd0ab0eede891c59c840bdf58d"
configopts="--without-xlib --without-joystick --without-network"
auth_type=sha256
launcher_name=vitetris
launcher_category=Games
launcher_command="Terminal -e tetris"
configure() {
run chmod +x "$configscript"