From 4261b9f9e8197eb7f30cd16967f841c0e17956ae Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Tue, 25 Aug 2026 02:57:53 +0300
Subject: [PATCH 25/25] 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  | 43 ++++++++++++++++---
 1 file changed, 37 insertions(+), 6 deletions(-)

diff --git a/windows/installer_cross/meson-installer_build.sh b/windows/installer_cross/meson-installer_build.sh
index 2f0c302833..9867abc60b 100755
--- a/windows/installer_cross/meson-installer_build.sh
+++ b/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>"
@@ -138,6 +148,9 @@ case $GUI in
   sdl2)
     GUINAME="SDL2"
     FCMP="gtk4" ;;
+  sdl3)
+    GUINAME="SDL3"
+    FCMP="gtk4" ;;
   qt6)
     GUINAME="Qt6"
     CLIENT="qt"
@@ -237,9 +250,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
@@ -266,6 +286,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)
       if ! cp freeciv-ruledit.cmd "${INSTDIR}"
       then
@@ -290,7 +321,7 @@ else
   fi
 
   if test "$GUI" = "gtk3.22" || test "$GUI" = "gtk4" ||
-     test "$GUI" = "sdl2" ; then
+     test "$GUI" = "sdl2" || test "$GUI" = "sdl3" ; then
     UNINSTALLER="helpers/uninstaller-helper-gtk3.sh"
   else
     UNINSTALLER=""
@@ -298,7 +329,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 ! ./create-freeciv-sdl-nsi.sh \
            "$INSTDIR" "meson/output" "$VERREV" "$SETUP" \
            "${GUI}" "${GUINAME}" "$UNINSTALLER" \
-- 
2.53.0

