warmux: new recipe (#4764)

This commit is contained in:
Crestwave
2020-05-26 02:23:55 +08:00
committed by GitHub
parent eb243c1da0
commit 43a37f4c03
2 changed files with 224 additions and 0 deletions

View File

@@ -0,0 +1,130 @@
--- a/lib/warmux/net/network.cpp
+++ b/lib/warmux/net/network.cpp
@@ -19,6 +19,7 @@
* Network layer for warmux.
*****************************************************************************/
+#include <sys/time.h>
#include <sys/types.h>
#include <iostream>
--- a/lib/warmux/tools/file_tools.cpp
+++ b/lib/warmux/tools/file_tools.cpp
@@ -88,7 +88,7 @@
if (subdir.size() != 0) {
// Create the directory if it doesn't exist
- if (MKDIR(subdir.c_str()) != 0 && errno != EEXIST)
+ if (!DoesFolderExist(subdir.c_str()) && MKDIR(subdir.c_str()) != 0 && errno != EEXIST)
return false;
}
pos = dir.find("/", pos+1);
@@ -277,6 +277,8 @@
struct dirent *file;
#ifdef __SYMBIAN32__
std::string dname;
+#elif __HAIKU__
+ struct stat st;
#endif
};
@@ -302,6 +304,9 @@
#ifdef __SYMBIAN32__
if (f->file->d_namlen && DoesFolderExist(f->dname+"/"+std::string(f->file->d_name))) {
+#elif __HAIKU__
+ stat(f->file->d_name, &f->st);
+ if (S_ISDIR(f->st.st_mode)) {
#else
if (f->file->d_type == DT_DIR) {
#endif
@@ -318,6 +323,8 @@
// This is a file and we do search for file
#ifdef __SYMBIAN32__
if (f->file->d_namlen && DoesFileExist(f->dname+"/"+std::string(f->file->d_name))) {
+#elif __HAIKU__
+ if (S_ISREG(f->st.st_mode)) {
#else
if (f->file->d_type == DT_REG) {
#endif
--- a/src/game/config.cpp
+++ b/src/game/config.cpp
@@ -37,6 +37,11 @@
# include <direct.h>
#endif
+#ifdef __HAIKU__
+# include <FindDirectory.h>
+# include <libgen.h>
+#endif
+
#include <WARMUX_file_tools.h>
#include <WARMUX_team_config.h>
@@ -201,7 +206,24 @@
personal_config_dir = GetHome() + PATH_SEPARATOR "Warmux" PATH_SEPARATOR;
personal_data_dir = personal_config_dir;
-#else //Neither WIN32, ANDROID or __APPLE__
+#elif __HAIKU__
+ char path[B_PATH_NAME_LENGTH];
+ find_path(B_APP_IMAGE_SYMBOL, B_FIND_PATH_DATA_DIRECTORY, "warmux/", path, B_PATH_NAME_LENGTH);
+ data_dir = path;
+
+# ifdef ENABLE_NLS
+ find_path(B_APP_IMAGE_SYMBOL, B_FIND_PATH_DATA_DIRECTORY, "locale/", path, B_PATH_NAME_LENGTH);
+ locale_dir = path;
+# endif
+
+ font_dir = data_dir + "font/";
+ ttf_filename = font_dir + basename(FONT_FILE);
+
+ find_directory(B_USER_SETTINGS_DIRECTORY, 0, false, path, B_PATH_NAME_LENGTH);
+ personal_config_dir = std::string(path) + "/warmux/";
+ personal_data_dir = data_dir;
+
+#else //Neither WIN32, ANDROID, __APPLE__ or __HAIKU__
data_dir = GetEnv(Constants::ENV_DATADIR, INSTALL_DATADIR);
# ifdef ENABLE_NLS
locale_dir = GetEnv(Constants::ENV_LOCALEDIR, INSTALL_LOCALEDIR);
@@ -393,6 +415,8 @@
m_default_config = GetDataDir() + "warmux_default_maemo_config.xml";
#elif __SYMBIAN32__
m_default_config = GetDataDir() + "warmux_default_symbian_config.xml";
+#elif __HAIKU__
+ m_default_config = personal_data_dir + "warmux_default_config.xml";
#else
m_default_config = GetDataDir() + "warmux_default_config.xml";
#endif
--- a/src/graphic/surface.cpp
+++ b/src/graphic/surface.cpp
@@ -25,6 +25,7 @@
#include <SDL_image.h>
#include <SDL_rotozoom.h>
#include <png.h>
+#include <zlib.h>
#include "graphic/surface.h"
#include "tool/math_tools.h"
--- a/src/interface/weapon_menu.cpp
+++ b/src/interface/weapon_menu.cpp
@@ -391,7 +391,7 @@
Weapon * WeaponsMenu::UpdateCurrentOverflyItem(const Polygon * poly)
{
if (!show)
- return false;
+ return NULL;
const std::vector<PolygonItem *>& items = poly->GetItem();
WeaponMenuItem * tmp;
Interface::GetInstance()->SetCurrentOverflyWeapon(NULL);
--- a/src/menu/network_teams_selection_box.cpp
+++ b/src/menu/network_teams_selection_box.cpp
@@ -114,6 +114,8 @@
result = "Android";
#elif defined(__SYMBIAN32__)
result = "Symbian";
+#elif defined(__HAIKU__)
+ result = "Haiku";
#else
result = getenv("USER");
#endif

View File

@@ -0,0 +1,94 @@
SUMMARY="Exterminate your opponent in a 2D environment with toon-style scenery"
DESCRIPTION="Have the mascots of your favorite free software battle in the \
Warmux arena. Using dynamite, grenades, baseball bats and other weapons... \
exterminate your opponent in a 2D toon style scenery and a funny environment.
Each player (2 minimum, on the same PC) controls the team of his choice (tux, \
gnu, firefox, wilder,...) and must destroy his adversary using more or less \
casual weapons.
Although a minimum of strategy is required to vanquish, Warmux is \
pre-eminently a \"convival mass murder\" game where, turn by turn, each \
member of each team attemps to produce a maximum of damage to his opponents."
HOMEPAGE="https://github.com/a-team/wormux"
COPYRIGHT="2001-2011 Warmux Team"
LICENSE="GNU GPL v2"
REVISION="1"
srcGitRev="e0dc503460055a14a0d7fd94e66d7484264ee62b"
SOURCE_URI="$HOMEPAGE/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="d5e66808de2e4912a64b583e3be4b8ea52cd220b8617a113507cca2c2291c6d3"
SOURCE_FILENAME="warmux-$srcGitRev.tar.gz"
SOURCE_DIR="wormux-$srcGitRev"
PATCHES="warmux-$portVersion.patch"
ARCHITECTURES="!x86_gcc2 ?x86 x86_64"
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
SECONDARY_ARCHITECTURES="x86"
commandBinDir=$prefix/bin
fi
PROVIDES="
warmux$secondaryArchSuffix = $portVersion
app:Warmux = $portVersion
cmd:warmux_list_games
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libfribidi$secondaryArchSuffix
lib:libintl$secondaryArchSuffix
lib:libpng16$secondaryArchSuffix
lib:libSDL_1.2$secondaryArchSuffix
lib:libSDL_gfx$secondaryArchSuffix
lib:libSDL_image_1.2$secondaryArchSuffix
lib:libSDL_net_1.2$secondaryArchSuffix
lib:libSDL_mixer_1.2$secondaryArchSuffix
lib:libSDL_ttf_2.0$secondaryArchSuffix
lib:libxml2$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libintl$secondaryArchSuffix
devel:libfribidi$secondaryArchSuffix
devel:libpng16$secondaryArchSuffix
devel:libSDL_1.2$secondaryArchSuffix
devel:libSDL_gfx$secondaryArchSuffix
devel:libSDL_image_1.2$secondaryArchSuffix
devel:libSDL_net_1.2$secondaryArchSuffix
devel:libSDL_mixer_1.2$secondaryArchSuffix
devel:libSDL_ttf_2.0$secondaryArchSuffix
devel:libxml2$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:awk
cmd:find
cmd:gcc$secondaryArchSuffix
cmd:make
cmd:pkg_config$secondaryArchSuffix
"
defineDebugInfoPackage warmux$secondaryArchSuffix \
"$appsDir/Warmux" \
"$commandBinDir/warmux-list-games"
BUILD()
{
export LIBS="-lnetwork"
runConfigure --omit-dirs binDir ./configure \
--bindir="$commandBinDir" \
--build=x86 \
--enable-fribidi
make $jobArgs
}
INSTALL()
{
make install
install -m 755 -d "$appsDir" "$dataDir"
mv "$prefix/share"/* "$dataDir"
rm -rf "$dataDir/applications" "$dataDir/pixmaps" "$prefix/share"
mv "$commandBinDir/warmux" "$appsDir/Warmux"
addAppDeskbarSymlink "$appsDir/Warmux"
}