From 5d3a14133c7516c419ac173e3ffc3404fd7960af Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Tue, 25 Aug 2026 02:54:37 +0300
Subject: [PATCH 57/57] meson-installer_build.sh: Add support for building
 sdl3-installer

Building sdl3-installer requires not-yet-released crosser-2.12,
but existing guis continue to build with crosser-2.11.

See RM #2141

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 .../installer_cross/meson-installer_build.sh  | 44 ++++++++++++++++---
 1 file changed, 38 insertions(+), 6 deletions(-)

diff --git a/platforms/windows/installer_cross/meson-installer_build.sh b/platforms/windows/installer_cross/meson-installer_build.sh
index f35e361ffa..55ef087657 100755
--- a/platforms/windows/installer_cross/meson-installer_build.sh
+++ b/platforms/windows/installer_cross/meson-installer_build.sh
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 #/***********************************************************************
-# Freeciv - Copyright (C) 2017-2023
+# Freeciv - Copyright (C) 2017-2026
 #   This program is free software; you can redistribute it and/or modify
 #   it under the terms of the GNU General Public License as published by
 #   the Free Software Foundation; either version 2, or (at your option)
@@ -43,6 +43,11 @@ add_sdl2_mixer_env() {
   cp $1/bin/libogg-0.dll $2/
 }
 
+add_sdl3_mixer_env() {
+  cp $1/bin/SDL3.dll $2/ &&
+  cp $1/bin/SDL3_mixer.dll $2/
+}
+
 add_gtk_common_env() {
   cp $1/bin/libcairo-2.dll $2/ &&
   cp $1/bin/libcairo-gobject-2.dll $2/ &&
@@ -117,6 +122,11 @@ add_sdl2_env() {
   cp $1/bin/SDL2_ttf.dll $2/
 }
 
+add_sdl3_env() {
+  cp $1/bin/SDL3_image.dll $2/ &&
+  cp $1/bin/SDL3_ttf.dll $2/
+}
+
 if test "$1" = "" || test "$1" = "-h" || test "$1" = "--help" ||
    test "$2" = "" ; then
   echo "Usage: $0 <crosser dir> <gui>"
@@ -142,6 +152,9 @@ case "${GUI}" in
   sdl2)
     GUINAME="SDL2"
     FCMP="gtk4" ;;
+  sdl3)
+    GUINAME="SDL3"
+    FCMP="gtk4" ;;
   qt6)
     GUINAME="Qt6"
     CLIENT="qt"
@@ -253,9 +266,16 @@ else
     exit 1
   fi
 
-  if ! add_sdl2_mixer_env "${DLLSPATH}" "${INSTDIR}" ; then
-    echo "Copying SDL2_mixer environment failed!" >&2
-    exit 1
+  if test "${GUI}" = "sdl3" ; then
+    if ! add_sdl3_mixer_env "${DLLSPATH}" "${INSTDIR}" ; then
+      echo "Copying SDL3_mixer environment failed!" >&2
+      exit 1
+    fi
+  else
+    if ! add_sdl2_mixer_env "${DLLSPATH}" "${INSTDIR}" ; then
+      echo "Copying SDL2_mixer environment failed!" >&2
+      exit 1
+    fi
   fi
 
   case "${GUI}" in
@@ -282,6 +302,17 @@ else
         exit 1
       fi
       ;;
+    sdl3)
+      # For gtk4 modpack installer
+      if ! add_gtk4_env "${DLLSPATH}" "${INSTDIR}" ; then
+        echo "Copying gtk4 environment failed!" >&2
+        exit 1
+      fi
+      if ! add_sdl3_env "${DLLSPATH}" "${INSTDIR}" ; then
+        echo "Copying sdl3 environment failed!" >&2
+        exit 1
+      fi
+      ;;
     qt6|qt6x)
       if ! cp "${SRC_DIR}/freeciv-ruledit.cmd" "${INSTDIR}"
       then
@@ -306,7 +337,8 @@ else
   fi
 
   if test "$GUI" = "gtk3.22" || test "$GUI" = "gtk4" ||
-     test "$GUI" = "gtk4x" || test "$GUI" = "sdl2" ; then
+     test "$GUI" = "gtk4x" || test "$GUI" = "sdl2" ||
+     test "$GUI" = "sdl3" ; then
     UNINSTALLER="${SRC_DIR}/helpers/uninstaller-helper-gtk3.sh"
   else
     UNINSTALLER=""
@@ -314,7 +346,7 @@ else
 
   NSI_FILE="${NSI_DIR}/client-${SETUP}-${VERREV}-${GUI}.nsi"
 
-  if test "${GUI}" = "sdl2" ; then
+  if test "${GUI}" = "sdl2" || test "${GUI}" = "sdl3" ; then
     if ! "${SRC_DIR}/create-freeciv-sdl-nsi.sh" \
            "${INSTDIR}" "${BUILD_ROOT}/meson/output" "${VERREV}" "${SETUP}" \
            "${GUI}" "${GUINAME}" "${UNINSTALLER}" \
-- 
2.53.0

