From 295531f1ea6957cad3acc469791844290a57e344 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sat, 16 Aug 2025 12:49:42 +0300
Subject: [PATCH 22/22] Msys2: Add sdl3-client installer

See RM #1596

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 doc/README.msys2                              |  7 +++++-
 .../windows/installer_msys2/Makefile.meson    | 25 +++++++++++++++++--
 2 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/doc/README.msys2 b/doc/README.msys2
index 9bf4fdaf34..dcbf72872b 100644
--- a/doc/README.msys2
+++ b/doc/README.msys2
@@ -22,7 +22,7 @@ located here on top for quick reference for the specific freeciv revision.
 
 - With premade environment, buildable clients are:
   For "win64":    gtk3.22, gtk4, sdl2, Qt5
-  For "win64-10": gtk3.22, gtk4, gtk4x, sdl2, Qt6, Qt6x
+  For "win64-10": gtk3.22, gtk4, gtk4x, sdl2, sdl3, Qt6, Qt6x
 
 
  Setup
@@ -111,6 +111,10 @@ located here on top for quick reference for the specific freeciv revision.
  - mingw-w64-<arch>-SDL2_ttf
  - mingw-w64-<arch>-SDL2_gfx
 
+2.1.2.6) Arch-specific packages for building sdl3-client
+ - mingw-w64-<arch>-sdl3-image
+ - mingw-w64-<arch>-sdl3-ttf
+
 2.2) Packages needed for building installer package
  These are needed in addition to above ones used in the
  building step already.
@@ -211,6 +215,7 @@ Get the freeciv sources there somehow. Some options are:
      - gtk4
      - gtk4x
      - sdl2
+     - sdl3
      - qt5
      - qt6
      - qt6x
diff --git a/platforms/windows/installer_msys2/Makefile.meson b/platforms/windows/installer_msys2/Makefile.meson
index 83f2a37a82..f11d0f5375 100644
--- a/platforms/windows/installer_msys2/Makefile.meson
+++ b/platforms/windows/installer_msys2/Makefile.meson
@@ -76,9 +76,9 @@ all: all-$(WINARCH)
 
 all-win64: gtk3.22-installer sdl2-installer qt5-installer ruledit-installer-qt5
 
-all-win64-10: gtk3.22-installer sdl2-installer gtk4-installer qt6-installer ruledit-installer-qt6 qt6x-installer gtk4x-installer
+all-win64-10: gtk3.22-installer sdl2-installer sdl3-installer gtk4-installer qt6-installer ruledit-installer-qt6 qt6x-installer gtk4x-installer
 
-all-win64+: gtk3.22-installer sdl2-installer gtk4-installer qt6-installer ruledit-installer-qt6 qt6x-installer gtk4x-installer
+all-win64+: gtk3.22-installer sdl2-installer sdl3-installer gtk4-installer qt6-installer ruledit-installer-qt6 qt6x-installer gtk4x-installer
 
 release:
 	make -f $(MAKEFILE_NAME) EXTRA_CONFIG="-Dbuildtype=release -Doptimization=3 $(EXTRA_CONFIG)" all
@@ -105,6 +105,9 @@ sdl2-installer:
 qt5-installer:
 	make -f $(MAKEFILE_NAME) EXTRA_CONFIG="-Dqtver=qt5 $(EXTRA_CONFIG)" GUI=qt5 CLIENT=qt FCMP=qt installer-common
 
+sdl3-installer:
+	make -f $(MAKEFILE_NAME) EXTRA_CONFIG="-Daudio=none $(EXTRA_CONFIG)" GUI=sdl3 CLIENT=sdl3 FCMP=gtk4 installer-common
+
 qt6-installer:
 	make -f $(MAKEFILE_NAME) EXTRA_CONFIG="-Ddebug=false -Dqtver=qt6 -Dsvgflags=true $(EXTRA_CONFIG)" GUI=qt6 CLIENT=qt FCMP=qt installer-common
 
@@ -135,6 +138,9 @@ sdl2-install:
 qt5-install:
 	make -f $(MAKEFILE_NAME) GUI=qt5 CLIENT=qt FCMP=qt EXTRA_CONFIG="-Dqtver=qt5 $(EXTRA_CONFIG)" install-freeciv-qt5
 
+sdl3-install:
+	make -f $(MAKEFILE_NAME) GUI=sdl3 CLIENT=sdl3 FCMP=gtk4 install-freeciv-sdl3
+
 qt6-install:
 	make -f $(MAKEFILE_NAME) GUI=qt6 CLIENT=qt FCMP=qt EXTRA_CONFIG="-Dqtver=qt6 -Dsvgflags=true $(EXTRA_CONFIG)" install-freeciv-qt6
 
@@ -206,6 +212,9 @@ SOUND_DLLS_SDL2 := \
 	libwavpack-1.dll \
 	libxmp.dll
 
+SOUND_DLLS_SDL3 := \
+	SDL3.dll
+
 COMMON_DLLS := \
 	libcairo-2.dll \
 	libgdk_pixbuf-2.0-0.dll \
@@ -342,6 +351,8 @@ install-freeciv-sdl2: install-freeciv-common
 
 install-freeciv-qt5: install-freeciv-common
 
+install-freeciv-sdl3: install-freeciv-common
+
 install-freeciv-qt6: install-freeciv-common
 
 install-freeciv-qt6x: install-freeciv-common
@@ -371,11 +382,20 @@ SDL2_DLLS := \
 	libSvtAv1Enc-3.dll \
 	libyuv.dll
 
+SDL3_DLLS := \
+	SDL3_ttf.dll \
+	SDL3_image.dll
+
 install-env-sdl2: install-env-gtk4-fcmp
 	# Add DLLs
 	cp -R $(addprefix $(DLLPATH_PREFIX), $(SDL2_DLLS)) $(INST_DIR)/$(WINARCH)-client-$(GUI)/
 	cp -R $(addprefix $(DLLPATH_PREFIX), $(SOUND_DLLS_SDL2)) $(INST_DIR)/$(WINARCH)-client-$(GUI)/
 
+install-env-sdl3: install-env-gtk4-fcmp
+	# Add DLLs
+	cp -R $(addprefix $(DLLPATH_PREFIX), $(SDL3_DLLS)) $(INST_DIR)/$(WINARCH)-client-$(GUI)/
+	cp -R $(addprefix $(DLLPATH_PREFIX), $(SOUND_DLLS_SDL3)) $(INST_DIR)/$(WINARCH)-client-$(GUI)/
+
 FCMP_QT5_DLLS := \
 	Qt5Core.dll \
 	Qt5Gui.dll \
@@ -508,6 +528,7 @@ clean:
 	make -f $(MAKEFILE_NAME) GUI=gtk4 clean-build-client clean-install-client clean-installer-common
 	make -f $(MAKEFILE_NAME) GUI=gtk4x clean-build-client clean-install-client clean-installer-common
 	make -f $(MAKEFILE_NAME) GUI=sdl2 clean-build-client clean-install-client clean-installer-common
+	make -f $(MAKEFILE_NAME) GUI=sdl3 clean-build-client clean-install-client clean-installer-common
 	make -f $(MAKEFILE_NAME) GUI=qt5 clean-build-client clean-install-client clean-installer-common
 	make -f $(MAKEFILE_NAME) GUI=qt6 clean-build-client clean-install-client clean-installer-common
 	make -f $(MAKEFILE_NAME) GUI=qt6x clean-build-client clean-install-client clean-installer-common
-- 
2.50.1

