From fe7765c2e3f7a8a98bf61a1212041ea61a65db30 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Fri, 28 Aug 2026 17:33:57 +0300
Subject: [PATCH 2/2] Prepare main branch for 4.0 development

See RM #1380

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 NEWS                                          |  6 +++++
 client/options.c                              |  3 ++-
 data/civ2civ3/README.civ2civ3                 |  2 +-
 doc/BUGS                                      |  2 +-
 doc/README                                    |  2 +-
 doc/README.packaging                          | 24 ++++++------------
 doc/README.rulesets                           |  2 ++
 doc/README.tilesets                           |  2 ++
 fc_version                                    | 18 ++++++-------
 meson.build                                   |  2 +-
 .../windows/installer_msys2/Makefile.meson    |  4 +--
 server/savegame/savecompat.c                  | 25 ++++++++++++++++---
 translations/Strings.txt                      |  6 ++---
 13 files changed, 60 insertions(+), 38 deletions(-)

diff --git a/NEWS b/NEWS
index dcdf217e4e..4d496ec311 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,12 @@ Not all changes are shown here. Those who are interested in seeing
 the detailed changes should check the ChangeLog file.
 
 
+MAJOR CHANGES FROM 3.4.x to 4.0.0
+---------------------------------
+
+[TODO]
+
+
 MAJOR CHANGES FROM 3.3.x to 3.4.0
 ---------------------------------
 
diff --git a/client/options.c b/client/options.c
index 5db29adb77..40ca63a394 100644
--- a/client/options.c
+++ b/client/options.c
@@ -5685,7 +5685,8 @@ static const char *get_last_option_file_name(bool *allow_digital_boolean)
   static int last_minors[] = {
     0,  /* There was no 0.x releases */
     14, /* 1.14 */
-    6   /* 2.6 */
+    6,  /* 2.6 */
+    4   /* 3.4 */
   };
 
 #if MINOR_VERSION >= 90
diff --git a/data/civ2civ3/README.civ2civ3 b/data/civ2civ3/README.civ2civ3
index df3fccaf4e..ec21c89df5 100644
--- a/data/civ2civ3/README.civ2civ3
+++ b/data/civ2civ3/README.civ2civ3
@@ -1,5 +1,5 @@
 =================================
-Civ2Civ3 Ruleset for Freeciv v3.4
+Civ2Civ3 Ruleset for Freeciv v4.0
 =================================
 
 
diff --git a/doc/BUGS b/doc/BUGS
index 31603d202f..1e058ce7f4 100644
--- a/doc/BUGS
+++ b/doc/BUGS
@@ -2,7 +2,7 @@
 BUGS
 ====
 
-Freeciv 3.4 certainly contains some bugs. Please report all
+Freeciv 4.0 certainly contains some bugs. Please report all
 you find to https://redmine.freeciv.org/projects/freeciv
 
 
diff --git a/doc/README b/doc/README
index a70fb8db79..37d7bba738 100644
--- a/doc/README
+++ b/doc/README
@@ -1,5 +1,5 @@
 ===================
-Freeciv Version 3.4
+Freeciv Version 4.0
 ===================
 
 Welcome to Freeciv!
diff --git a/doc/README.packaging b/doc/README.packaging
index 30d04b55d6..6433feb100 100644
--- a/doc/README.packaging
+++ b/doc/README.packaging
@@ -7,23 +7,15 @@ for their distribution, and, to some degree, those people who want to
 create Freeciv fork.
 
 ----------------------------------------------------------------------
-Updating from 3.3 to 3.4
+Updating from 3.4 to 4.0
 ------------------------
-* Client uses ~/.freeciv/freeciv-client-rc-3.4 for storing its options.
+* Client uses ~/.freeciv/freeciv-client-rc-4.0 for storing its options.
   Options are always saved to that file.
   Loading of options first tries to get options from
-  ~/.freeciv/freeciv-client-rc-3.4. If that file does not exist it tries to
+  ~/.freeciv/freeciv-client-rc-4.0. If that file does not exist it tries to
   load options from old client files generated by former version of Freeciv
-  (e.g. ~/.freeciv/freeciv-client-rc-3.3 generated by Freeciv 3.3,
-   ~/.freeciv-client-rc-3.2 generated by Freeciv 3.2).
-* Qt5 support removed
-* Minimum meson requirement for builds made with it is 0.63.0
-* Minimum Python requirement for code generation scripts is 3.7
-* Minimum Qt6 version for building Qt-client, Qt modpack installer,
-  and Ruledit is 6.4.
-* New gtk4x-client that is linked against relatively new gtk4 versions
-* Build with meson supports building gtk4x modpack installer that is linked
-  against relatively new gtk4 versions
+  (e.g. ~/.freeciv/freeciv-client-rc-3.4 generated by Freeciv 3.4,
+   ~/.freeciv-client-rc-3.3 generated by Freeciv 3.3).
 
 ----------------------------------------------------------------------
 Compatibility of modified versions
@@ -110,7 +102,7 @@ Generated files
 This is list of files Freeciv might generate to filesystem when running.
 You may want to remove some of these when Freeciv is uninstalled.
 
-* Client saves its options to file "~/.freeciv/freeciv-client-rc-3.4"
+* Client saves its options to file "~/.freeciv/freeciv-client-rc-4.0"
 * Server saves its readline history to file "~/.freeciv/freeciv-server_history"
 * When running local single player games, challenge files with name
   like "~/.freeciv/challenge_*_*" are generated
@@ -119,7 +111,7 @@ You may want to remove some of these when Freeciv is uninstalled.
 * When saving game in independently launched server, savegames go
   to directory specified with "-s" command line option, defaulting
   to working directory
-* freeciv-modpack saves data under "~/.freeciv/3.4/" and
+* freeciv-modpack saves data under "~/.freeciv/4.0/" and
   "~/.freeciv/scenarios/"
 * Server can write log to file specified with "-l" command line option
 * When mapimage feature is used, it can save colortest images to
@@ -190,4 +182,4 @@ can see complete list, while list shown by Freeciv client only lists
 compatible servers.
 
 Any a.b.c release is network compatible with any a.b.d release. If you
-provide 3.4.c client, it can be used to play on 3.4.d server.
+provide 4.0.c client, it can be used to play on 4.0.d server.
diff --git a/doc/README.rulesets b/doc/README.rulesets
index 44b13a5b62..67dbba4108 100644
--- a/doc/README.rulesets
+++ b/doc/README.rulesets
@@ -163,6 +163,8 @@ different versions of Freeciv is kept in the wiki at https://www.freeciv.org/
 The URLs below list the differences between the freeciv versions from 2.2.x
 to the current version:
 
+https://www.freeciv.org/wiki/How_to_update_a_ruleset_from_3.4_to_4.0
+
 https://www.freeciv.org/wiki/How_to_update_a_ruleset_from_3.3_to_3.4
 
 https://www.freeciv.org/wiki/How_to_update_a_ruleset_from_3.2_to_3.3
diff --git a/doc/README.tilesets b/doc/README.tilesets
index 3640b8a0c5..f213d57245 100644
--- a/doc/README.tilesets
+++ b/doc/README.tilesets
@@ -17,6 +17,8 @@ different versions of Freeciv is kept in the wiki at https://www.freeciv.org/
 The URLs below list the differences between the freeciv versions from 1.14.x
 to the current version:
 
+https://www.freeciv.org/wiki/How_to_update_a_tileset_from_3.4_to_4.0
+
 https://www.freeciv.org/wiki/How_to_update_a_tileset_from_3.3_to_3.4
 
 https://www.freeciv.org/wiki/How_to_update_a_tileset_from_3.2_to_3.3
diff --git a/fc_version b/fc_version
index 079af327aa..d757d92746 100755
--- a/fc_version
+++ b/fc_version
@@ -1,26 +1,26 @@
 #!/bin/sh
 
 #
-#  Copyright (C) 2004-2026 Freeciv team
+#  Copyright (C) 2004-2027 Freeciv team
 
 # Version definition for Freeciv.
 
 MAJOR_VERSION="3"
-MINOR_VERSION="3"
+MINOR_VERSION="90"
 PATCH_VERSION="90"
-EMERGENCY_VERSION="14"
+EMERGENCY_VERSION=""
 VERSION_LABEL="-dev"
 
 # Type is either "development" or "stable"
 # Date and NEWS URL are relevant only for "stable" releases
 if test "${VERSION_LABEL}" = "" ; then
   RELEASE_TYPE="stable"
-  #RELEASE_DATE="2025-01-17"
+  #RELEASE_DATE="2027-01-01"
   NEWS_URL="https://www.freeciv.org/wiki/NEWS-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}"
 else
   RELEASE_TYPE="development"
-  #RELEASE_DATE="2025-01-17"
-  #NEWS_URL="https://www.freeciv.org/wiki/NEWS-3.4.0"
+  #RELEASE_DATE="2027-01-01"
+  #NEWS_URL="https://www.freeciv.org/wiki/NEWS-4.0.0"
 fi
 
 #
@@ -57,14 +57,14 @@ IS_DEVEL_VERSION=1
 IS_FREEZE_VERSION=0
 IS_BETA_VERSION=0
 
-NEXT_STABLE_VERSION="3.4.0"
+NEXT_STABLE_VERSION="4.0.0"
 
 # 0 to disable display of release month until we can make better estimate
 RELEASE_MONTH=0
 
-MAIN_VERSION=3.4
+MAIN_VERSION=4.0
 DATASUBDIR=dev
-DEFAULT_FOLLOW_TAG=S3_4
+DEFAULT_FOLLOW_TAG=S4_0
 
 # Freeciv network capstring: see documentation in common/capstr.c
 #
diff --git a/meson.build b/meson.build
index 9c985e7134..3f0423a4e0 100644
--- a/meson.build
+++ b/meson.build
@@ -164,7 +164,7 @@ priv_conf_data.set('IS_DEVEL_VERSION', 1)
 priv_conf_data.set('IS_FREEZE_VERSION', 0)
 priv_conf_data.set('IS_BETA_VERSION', 0)
 priv_conf_data.set('FREECIV_RELEASE_MONTH', 0)
-priv_conf_data.set('NEXT_STABLE_VERSION', '"3.4.0"')
+priv_conf_data.set('NEXT_STABLE_VERSION', '"4.0.0"')
 
 if host_machine.endian() == 'big'
   priv_conf_data.set('WORDS_BIGENDIAN', 1)
diff --git a/platforms/windows/installer_msys2/Makefile.meson b/platforms/windows/installer_msys2/Makefile.meson
index fb458894bf..17cbaff4a2 100644
--- a/platforms/windows/installer_msys2/Makefile.meson
+++ b/platforms/windows/installer_msys2/Makefile.meson
@@ -147,7 +147,7 @@ installer-common: install-freeciv-$(GUI) install-env-$(GUI)
 install-freeciv-common: clean-install-client-arch
 	# Create build directory
 	mkdir -p $(BUILD_DIR)/$(WINARCH)-client-$(GUI)
-	cd $(BUILD_DIR)/$(WINARCH)-client-$(GUI); meson setup $(IMSYS2_DIR)/../../.. -Dprefix=$(IMSYS2_DIR)/$(INST_DIR)/$(WINARCH)-client-$(GUI) -Dfollowtag='windows-S3_4' -Dclients=$(CLIENT) -Dfcmp=$(FCMP) -Dtools=manual,ruleup -Dreadline=false -Dcacert-path='./ssl/certs/ca-bundle.crt' -Dmin-win-ver=$(MIN_WIN_VER) -Dsyslua=false $(EXTRA_CONFIG)
+	cd $(BUILD_DIR)/$(WINARCH)-client-$(GUI); meson setup $(IMSYS2_DIR)/../../.. -Dprefix=$(IMSYS2_DIR)/$(INST_DIR)/$(WINARCH)-client-$(GUI) -Dfollowtag='windows-S4_0' -Dclients=$(CLIENT) -Dfcmp=$(FCMP) -Dtools=manual,ruleup -Dreadline=false -Dcacert-path='./ssl/certs/ca-bundle.crt' -Dmin-win-ver=$(MIN_WIN_VER) -Dsyslua=false $(EXTRA_CONFIG)
 	cd $(BUILD_DIR)/$(WINARCH)-client-$(GUI); ninja
 	cd $(BUILD_DIR)/$(WINARCH)-client-$(GUI); ninja install
 	cd $(BUILD_DIR)/$(WINARCH)-client-$(GUI); ninja langstat_core.txt
@@ -164,7 +164,7 @@ install-freeciv-common: clean-install-client-arch
 install-ruledit-common: clean-ruledit-install-arch
 	# Create build directory
 	mkdir -p $(BUILD_DIR)/$(WINARCH)-ruledit-$(GUI)
-	cd $(BUILD_DIR)/$(WINARCH)-ruledit-$(GUI); meson setup $(IMSYS2_DIR)/../../.. -Dprefix=$(IMSYS2_DIR)/$(INST_DIR)/$(WINARCH)-ruledit-$(GUI) -Dfollowtag='windows-S3_4' -Dclients=[] -Dfcmp=[] -Dserver=disabled -Dtools=ruledit -Dreadline=false -Dcacert-path='./ssl/certs/ca-bundle.crt' -Dmin-win-ver=$(MIN_WIN_VER) -Dsyslua=false $(EXTRA_CONFIG)
+	cd $(BUILD_DIR)/$(WINARCH)-ruledit-$(GUI); meson setup $(IMSYS2_DIR)/../../.. -Dprefix=$(IMSYS2_DIR)/$(INST_DIR)/$(WINARCH)-ruledit-$(GUI) -Dfollowtag='windows-S4_0' -Dclients=[] -Dfcmp=[] -Dserver=disabled -Dtools=ruledit -Dreadline=false -Dcacert-path='./ssl/certs/ca-bundle.crt' -Dmin-win-ver=$(MIN_WIN_VER) -Dsyslua=false $(EXTRA_CONFIG)
 	cd $(BUILD_DIR)/$(WINARCH)-ruledit-$(GUI); ninja
 	cd $(BUILD_DIR)/$(WINARCH)-ruledit-$(GUI); ninja install
 	cd $(BUILD_DIR)/$(WINARCH)-ruledit-$(GUI); ninja langstat_core.txt langstat_ruledit.txt
diff --git a/server/savegame/savecompat.c b/server/savegame/savecompat.c
index 96a94b806f..effad8b3fd 100644
--- a/server/savegame/savecompat.c
+++ b/server/savegame/savecompat.c
@@ -72,7 +72,8 @@ static char *special_names[] =
   3.1.0   | 3.1.0 release                                  | 201./../.. | 50
   3.2.0   | 3.2.0 release                                  | 202./../.. | 60
   3.3.0   | 3.3.0 release                                  | 202./../.. | 70
-  3.4.0   | 3.4.0 release (development)                    | 202./../.. | 80
+  3.4.0   | 3.4.0 release                                  | 202./../.. | 80
+  4.0.0   | 4.0.0 release (development)                    | 203./../.. | 90
           |                                                |            |
 */
 
@@ -84,6 +85,7 @@ static void compat_load_030100(struct loaddata *loading, enum sgf_version format
 static void compat_load_030200(struct loaddata *loading, enum sgf_version format_class);
 static void compat_load_030300(struct loaddata *loading, enum sgf_version format_class);
 static void compat_load_030400(struct loaddata *loading, enum sgf_version format_class);
+static void compat_load_040000(struct loaddata *loading, enum sgf_version format_class);
 static void compat_post_load_030100(struct loaddata *loading,
                                     enum sgf_version format_class);
 static void compat_post_load_030300(struct loaddata *loading,
@@ -112,8 +114,8 @@ struct compatibility {
  * add the needed code to load the old version below. Thus, old
  * savegames can still be loaded while the main definition
  * represents the current state of the art. */
-/* While developing freeciv 3.4.0, add the compatibility functions to
- * - compat_load_030400 to load old savegame. */
+/* While developing freeciv 4.0.0, add the compatibility functions to
+ * - compat_load_040000 to load old savegame. */
 static struct compatibility compat[] = {
   /* Dummy; equal to the current version (last element) */
   { 0, nullptr, nullptr },
@@ -137,6 +139,8 @@ static struct compatibility compat[] = {
   { 70, compat_load_030300, compat_post_load_030300 },
   /* Version 71 to 79 are reserved for possible changes in 3.3.x */
   { 80, compat_load_030400, nullptr },
+  /* Version 81 to 89 are reserved for possible changes in 3.4.x */
+  { 90, compat_load_040000, nullptr },
   /* Current savefile version is listed above this line; it corresponds to
      the definitions in this file. */
 };
@@ -2689,6 +2693,21 @@ static void compat_load_030400(struct loaddata *loading,
   log_debug("Upgrading data from savegame to version 3.4.0");
 }
 
+/************************************************************************//**
+  Translate savegame secfile data from 3.4.x to 4.0.0 format.
+  Note that even after 2.6 savegame has gone through all the compatibility
+  functions, it's still 2.6 savegame in the sense that savegame2.c, and not
+  savegame3.c, handles it.
+****************************************************************************/
+static void compat_load_040000(struct loaddata *loading,
+                               enum sgf_version format_class)
+{
+  /* Check status and return if not OK (sg_success != TRUE). */
+  sg_check_ret();
+
+  log_debug("Upgrading data from savegame to version 4.0.0");
+}
+
 /************************************************************************//**
   Translate savegame secfile data from earlier development version format
   to current one.
diff --git a/translations/Strings.txt b/translations/Strings.txt
index f7c54409b1..6fb410c06e 100644
--- a/translations/Strings.txt
+++ b/translations/Strings.txt
@@ -15,16 +15,16 @@ added to gettext to get the translation.
 _("?vertag:stable")
 _("?vertag:windows")
 _("?vertag:macos")
-_("?vertag:S3_2")
 _("?vertag:S3_3")
 _("?vertag:S3_4")
+_("?vertag:S4_0")
 _("?vertag:crosser")
-_("?vertag:windows-S3_2")
 _("?vertag:windows-S3_3")
 _("?vertag:windows-S3_4")
-_("?vertag:macos-S3_2")
+_("?vertag:windows-S4_0")
 _("?vertag:macos-S3_3")
 _("?vertag:macos-S3_4")
+_("?vertag:macos-S4_0")
 
 
 Generated version header
-- 
2.53.0

