boswars: new recipe (#4787)

* boswars: new recipe
Co-authored-by: Crestwave <crestwave@users.noreply.github.com>
This commit is contained in:
Crestwave
2020-03-15 15:39:53 +08:00
committed by GitHub
parent 3e4d639eb1
commit f09b8c8d61
2 changed files with 190 additions and 0 deletions

View File

@@ -0,0 +1,92 @@
SUMMARY="A futuristic real time strategy game"
DESCRIPTION="Bos Wars is a futuristic real time strategy game (RTS). In a RTS \
game, the player has to combat his enemies while developing his war economy. \
Everything runs in real-time, as opposed to turn-based games, where the player \
always has to wait for his turn. The trick is to balance the effort put into \
building the economy and building an army to defend and attack the enemies.
Bos Wars has a dynamic rate based economy. Energy is produced by power plants \
and magma gets pumped from hot spots. Buildings and mobile units are also \
built at a continuous rate. Control of larger parts of the map creates the \
potential to increase your economy throughput. Holding key points like roads \
and passages allow for different strategies.
It is possible to play against human opponents over LAN, internet, or against \
the computer. Bos Wars successfully runs under Linux, MS Windows, BSD, Mac OS \
X, and Haiku."
HOMEPAGE="https://www.boswars.org/"
COPYRIGHT="2004-2014 Tina Petersen Jensen, Francois Beerten et al."
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://www.boswars.org/dist/releases/boswars-$portVersion-src.tar.gz"
CHECKSUM_SHA256="dc3718f531e9ea413cf37e1333b62a4c5e69f1405502d9c59b9e424635135e3e"
SOURCE_FILENAME="boswars-$portVersion.tar.gz"
SOURCE_DIR="boswars-$portVersion-src"
PATCHES="boswars-$portVersion.patchset"
ARCHITECTURES="!x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
boswars$secondaryArchSuffix = $portVersion
app:BosWars = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libGL$secondaryArchSuffix
lib:liblua$secondaryArchSuffix
lib:libogg$secondaryArchSuffix
lib:libpng16$secondaryArchSuffix
lib:libSDL_1.2$secondaryArchSuffix
lib:libtheora$secondaryArchSuffix
lib:libvorbis$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libGLU$secondaryArchSuffix
devel:liblua5.1$secondaryArchSuffix
devel:libogg$secondaryArchSuffix
devel:libpng16$secondaryArchSuffix
devel:libSDL$secondaryArchSuffix
devel:libtheora$secondaryArchSuffix
devel:libvorbis$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:pkg_config$secondaryArchSuffix
cmd:python2
"
defineDebugInfoPackage boswars$secondaryArchSuffix \
"$appsDir/BosWars"
PATCH()
{
# Some of the PNGs don't work with the current libraries
# so we must fix them with pngfix
set -- maps/antarticum.map/terrain.png graphics/ui/ui_*.png \
units/radar/radar*.png units/tree*/tree*.png
pngfix --suffix=.fixed "$@" || :
for f; do
mv "$f.fixed" "$f"
done
}
BUILD()
{
./make.py $jobArgs
}
INSTALL()
{
install -d "$appsDir" "$dataDir/boswars" "$docDir"
install -m 755 fbuild/release/boswars "$appsDir/BosWars"
addAppDeskbarSymlink "$appsDir/BosWars" "Bos Wars"
cp -r campaigns graphics intro languages maps patches scripts sounds \
units "$dataDir/boswars"
cp -r doc/* "$docDir"
}

View File

@@ -0,0 +1,98 @@
From 941b19cd7e732d50d701b54fd0b80c9cb2f3205d Mon Sep 17 00:00:00 2001
From: Crestwave <crest.wave@yahoo.com>
Date: Wed, 11 Mar 2020 12:18:49 +0800
Subject: Add Haiku support
diff --git a/engine/stratagus/script.cpp b/engine/stratagus/script.cpp
index 887050d..37b78c0 100644
--- a/engine/stratagus/script.cpp
+++ b/engine/stratagus/script.cpp
@@ -36,6 +36,10 @@
#include <string.h>
#include <signal.h>
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#endif
+
#include "stratagus.h"
#include "unittype.h"
@@ -1450,6 +1454,11 @@ void CreateUserDirectories(void)
std::string directory;
UserDirectory = "";
+#ifdef __HAIKU__
+ char path[B_PATH_NAME_LENGTH];
+ find_directory(B_USER_SETTINGS_DIRECTORY, 0, false, path, B_PATH_NAME_LENGTH);
+ UserDirectory = std::string(path) + "/boswars/";
+#else
std::string s;
#ifdef USE_WIN32
s = getenv("APPDATA");
@@ -1461,6 +1470,7 @@ void CreateUserDirectories(void)
}
UserDirectory += STRATAGUS_HOME_PATH;
+#endif
makedir(UserDirectory.c_str(), 0777);
// Create specific subdirectories
diff --git a/fabricate.py b/fabricate.py
index 5c14e40..8d90382 100644
--- a/fabricate.py
+++ b/fabricate.py
@@ -464,7 +464,7 @@ class StraceRunner(Runner):
def get_strace_version():
""" Return 0 if this system doesn't have strace, nonzero otherwise
(64 if strace supports stat64, 32 otherwise). """
- if platform.system() == 'Windows':
+ if platform.system() == 'Windows' or platform.system() == 'Haiku':
# even if windows has strace, it's probably a dodgy cygwin one
return 0
try:
diff --git a/make.py b/make.py
index c3e4996..917bf67 100755
--- a/make.py
+++ b/make.py
@@ -296,6 +296,7 @@ def detectSdl(b):
sys.exit(1)
def detectAlwaysDynamic(b):
+ CheckLib(b, 'network')
RequireLib(b, 'z', 'zlib.h')
detectOpenGl(b)
detectSdl(b)
diff --git a/engine/stratagus/stratagus.cpp b/engine/stratagus/stratagus.cpp
index ff3a416..def24ca 100644
--- a/engine/stratagus/stratagus.cpp
+++ b/engine/stratagus/stratagus.cpp
@@ -165,6 +165,9 @@
#ifdef __CYGWIN__
#include <getopt.h>
#endif
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#endif
#if defined(_MSC_VER) || defined(__MINGW32__)
extern char *optarg;
extern int optind;
@@ -769,7 +772,14 @@ int main(int argc, char **argv)
// Setup some defaults.
//
#ifndef MAC_BUNDLE
+#ifndef __HAIKU__
StratagusLibPath = STRATAGUS_LIB_PATH;
+#else
+ char path[B_PATH_NAME_LENGTH];
+ find_path(B_APP_IMAGE_SYMBOL, B_FIND_PATH_DATA_DIRECTORY, "boswars/",
+ path, B_PATH_NAME_LENGTH);
+ StratagusLibPath = path;
+#endif
#else
freopen("/tmp/stdout.txt", "w", stdout);
freopen("/tmp/stderr.txt", "w", stderr);
--
2.24.1