diff --git a/games-strategy/freeciv/additional-files/freeciv-postinstall.sh b/games-strategy/freeciv/additional-files/freeciv-postinstall.sh new file mode 100644 index 000000000..71b157f8d --- /dev/null +++ b/games-strategy/freeciv/additional-files/freeciv-postinstall.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +SETTINGS_PATH=$(finddir B_USER_SETTINGS_DIRECTORY)/freeciv +DATA_PATH=$(finddir B_USER_SETTINGS_DIRECTORY)/freeciv/data +SAVE_PATH=$(finddir B_USER_SETTINGS_DIRECTORY)/freeciv/saves +SCENARIO_PATH=$(finddir B_USER_SETTINGS_DIRECTORY)/freeciv/scenarios + +if [ ! -e $SETTINGS_PATH ]; then + mkdir -p $SETTINGS_PATH +fi +if [ ! -e $DATA_PATH ]; then + mkdir -p $DATA_PATH +fi + +if [ ! -e $SAVE_PATH ]; then + mkdir -p $SAVE_PATH +fi + +if [ ! -e $SCENARIO_PATH ]; then + mkdir -p $SCENARIO_PATH +fi diff --git a/games-strategy/freeciv/additional-files/freeciv.rdef.in b/games-strategy/freeciv/additional-files/freeciv.rdef.in index cbcf4de9e..5f5ddae03 100644 --- a/games-strategy/freeciv/additional-files/freeciv.rdef.in +++ b/games-strategy/freeciv/additional-files/freeciv.rdef.in @@ -11,7 +11,7 @@ resource app_version { variety = B_APPV_DEVELOPMENT, internal = @INTERNAL@, short_info = "Freeciv", - long_info = "Freeciv, a civilization-like game.\nCopyright 2002-2015 The Freeciv Team" + long_info = "Freeciv, a civilization-like game.\nCopyright 2002-2025 The Freeciv Team" }; resource file_types message; diff --git a/games-strategy/freeciv/freeciv-3.0.8.recipe b/games-strategy/freeciv/freeciv-3.1.4.recipe similarity index 83% rename from games-strategy/freeciv/freeciv-3.0.8.recipe rename to games-strategy/freeciv/freeciv-3.1.4.recipe index 9014e5b1c..710078623 100644 --- a/games-strategy/freeciv/freeciv-3.0.8.recipe +++ b/games-strategy/freeciv/freeciv-3.1.4.recipe @@ -9,12 +9,17 @@ adjustable parameters to make customizing games possible. Freeciv has been implemented completely independently of Civilization; \ you do not need to own Civilization to play Freeciv." HOMEPAGE="http://www.freeciv.org/" -COPYRIGHT="1996-2020 The Freeciv Team" +COPYRIGHT="1996-2025 The Freeciv Team" LICENSE="GNU GPL v2" REVISION="1" SOURCE_URI="https://downloads.sourceforge.net/sourceforge/freeciv/freeciv-$portVersion.tar.xz" -CHECKSUM_SHA256="3b5aa32f628890be1741c3ac942cee82c79c065f8db6baff18d734a5c0e776d4" -ADDITIONAL_FILES="freeciv.rdef.in" +CHECKSUM_SHA256="14999bb903c4507cc287d5a8dd1b89eee623bb41b4e01e0836567fb5f13296e4" +PATCHES="freeciv-$portVersion.patchset" +ADDITIONAL_FILES=" + freeciv.rdef.in + freeciv-postinstall.sh + " +POST_INSTALL_SCRIPTS="$relativePostInstallDir/freeciv-postinstall.sh" ARCHITECTURES="all !x86_gcc2" SECONDARY_ARCHITECTURES="x86" @@ -58,6 +63,7 @@ REQUIRES=" lib:libSDL2_image_2.0$secondaryArchSuffix lib:libSDL2_mixer_2.0$secondaryArchSuffix lib:libSDL2_ttf_2.0$secondaryArchSuffix + lib:libsqlite3$secondaryArchSuffix lib:libz$secondaryArchSuffix " @@ -68,7 +74,7 @@ BUILD_REQUIRES=" devel:libfreetype$secondaryArchSuffix devel:libicuuc$secondaryArchSuffix devel:libiconv$secondaryArchSuffix - devel:liblua$secondaryArchSuffix >= 5.3 + devel:liblua$secondaryArchSuffix >= 5.4 devel:liblzma$secondaryArchSuffix devel:libreadline$secondaryArchSuffix devel:libsdl2_2.0$secondaryArchSuffix @@ -76,6 +82,7 @@ BUILD_REQUIRES=" devel:libsdl2_image_2.0$secondaryArchSuffix devel:libsdl2_mixer_2.0$secondaryArchSuffix devel:libsdl2_ttf_2.0$secondaryArchSuffix + devel:libsqlite3$secondaryArchSuffix devel:libz$secondaryArchSuffix " BUILD_PREREQUIRES=" @@ -117,8 +124,12 @@ INSTALL() -e "s|@INTERNAL@|$INTERNAL|" \ $portDir/additional-files/freeciv.rdef.in > freeciv.rdef - addResourcesToBinaries freeciv.rdef \ - $appsDir/Freeciv + # Setup post-install script (to prevent issues with save and config paths) + mkdir -p $postInstallDir + cp $portDir/additional-files/freeciv-postinstall.sh $postInstallDir + chmod +x $postInstallDir/freeciv-postinstall.sh + + addResourcesToBinaries freeciv.rdef $appsDir/Freeciv addAppDeskbarSymlink $appsDir/Freeciv mv $prefix/share/* $dataRootDir diff --git a/games-strategy/freeciv/patches/freeciv-3.1.4.patchset b/games-strategy/freeciv/patches/freeciv-3.1.4.patchset new file mode 100644 index 000000000..982b43eb3 --- /dev/null +++ b/games-strategy/freeciv/patches/freeciv-3.1.4.patchset @@ -0,0 +1,149 @@ +From a51c9aed56ae66001f0bfbba12d7c203877fe8a3 Mon Sep 17 00:00:00 2001 +From: Peppersawce +Date: Thu, 20 Mar 2025 13:40:40 +0100 +Subject: Fix settings dir usage. + + +diff --git a/client/connectdlg_common.c b/client/connectdlg_common.c +index ce7bb04..4612a55 100644 +--- a/client/connectdlg_common.c ++++ b/client/connectdlg_common.c +@@ -22,6 +22,7 @@ + #include /* SIGTERM and kill */ + #include + #include ++#include + + #ifdef FREECIV_MSWINDOWS + #include +@@ -681,7 +682,7 @@ void send_client_wants_hack(const char *filename) + return; + } + +- if (!make_dir(sdir)) { ++ if (!make_dir(sdir) && errno != EEXIST && errno != EROFS) { + log_error("Couldn't create storage directory for token."); + return; + } +diff --git a/client/options.c b/client/options.c +index 6aafa8b..a7a416d 100644 +--- a/client/options.c ++++ b/client/options.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + + /* utility */ + #include "deprecations.h" +@@ -6138,7 +6139,7 @@ void options_save(option_save_log_callback log_cb) + + if (i > 0) { + dir_name[i] = '\0'; +- if (!make_dir(dir_name)) { ++ if (!make_dir(dir_name) && errno != EEXIST && errno != EROFS) { + log_cb(LOG_ERROR, _("Saving options failed, cannot create directory %s"), + dir_name); + secfile_destroy(sf); +diff --git a/common/mapimg.c b/common/mapimg.c +index 018f2bf..2f3f15a 100644 +--- a/common/mapimg.c ++++ b/common/mapimg.c +@@ -16,6 +16,7 @@ + #endif + + #include ++#include + + #ifdef HAVE_MAPIMG_MAGICKWAND + #ifdef FREECIV_MWAND7 +@@ -2051,7 +2052,7 @@ static bool img_save(const struct img *pimg, const char *mapimgfile, + } + + if (!path_is_absolute(mapimgfile) && path != NULL && path[0] != '\0') { +- if (!make_dir(path)) { ++ if (!make_dir(path) && errno != EEXIST && errno != EROFS) { + MAPIMG_LOG(_("can't create directory")); + return FALSE; + } +diff --git a/server/savegame/savemain.c b/server/savegame/savemain.c +index 6207dc7..3993c37 100644 +--- a/server/savegame/savemain.c ++++ b/server/savegame/savemain.c +@@ -15,6 +15,7 @@ + #include + #endif + ++#include + /* utility */ + #include "log.h" + #include "mem.h" +@@ -259,7 +260,7 @@ void save_game(const char *orig_filename, const char *save_reason, + if (!scenario) { + /* Ensure the saves directory exists. */ + if (srvarg.saves_pathname[0] != '\0' +- && !make_dir(srvarg.saves_pathname)) { ++ && !make_dir(srvarg.saves_pathname) && errno != EEXIST && errno != EROFS) { + log_error(_("Can't create saves directory %s!"), + srvarg.saves_pathname); + /* Don't tell server paths to clients */ +@@ -277,7 +278,7 @@ void save_game(const char *orig_filename, const char *save_reason, + } else { + /* Make sure scenario directory exist */ + if (srvarg.scenarios_pathname[0] != '\0' +- && !make_dir(srvarg.scenarios_pathname)) { ++ && !make_dir(srvarg.scenarios_pathname) && errno != EEXIST && errno != EROFS) { + log_error(_("Can't create scenario saves directory %s!"), + srvarg.scenarios_pathname); + /* Don't tell server paths to clients */ +diff --git a/tools/fcmp/download.c b/tools/fcmp/download.c +index 965f430..d994774 100644 +--- a/tools/fcmp/download.c ++++ b/tools/fcmp/download.c +@@ -348,7 +348,7 @@ static const char *download_modpack_recursive(const char *URL, + free(dest_name_copy); + #endif /* DIR_SEPARATOR_IS_DEFAULT */ + +- if (!make_dir_for_file(local_name)) { ++ if (!make_dir_for_file(local_name) && errno != EEXIST && errno != EROFS) { + secfile_destroy(control); + return _("Cannot create required directories"); + } +diff --git a/tools/fcmp/mpdb.c b/tools/fcmp/mpdb.c +index be88914..e824d6e 100644 +--- a/tools/fcmp/mpdb.c ++++ b/tools/fcmp/mpdb.c +@@ -16,6 +16,7 @@ + #endif + + #include ++#include + + /* utility */ + #include "capability.h" +@@ -144,7 +145,7 @@ void create_mpdb(const char *filename, bool scenario_db) + /* Nothing */ + } + local_name[i] = '\0'; +- if (!make_dir(local_name)) { ++ if (!make_dir(local_name) && errno != EEXIST && errno != EROFS) { + log_error(_("Can't create directory \"%s\" for modpack database."), local_name); + return; + } +diff --git a/utility/shared.c b/utility/shared.c +index 3883c1c..1c30e86 100644 +--- a/utility/shared.c ++++ b/utility/shared.c +@@ -1859,7 +1859,7 @@ bool make_dir_for_file(char *filename) + filename[i] = '\0'; + log_debug("Create directory \"%s\"", filename); + +- if (!make_dir(filename)) { ++ if (!make_dir(filename) && errno != EEXIST && errno != EROFS) { + return FALSE; + } + filename[i] = DIR_SEPARATOR_CHAR; +-- +2.48.1 +