blobbyvolley2: new recipe (#4769)

Co-authored-by: Crestwave <crestwave@users.noreply.github.com>
This commit is contained in:
Crestwave
2020-09-21 21:34:38 +08:00
committed by GitHub
parent f08e29b535
commit 0256847355
2 changed files with 226 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
SUMMARY="Official continuation of the famous Blobby Volley 1.x arcade game"
DESCRIPTION="The head-to-head multiplayer ball game
The \"Dedicated Server\" runs with a Gamespeed of 100%, which means 75 FPS
The Port for the Server is 1234."
HOMEPAGE="https://github.com/danielknobe/blobbyvolley2"
COPYRIGHT="2006-2020 Daniel Knobe
2010-2015 Erik Schultheis
2006-2009 Jonathan Sieber
2006 Sven Rech"
LICENSE="GNU GPL v2"
REVISION="1"
srcGitRev="70ec84da660bf59fe36e3d67508d009afa0ae9c8"
SOURCE_URI="$HOMEPAGE/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="917291b4140f573030d63132860cde7cdacae4642efb6adf2abb754cb2c84afe"
SOURCE_FILENAME="blobbyvolley2-$srcGitRev.tar.gz"
SOURCE_DIR="blobbyvolley2-$srcGitRev"
PATCHES="blobbyvolley2-$portVersion.patchset"
ARCHITECTURES="!x86_gcc2 x86 x86_64"
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
SECONDARY_ARCHITECTURES="x86"
commandBinDir=$prefix/bin
fi
PROVIDES="
blobbyvolley2$secondaryArchSuffix = $portVersion
app:Blobby = $portVersion
cmd:blobby_server
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libGL$secondaryArchSuffix
lib:libphysfs$secondaryArchSuffix
lib:libSDL2_2.0$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libboost_system$secondaryArchSuffix
devel:libGL$secondaryArchSuffix
devel:libphysfs$secondaryArchSuffix
devel:libSDL2_2.0$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:make
cmd:pkg_config$secondaryArchSuffix
cmd:zip
"
defineDebugInfoPackage blobby$secondaryArchSuffix \
"$appsDir/Blobby" \
"$commandBinDir/blobby-server"
BUILD()
{
cmake . $cmakeDirArgs \
-DCMAKE_EXE_LINKER_FLAGS="-lnetwork" \
-DCMAKE_INSTALL_BINDIR="$commandBinDir"
make $jobArgs
}
INSTALL()
{
make install
install -m 755 -d "$appsDir" "$dataDir" "$docDir"
mv "$commandBinDir/blobby" "$appsDir/Blobby"
addAppDeskbarSymlink "$appsDir/Blobby" "Blobby Volley 2"
cp -r doc/* README.md "$docDir"
mv "$prefix/share/blobby" "$dataDir"
rm -rf "$dataDir/blobby/Icon.bmp" "$prefix/share"
}

View File

@@ -0,0 +1,149 @@
From 8d8a1511a9d7e212904d7273da8f82542fc8794b Mon Sep 17 00:00:00 2001
From: Crestwave <crestwave@users.noreply.github.com>
Date: Tue, 3 Mar 2020 20:14:00 +0800
Subject: add Haiku support
diff --git a/src/RenderManagerGL2D.cpp b/src/RenderManagerGL2D.cpp
index ef16239..64b7791 100644
--- a/src/RenderManagerGL2D.cpp
+++ b/src/RenderManagerGL2D.cpp
@@ -227,12 +227,14 @@ void RenderManagerGL2D::init(int xResolution, int yResolution, bool fullscreen)
xResolution, yResolution,
screenFlags);
+#ifndef __HAIKU__
// Set icon
SDL_Surface* icon = loadSurface("Icon.bmp");
SDL_SetColorKey(icon, SDL_TRUE,
SDL_MapRGB(icon->format, 0, 0, 0));
SDL_SetWindowIcon(mWindow, icon);
SDL_FreeSurface(icon);
+#endif
// Create gl context
mGlContext = SDL_GL_CreateContext(mWindow);
diff --git a/src/RenderManagerSDL.cpp b/src/RenderManagerSDL.cpp
index 665e943..57a2f6a 100644
--- a/src/RenderManagerSDL.cpp
+++ b/src/RenderManagerSDL.cpp
@@ -125,12 +125,14 @@ void RenderManagerSDL::init(int xResolution, int yResolution, bool fullscreen)
xResolution, yResolution,
screenFlags);
+#ifndef __HAIKU__
// Set icon
SDL_Surface* icon = loadSurface("Icon.bmp");
SDL_SetColorKey(icon, SDL_TRUE,
SDL_MapRGB(icon->format, 0, 0, 0));
SDL_SetWindowIcon(mWindow, icon);
SDL_FreeSurface(icon);
+#endif
// Create renderer to draw in window
mRenderer = SDL_CreateRenderer(mWindow, -1, 0);
diff --git a/src/main.cpp b/src/main.cpp
index 6845783..cde769a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -36,6 +36,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#endif
#endif
+#ifdef __HAIKU__
+ #include <FindDirectory.h>
+#endif
+
#if __DESKTOP__
#ifndef WIN32
#include "config.h"
@@ -83,7 +87,11 @@ void setupPHYSFS()
const std::string separator = fs.getDirSeparator();
// Game should be playable out of the source package on all
// relevant platforms.
- #if __DESKTOP__
+ #ifdef __HAIKU__
+ char path[B_PATH_NAME_LENGTH];
+ find_path(B_APP_IMAGE_SYMBOL, B_FIND_PATH_DATA_DIRECTORY, "blobby/", path, B_PATH_NAME_LENGTH);
+ std::string baseSearchPath = path;
+ #elif __DESKTOP__
std::string baseSearchPath("data" + separator);
#elif (defined __ANDROID__)
std::string baseSearchPath(SDL_AndroidGetExternalStoragePath() + separator);
@@ -117,6 +125,9 @@ void setupPHYSFS()
#else
std::string userdir = fs.getUserDir();
#endif
+ #elif defined(__HAIKU__)
+ find_directory(B_USER_SETTINGS_DIRECTORY, 0, false, path, B_PATH_NAME_LENGTH);
+ std::string userdir = path + separator;
#else
// Linux
std::string userdir = fs.getUserDir();
@@ -129,7 +140,11 @@ void setupPHYSFS()
fs.addToSearchPath(BLOBBY_INSTALL_PREFIX "/share/blobby/backgrounds.zip");
fs.addToSearchPath(BLOBBY_INSTALL_PREFIX "/share/blobby/rules.zip");
#endif
- std::string userAppend = ".blobby";
+ #ifndef __HAIKU__
+ std::string userAppend = ".blobby";
+ #else
+ std::string userAppend = "blobby";
+ #endif
std::string homedir = userdir + userAppend;
/// \todo please review this code and determine if we really need to add userdir to search path
/// only to remove it later
diff --git a/src/server/DedicatedServer.cpp b/src/server/DedicatedServer.cpp
index e2c7c59..539cd88 100644
--- a/src/server/DedicatedServer.cpp
+++ b/src/server/DedicatedServer.cpp
@@ -33,7 +33,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#ifndef WIN32
#ifndef __ANDROID__
+#ifndef __HAIKU__
#include <sys/syslog.h>
+#else
+#include <posix/syslog.h>
+#endif
#endif
#endif
diff --git a/src/server/servermain.cpp b/src/server/servermain.cpp
index 995c181..850a9ef 100644
--- a/src/server/servermain.cpp
+++ b/src/server/servermain.cpp
@@ -44,7 +44,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// platform specific
#ifndef WIN32
+#ifndef __HAIKU__
#include <sys/syslog.h>
+#else
+#include <FindDirectory.h>
+#include <posix/syslog.h>
+#endif
#include <sys/wait.h>
#else
#include <cstdarg>
@@ -304,8 +309,15 @@ void setup_physfs(char* argv0)
fs.addToSearchPath(BLOBBY_INSTALL_PREFIX "/share/blobby/rules.zip");
#endif
#endif
- fs.addToSearchPath("data");
- fs.addToSearchPath("data" + fs.getDirSeparator() + "rules.zip");
+ #ifndef __HAIKU__
+ fs.addToSearchPath("data");
+ fs.addToSearchPath("data" + fs.getDirSeparator() + "rules.zip");
+ #else
+ char path[B_PATH_NAME_LENGTH];
+ find_path(B_APP_IMAGE_SYMBOL, B_FIND_PATH_DATA_DIRECTORY, "blobby", path, B_PATH_NAME_LENGTH);
+ fs.addToSearchPath(path);
+ fs.addToSearchPath(std::string(path) + "/rules.zip");
+ #endif
}
--
2.24.1