mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-09 05:10:05 +02:00
lincity_ng: new recipe (#4776)
This commit is contained in:
85
games-simulation/lincity_ng/lincity_ng-2.9~git.recipe
Normal file
85
games-simulation/lincity_ng/lincity_ng-2.9~git.recipe
Normal file
@@ -0,0 +1,85 @@
|
||||
SUMMARY="City simulation game"
|
||||
DESCRIPTION="LinCity-NG is a city simulation game. It is a polished and \
|
||||
improved version of the classic LinCity game. In the game, you are required to \
|
||||
build and maintain a city. You can win the game either by building a \
|
||||
sustainable economy or by evacuating all citizens with spaceships."
|
||||
HOMEPAGE="https://github.com/lincity-ng/lincity-ng"
|
||||
COPYRIGHT="1995-1997 I J Peters
|
||||
1997-2001 Greg Sharp
|
||||
2004 Corey Keasling
|
||||
2005-2019 Matthias Braun"
|
||||
LICENSE="GNU GPL v2"
|
||||
REVISION="1"
|
||||
srcGitRev="35ffbacb5308a8e825fd737bd08d95032d6c4c8c"
|
||||
SOURCE_URI="$HOMEPAGE/archive/$srcGitRev.tar.gz"
|
||||
CHECKSUM_SHA256="8cb5ce1d98374a656d36c7feb7764a6275e6a6840dc0c5630a997e0a1edbbe43"
|
||||
SOURCE_FILENAME="lincity_ng-$srcGitRev.tar.gz"
|
||||
SOURCE_DIR="lincity-ng-$srcGitRev"
|
||||
PATCHES="lincity_ng-$portVersion.patchset"
|
||||
|
||||
ARCHITECTURES="!x86_gcc2 x86 x86_64"
|
||||
SECONDARY_ARCHITECTURES="x86"
|
||||
|
||||
PROVIDES="
|
||||
lincity_ng$secondaryArchSuffix = $portVersion
|
||||
app:Lincity_NG = $portVersion
|
||||
"
|
||||
REQUIRES="
|
||||
haiku$secondaryArchSuffix
|
||||
lib:libGL$secondaryArchSuffix
|
||||
lib:libphysfs$secondaryArchSuffix
|
||||
lib:libSDL_1.2$secondaryArchSuffix
|
||||
lib:libSDL_gfx$secondaryArchSuffix
|
||||
lib:libSDL_image_1.2$secondaryArchSuffix
|
||||
lib:libSDL_mixer_1.2$secondaryArchSuffix
|
||||
lib:libSDL_ttf_2.0$secondaryArchSuffix
|
||||
lib:libxml2$secondaryArchSuffix
|
||||
lib:libz$secondaryArchSuffix
|
||||
"
|
||||
|
||||
BUILD_REQUIRES="
|
||||
haiku${secondaryArchSuffix}_devel
|
||||
devel:libGL$secondaryArchSuffix
|
||||
devel:libGLU$secondaryArchSuffix
|
||||
devel:libphysfs$secondaryArchSuffix
|
||||
devel:libSDL$secondaryArchSuffix
|
||||
devel:libSDL_gfx$secondaryArchSuffix
|
||||
devel:libSDL_image$secondaryArchSuffix
|
||||
devel:libSDL_mixer$secondaryArchSuffix
|
||||
devel:libSDL_ttf$secondaryArchSuffix
|
||||
devel:libxml2$secondaryArchSuffix
|
||||
devel:libz$secondaryArchSuffix
|
||||
"
|
||||
BUILD_PREREQUIRES="
|
||||
cmd:aclocal
|
||||
cmd:autoreconf
|
||||
cmd:gcc$secondaryArchSuffix
|
||||
cmd:jam
|
||||
cmd:pkg_config$secondaryArchSuffix
|
||||
"
|
||||
|
||||
defineDebugInfoPackage lincity_ng$secondaryArchSuffix \
|
||||
"$appsDir/LinCity-NG"
|
||||
|
||||
BUILD()
|
||||
{
|
||||
grep -v "@" data/gui/creditslist.xml |
|
||||
cut -d\> -f2 | cut -d\< -f1 >CREDITS
|
||||
echo "# automatically generated from data/gui/creditslist.xml." \
|
||||
"Do not edit. #" >>CREDITS
|
||||
./autogen.sh
|
||||
runConfigure ./configure --build=x86
|
||||
jam $jobArgs
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
jam install
|
||||
|
||||
install -m 755 -d "$appsDir" "$docDir"
|
||||
mv "$binDir/lincity-ng" "$appsDir/LinCity-NG"
|
||||
mv "$dataDir/doc"/*/* "$docDir"
|
||||
rm -rf "$binDir" \
|
||||
"$dataDir/doc" "$dataDir/applications" "$dataDir/pixmaps"
|
||||
addAppDeskbarSymlink "$appsDir/LinCity-NG"
|
||||
}
|
||||
141
games-simulation/lincity_ng/patches/lincity_ng-2.9~git.patchset
Normal file
141
games-simulation/lincity_ng/patches/lincity_ng-2.9~git.patchset
Normal file
@@ -0,0 +1,141 @@
|
||||
From 7d5294b708542dc40fa015423bb6dd67c709c763 Mon Sep 17 00:00:00 2001
|
||||
From: Crestwave <crestwave@users.noreply.github.com>
|
||||
Date: Wed, 4 Mar 2020 16:41:54 +0800
|
||||
Subject: Added Haiku support
|
||||
|
||||
|
||||
diff --git a/src/lincity-ng/Config.cpp b/src/lincity-ng/Config.cpp
|
||||
index fbfa4c6..b9389ea 100644
|
||||
--- a/src/lincity-ng/Config.cpp
|
||||
+++ b/src/lincity-ng/Config.cpp
|
||||
@@ -44,8 +44,13 @@ Config::Config()
|
||||
assert(configPtr == 0);
|
||||
|
||||
//Default Values
|
||||
+#ifdef __HAIKU__
|
||||
+ useOpenGL = false;
|
||||
+ useFullScreen = false;
|
||||
+#else
|
||||
useOpenGL = true; //OpenGL is often way too slow
|
||||
useFullScreen = true;
|
||||
+#endif
|
||||
videoX = 1024;
|
||||
videoY = 768;
|
||||
|
||||
diff --git a/src/lincity-ng/main.cpp b/src/lincity-ng/main.cpp
|
||||
index 0f337ff..36b8470 100644
|
||||
--- a/src/lincity-ng/main.cpp
|
||||
+++ b/src/lincity-ng/main.cpp
|
||||
@@ -50,6 +50,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "lincity/lin-city.h"
|
||||
#include "lincity/init_game.h"
|
||||
|
||||
+#ifdef __HAIKU__
|
||||
+#include <FindDirectory.h>
|
||||
+#endif
|
||||
+
|
||||
|
||||
#ifdef ENABLE_BINRELOC
|
||||
#include "binreloc.h"
|
||||
@@ -76,16 +80,27 @@ void initPhysfs(const char* argv0)
|
||||
const char* application = LC_SAVE_DIR;
|
||||
const char* userdir = PHYSFS_getUserDir();
|
||||
const char* dirsep = PHYSFS_getDirSeparator();
|
||||
+#ifndef __HAIKU__
|
||||
char* writedir = new char[strlen(userdir) + strlen(application) + 2];
|
||||
|
||||
// Set configuration directory
|
||||
//sprintf(writedir, "%s.%s", userdir, application);
|
||||
sprintf(writedir, "%s%s", userdir, application);
|
||||
+#else
|
||||
+ char path[B_PATH_NAME_LENGTH];
|
||||
+ find_directory(B_USER_SETTINGS_DIRECTORY, 0, false, path, B_PATH_NAME_LENGTH);
|
||||
+ char* writedir = new char[strlen(path) + strlen(application) + 2];
|
||||
+ sprintf(writedir, "%s%c%s", path, PATH_SLASH, application);
|
||||
+#endif
|
||||
if(!PHYSFS_setWriteDir(writedir)) {
|
||||
// try to create the directory
|
||||
char* mkdir = new char[strlen(application) + 2];
|
||||
sprintf(mkdir, "%s", application);
|
||||
+#ifndef __HAIKU__
|
||||
if(!PHYSFS_setWriteDir(userdir) || !PHYSFS_mkdir(mkdir)) {
|
||||
+#else
|
||||
+ if(!PHYSFS_setWriteDir(path) || !PHYSFS_mkdir(mkdir)) {
|
||||
+#endif
|
||||
std::ostringstream msg;
|
||||
msg << "Failed creating configuration directory '" <<
|
||||
writedir << "': " << PHYSFS_getLastError();
|
||||
diff --git a/src/lincity/fileutil.cpp b/src/lincity/fileutil.cpp
|
||||
index 17c0576..b4b568b 100644
|
||||
--- a/src/lincity/fileutil.cpp
|
||||
+++ b/src/lincity/fileutil.cpp
|
||||
@@ -32,6 +32,10 @@
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
+#ifdef __HAIKU__
|
||||
+#include <FindDirectory.h>
|
||||
+#endif
|
||||
+
|
||||
#if defined (TIME_WITH_SYS_TIME)
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
@@ -377,14 +381,24 @@ void find_localized_paths(void)
|
||||
void init_path_strings(void)
|
||||
{
|
||||
find_libdir();
|
||||
+ /* Various dirs and files */
|
||||
+#if defined(__HAIKU__)
|
||||
+ char path[B_PATH_NAME_LENGTH];
|
||||
+ find_directory(B_USER_SETTINGS_DIRECTORY, 0, false, path, B_PATH_NAME_LENGTH);
|
||||
+
|
||||
+ lc_save_dir_len = strlen(path) + strlen(LC_SAVE_DIR) + 1;
|
||||
+ if ((lc_save_dir = (char *)malloc(lc_save_dir_len + 1)) == 0)
|
||||
+ malloc_failure();
|
||||
+ sprintf(lc_save_dir, "%s%c%s", path, PATH_SLASH, LC_SAVE_DIR);
|
||||
+#else
|
||||
//TODO: use, remove unused vars.
|
||||
const char* homedir = PHYSFS_getUserDir();
|
||||
|
||||
- /* Various dirs and files */
|
||||
lc_save_dir_len = strlen(homedir) + strlen(LC_SAVE_DIR) + 1;
|
||||
if ((lc_save_dir = (char *)malloc(lc_save_dir_len + 1)) == 0)
|
||||
malloc_failure();
|
||||
sprintf(lc_save_dir, "%s%c%s", homedir, PATH_SLASH, LC_SAVE_DIR);
|
||||
+#endif
|
||||
sprintf(colour_pal_file, "%s%c%s", LIBDIR, PATH_SLASH, "colour.pal");
|
||||
sprintf(opening_path, "%s%c%s", LIBDIR, PATH_SLASH, "opening");
|
||||
#if defined (WIN32)
|
||||
@@ -393,7 +407,11 @@ void init_path_strings(void)
|
||||
sprintf(opening_pic, "%s%c%s", opening_path, PATH_SLASH, "open.tga.gz");
|
||||
#endif
|
||||
sprintf(graphic_path, "%s%c%s%c", LIBDIR, PATH_SLASH, "icons", PATH_SLASH);
|
||||
+#if defined (__HAIKU__)
|
||||
+ sprintf(lincityrc_file, "%s%c%s", path, PATH_SLASH, LINCITYRC_FILENAME);
|
||||
+#else
|
||||
sprintf(lincityrc_file, "%s%c%s", homedir, PATH_SLASH, LINCITYRC_FILENAME);
|
||||
+#endif
|
||||
|
||||
/* Paths for message & help files, etc */
|
||||
find_localized_paths();
|
||||
diff --git a/src/lincity/loadsave.h b/src/lincity/loadsave.h
|
||||
index 3905308..8679093 100644
|
||||
--- a/src/lincity/loadsave.h
|
||||
+++ b/src/lincity/loadsave.h
|
||||
@@ -18,8 +18,13 @@
|
||||
# define PATH_SLASH_STRING "/"
|
||||
#endif
|
||||
|
||||
+#if defined(__HAIKU__)
|
||||
+# define LC_SAVE_DIR "lincity-ng"
|
||||
+# define LINCITYRC_FILENAME "lincity-NGrc"
|
||||
+#else
|
||||
# define LC_SAVE_DIR ".lincity-ng"
|
||||
# define LINCITYRC_FILENAME ".lincity-NGrc"
|
||||
+#endif
|
||||
|
||||
#define RESULTS_FILENAME "results.txt"
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
||||
Reference in New Issue
Block a user