starfighter: new recipe (#4752)

This commit is contained in:
Crestwave
2020-02-27 04:31:40 +08:00
committed by GitHub
parent cd00ee7aed
commit 4ee8b57e7f
2 changed files with 99 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
--- a/src/engine.c
+++ b/src/engine.c
@@ -22,9 +22,13 @@
#include <sys/stat.h>
#include <unistd.h>
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#else
#ifndef _WIN32
#include <pwd.h>
#endif
+#endif
#include "SDL.h"
@@ -212,6 +216,17 @@
engine_showError(2, dir);
snprintf(engine.configDirectory, PATH_MAX, "%s/", dir);
+#elif __HAIKU__
+ subdir = "starfighter";
+
+ char path[PATH_MAX];
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, 0, false, path, PATH_MAX) == B_OK)
+ snprintf(dir, PATH_MAX, "%s/%s", path, subdir);
+
+ if ((mkdir(dir, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH) != 0) && (errno != EEXIST))
+ engine_showError(2, dir);
+
+ snprintf(engine.configDirectory, PATH_MAX, "%s/", dir);
#else
subdir = "starfighter";

View File

@@ -0,0 +1,65 @@
SUMMARY="A side-scrolling shoot 'em up space game"
DESCRIPTION="In the year 2579, the intergalactic weapons corporation, WEAPCO, \
has dominated the galaxy. Guide Chris Bainfield and his friend Sid Wilson on \
their quest to liberate the galaxy from the clutches of WEAPCO. Along the way, \
you will encounter new foes, make new allies, and assist local rebels in \
strikes against the evil corporation."
HOMEPAGE="https://pr-starfighter.github.io/"
COPYRIGHT="2003 Parallel Realities
2011, 2012 Guss Sliepen
2015-2019 Julie Marchant"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/pr-starfighter/starfighter/releases/download/v$portVersion/starfighter-${portVersion%.*.*}-src.tar.gz"
CHECKSUM_SHA256="6b481a0fc5d4995c1da6a88c46edaaf75809b85f2c08228a239a4395e02c718f"
SOURCE_FILENAME="starfighter-$portVersion.tar.gz"
SOURCE_DIR="starfighter-${portVersion%.*.*}-src"
PATCHES="starfighter-$portVersion.patch"
ARCHITECTURES="!x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
starfighter$secondaryArchSuffix = $portVersion
app:Starfighter = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libintl$secondaryArchSuffix
lib:libSDL2_2.0$secondaryArchSuffix
lib:libSDL2_image_2.0$secondaryArchSuffix
lib:libSDL2_mixer_2.0$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libintl$secondaryArchSuffix
devel:libSDL2$secondaryArchSuffix
devel:libSDL2_image$secondaryArchSuffix
devel:libSDL2_mixer$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:awk
cmd:gcc$secondaryArchSuffix
cmd:make
cmd:pkg_config$secondaryArchSuffix
"
defineDebugInfoPackage starfighter$secondaryArchSuffix \
"$appsDir/Starfighter"
BUILD()
{
export LIBS="-lintl"
runConfigure ./configure
make $jobArgs
}
INSTALL()
{
make install
install -m 755 -d "$appsDir"
rm -rf "$dataDir/applications" "$dataDir/pixmaps"
mv "$binDir/starfighter" "$appsDir/Starfighter"
addAppDeskbarSymlink "$appsDir/Starfighter" "Project: Starfighter"
}