mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-05 06:28:55 +02:00
freeciv: use system lua, move settings to config directory.
This commit is contained in:
208
games-strategy/freeciv/patches/freeciv-2.5.6.patchset
Normal file
208
games-strategy/freeciv/patches/freeciv-2.5.6.patchset
Normal file
@@ -0,0 +1,208 @@
|
||||
From 73d5e6a6266eb72e299cf3361ada072c0f862167 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Sun, 5 Mar 2017 09:18:33 +0100
|
||||
Subject: move ~/.freeciv to ~/config/settings/freeciv on Haiku.
|
||||
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 5440a23..d6c8cbd 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -154,6 +154,7 @@ AM_CONDITIONAL(SERVER, test x$server = xyes)
|
||||
dnl Host type variable defaults
|
||||
MINGW32=no
|
||||
AMIGA=no
|
||||
+HAIKU=no
|
||||
|
||||
dnl Settings specific to host OS
|
||||
case "$host_os" in
|
||||
@@ -161,6 +162,9 @@ case "$host_os" in
|
||||
*mingw32*)
|
||||
dnl Windows-specific settings
|
||||
MINGW32=yes ;;
|
||||
+ *haiku*)
|
||||
+ dnl Haiku-specific settings
|
||||
+ HAIKU=yes ;;
|
||||
esac
|
||||
|
||||
dnl Networking headers
|
||||
@@ -1264,9 +1268,15 @@ if test x"$MINGW32" = xyes; then
|
||||
fi
|
||||
else
|
||||
FC_CONF_PATH="$sysconfdir/freeciv"
|
||||
- DEFAULT_DATA_PATH=".:data:~/.freeciv/$DATASUBDIR:$datadir/freeciv"
|
||||
- DEFAULT_SAVE_PATH=".:~/.freeciv/saves"
|
||||
- DEFAULT_SCENARIO_PATH=".:data/scenarios:~/.freeciv/$DATASUBDIR/scenarios:~/.freeciv/scenarios:$datadir/freeciv/scenarios"
|
||||
+ if test x"$HAIKU" = xyes; then
|
||||
+ DEFAULT_DATA_PATH=".:data:~/config/settings/freeciv/$DATASUBDIR:$datadir/freeciv"
|
||||
+ DEFAULT_SAVE_PATH=".:~/config/settings/freeciv/saves"
|
||||
+ DEFAULT_SCENARIO_PATH=".:data/scenarios:~/config/settings/freeciv/$DATASUBDIR/scenarios:~/config/settings/freeciv/scenarios:$datadir/freeciv/scenarios"
|
||||
+ else
|
||||
+ DEFAULT_DATA_PATH=".:data:~/.freeciv/$DATASUBDIR:$datadir/freeciv"
|
||||
+ DEFAULT_SAVE_PATH=".:~/.freeciv/saves"
|
||||
+ DEFAULT_SCENARIO_PATH=".:data/scenarios:~/.freeciv/$DATASUBDIR/scenarios:~/.freeciv/scenarios:$datadir/freeciv/scenarios"
|
||||
+ fi
|
||||
fi
|
||||
CPPFLAGS="$CPPFLAGS -DFC_CONF_PATH=\"\\\"$FC_CONF_PATH\\\"\""
|
||||
CPPFLAGS="$CPPFLAGS -DDEFAULT_DATA_PATH=\"\\\"$DEFAULT_DATA_PATH\\\"\""
|
||||
--
|
||||
2.10.2
|
||||
|
||||
|
||||
From 91498461eb233ce8bf466c190bc4a05e2f850259 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Sun, 5 Mar 2017 10:19:43 +0100
|
||||
Subject: .freeciv => config/settings/freeciv
|
||||
|
||||
|
||||
diff --git a/client/connectdlg_common.c b/client/connectdlg_common.c
|
||||
index 0cb630b..95c1152 100644
|
||||
--- a/client/connectdlg_common.c
|
||||
+++ b/client/connectdlg_common.c
|
||||
@@ -298,9 +298,17 @@ bool client_start_server(void)
|
||||
argv[argc++] = "1";
|
||||
argv[argc++] = "-e";
|
||||
argv[argc++] = "--saves";
|
||||
+#ifdef __HAIKU__
|
||||
+ argv[argc++] = "~/config/settings/freeciv/saves";
|
||||
+#else
|
||||
argv[argc++] = "~/.freeciv/saves";
|
||||
+#endif
|
||||
argv[argc++] = "--scenarios";
|
||||
+#ifdef __HAIKU__
|
||||
+ argv[argc++] = "~/config/settings/freeciv/scenarios";
|
||||
+#else
|
||||
argv[argc++] = "~/.freeciv/scenarios";
|
||||
+#endif
|
||||
argv[argc++] = "-A";
|
||||
argv[argc++] = "none";
|
||||
if (logfile) {
|
||||
@@ -435,10 +443,18 @@ bool client_start_server(void)
|
||||
free(savefile_in_local_encoding);
|
||||
}
|
||||
|
||||
+#ifdef __HAIKU__
|
||||
+ interpret_tilde(savesdir, sizeof(savesdir), "~/config/settings/freeciv/saves");
|
||||
+#else
|
||||
interpret_tilde(savesdir, sizeof(savesdir), "~/.freeciv/saves");
|
||||
+#endif
|
||||
internal_to_local_string_buffer(savesdir, savescmdline, sizeof(savescmdline));
|
||||
|
||||
+#ifdef __HAIKU__
|
||||
interpret_tilde(scensdir, sizeof(scensdir), "~/.freeciv/scenarios");
|
||||
+#else
|
||||
+ interpret_tilde(scensdir, sizeof(scensdir), "~/.freeciv/scenarios");
|
||||
+#endif
|
||||
internal_to_local_string_buffer(scensdir, scenscmdline, sizeof(scenscmdline));
|
||||
|
||||
fc_snprintf(options, sizeof(options),
|
||||
@@ -596,7 +612,11 @@ void send_client_wants_hack(const char *filename)
|
||||
|
||||
/* get the full filename path */
|
||||
interpret_tilde(challenge_fullname, sizeof(challenge_fullname),
|
||||
+#ifdef __HAIKU__
|
||||
+ "~/config/settings/freeciv/");
|
||||
+#else
|
||||
"~/.freeciv/");
|
||||
+#endif
|
||||
make_dir(challenge_fullname);
|
||||
|
||||
sz_strlcat(challenge_fullname, filename);
|
||||
diff --git a/client/options.c b/client/options.c
|
||||
index a70aca3..544e319 100644
|
||||
--- a/client/options.c
|
||||
+++ b/client/options.c
|
||||
@@ -19,6 +19,9 @@
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
+#ifdef __HAIKU__
|
||||
+ #include <libgen.h>
|
||||
+#endif
|
||||
|
||||
/* utility */
|
||||
#include "fcintl.h"
|
||||
@@ -4615,7 +4618,11 @@ static void save_cma_presets(struct section_file *file)
|
||||
/* Old rc file name. */
|
||||
#define OLD_OPTION_FILE_NAME ".civclientrc"
|
||||
/* New rc file name. */
|
||||
-#define NEW_OPTION_FILE_NAME ".freeciv-client-rc-%d.%d"
|
||||
+#ifdef __HAIKU__
|
||||
+# define NEW_OPTION_FILE_NAME "config/settings/freeciv/freeciv-client-rc-%d.%d"
|
||||
+#else
|
||||
+# define NEW_OPTION_FILE_NAME ".freeciv-client-rc-%d.%d"
|
||||
+#endif
|
||||
#define MAJOR_NEW_OPTION_FILE_NAME MAJOR_VERSION
|
||||
#if IS_DEVEL_VERSION && ! IS_FREEZE_VERSION
|
||||
#define MINOR_NEW_OPTION_FILE_NAME (MINOR_VERSION + 1)
|
||||
@@ -5335,6 +5342,13 @@ void options_save(option_save_log_callback log_cb)
|
||||
/* insert global worklists */
|
||||
global_worklists_save(sf);
|
||||
|
||||
+#ifdef __HAIKU__
|
||||
+{
|
||||
+ char path[PATH_MAX];
|
||||
+ strcpy(path, name);
|
||||
+ make_dir(dirname(path));
|
||||
+}
|
||||
+#endif
|
||||
/* save to disk */
|
||||
if (!secfile_save(sf, name, 0, FZ_PLAIN)) {
|
||||
log_cb(LOG_ERROR, _("Save failed, cannot write to file %s"), name);
|
||||
diff --git a/server/gamehand.c b/server/gamehand.c
|
||||
index 35dcca5..9671dc6 100644
|
||||
--- a/server/gamehand.c
|
||||
+++ b/server/gamehand.c
|
||||
@@ -1010,7 +1010,7 @@ static const char *get_challenge_fullname(struct connection *pc)
|
||||
{
|
||||
static char fullname[MAX_LEN_PATH];
|
||||
|
||||
- interpret_tilde(fullname, sizeof(fullname), "~/.freeciv/");
|
||||
+ interpret_tilde(fullname, sizeof(fullname), "~/config/settings/freeciv/");
|
||||
sz_strlcat(fullname, get_challenge_filename(pc));
|
||||
|
||||
return fullname;
|
||||
diff --git a/server/sernet.c b/server/sernet.c
|
||||
index 5bfbe3f..e17c8b4 100644
|
||||
--- a/server/sernet.c
|
||||
+++ b/server/sernet.c
|
||||
@@ -42,6 +42,9 @@
|
||||
#ifdef HAVE_LIBREADLINE
|
||||
#include <readline/history.h>
|
||||
#include <readline/readline.h>
|
||||
+#ifdef __HAIKU__
|
||||
+#include <libgen.h>
|
||||
+#endif
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
@@ -163,7 +166,11 @@ static void handle_stdin_close(void)
|
||||
#ifdef HAVE_LIBREADLINE
|
||||
/****************************************************************************/
|
||||
|
||||
-#define HISTORY_FILENAME ".freeciv-server_history"
|
||||
+#ifdef __HAIKU__
|
||||
+# define HISTORY_FILENAME "config/settings/freeciv/server_history"
|
||||
+#else
|
||||
+# define HISTORY_FILENAME ".freeciv-server_history"
|
||||
+#endif
|
||||
#define HISTORY_LENGTH 100
|
||||
|
||||
static char *history_file = NULL;
|
||||
@@ -517,6 +524,13 @@ enum server_events server_sniff_all_input(void)
|
||||
strcpy(history_file, home_dir);
|
||||
strcat(history_file, "/");
|
||||
strcat(history_file, HISTORY_FILENAME);
|
||||
+#ifdef __HAIKU__
|
||||
+ {
|
||||
+ char path[PATH_MAX];
|
||||
+ strcpy(path, history_file);
|
||||
+ make_dir(dirname(path));
|
||||
+ }
|
||||
+#endif
|
||||
using_history();
|
||||
read_history(history_file);
|
||||
}
|
||||
--
|
||||
2.10.2
|
||||
|
||||
Reference in New Issue
Block a user