summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Beutner <gunnar@beutner.name>2021-04-20 18:36:03 +0200
committerLinus Groh <mail@linusgroh.de>2021-04-23 11:33:57 +0200
commite72235b9812557c8e313b2d49a8bdd21abfda843 (patch)
treec8772fcf8d172b0e743e635b445f616408fcd2c9
parent1e5a7ca0a7f4ab8cf4de06533902a699b57a9509 (diff)
downloadserenity-e72235b9812557c8e313b2d49a8bdd21abfda843.zip
Ports: Add launchers for some of the ports
-rwxr-xr-xPorts/.port_include.sh31
-rwxr-xr-xPorts/SDLPoP/package.sh4
-rwxr-xr-xPorts/Super-Mario/package.sh4
-rwxr-xr-xPorts/cmatrix/package.sh4
-rwxr-xr-xPorts/doom/package.sh3
-rwxr-xr-xPorts/hatari/package.sh7
-rwxr-xr-xPorts/nyancat/package.sh3
-rwxr-xr-xPorts/quake/package.sh3
-rwxr-xr-xPorts/vitetris/package.sh3
9 files changed, 57 insertions, 5 deletions
diff --git a/Ports/.port_include.sh b/Ports/.port_include.sh
index aac65135b7..29651d2f3f 100755
--- a/Ports/.port_include.sh
+++ b/Ports/.port_include.sh
@@ -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
diff --git a/Ports/SDLPoP/package.sh b/Ports/SDLPoP/package.sh
index 0280450782..3c24fb87a7 100755
--- a/Ports/SDLPoP/package.sh
+++ b/Ports/SDLPoP/package.sh
@@ -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
}
diff --git a/Ports/Super-Mario/package.sh b/Ports/Super-Mario/package.sh
index 6a2808a224..df49d7e75f 100755
--- a/Ports/Super-Mario/package.sh
+++ b/Ports/Super-Mario/package.sh
@@ -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
}
diff --git a/Ports/cmatrix/package.sh b/Ports/cmatrix/package.sh
index 2db524c9b1..129936538f 100755
--- a/Ports/cmatrix/package.sh
+++ b/Ports/cmatrix/package.sh
@@ -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
}
diff --git a/Ports/doom/package.sh b/Ports/doom/package.sh
index a4600ca7b3..9b03523e68 100755
--- a/Ports/doom/package.sh
+++ b/Ports/doom/package.sh
@@ -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
diff --git a/Ports/hatari/package.sh b/Ports/hatari/package.sh
index 4fa2186c25..b48ef61b78 100755
--- a/Ports/hatari/package.sh
+++ b/Ports/hatari/package.sh
@@ -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
-}
diff --git a/Ports/nyancat/package.sh b/Ports/nyancat/package.sh
index 07b6813b1e..daf7f9e6a2 100755
--- a/Ports/nyancat/package.sh
+++ b/Ports/nyancat/package.sh
@@ -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"
diff --git a/Ports/quake/package.sh b/Ports/quake/package.sh
index 79042203fb..1cee8db712 100755
--- a/Ports/quake/package.sh
+++ b/Ports/quake/package.sh
@@ -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}"
diff --git a/Ports/vitetris/package.sh b/Ports/vitetris/package.sh
index 7793573e8a..3e5d8314f4 100755
--- a/Ports/vitetris/package.sh
+++ b/Ports/vitetris/package.sh
@@ -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"