99 lines
2.7 KiB
Plaintext
99 lines
2.7 KiB
Plaintext
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
|
|
|