From f3ccdaa381a26aba2d8657b8c728eee4498be777 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Tue, 5 Dec 2023 06:24:30 +0200
Subject: [PATCH 16/16] installer_cross: Drop Qt5 support

See RM #27

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 .../installer_cross/build_all_installers.sh   | 17 +--------
 windows/installer_cross/installer_build.sh    | 31 ++--------------
 windows/installer_cross/meson-winbuild.sh     | 12 +++----
 windows/installer_cross/winbuild.sh           | 35 +++++++------------
 4 files changed, 21 insertions(+), 74 deletions(-)

diff --git a/windows/installer_cross/build_all_installers.sh b/windows/installer_cross/build_all_installers.sh
index 173f695b93..34e1722615 100755
--- a/windows/installer_cross/build_all_installers.sh
+++ b/windows/installer_cross/build_all_installers.sh
@@ -41,11 +41,6 @@ fi
 
 RET=0
 
-if grep "CROSSER_QT5" "${DLLSPATH}/crosser.txt" | grep yes > /dev/null
-then
-  CROSSER_QT5=yes
-fi
-
 if grep "CROSSER_QT6" "${DLLSPATH}/crosser.txt" | grep yes > /dev/null
 then
   CROSSER_QT6=yes
@@ -63,15 +58,6 @@ else
   GTK322="Success"
 fi
 
-if test "${CROSSER_QT5}" != "yes" ; then
-  QT5="N/A"
-elif ! ./installer_build.sh "${DLLSPATH}" qt5 ; then
-  RET=1
-  QT5="Fail"
-else
-  QT5="Success"
-fi
-
 if test "${CROSSER_QT6}" != "yes" ; then
   QT6="N/A"
 elif ! ./installer_build.sh "${DLLSPATH}" qt6 ; then
@@ -111,9 +97,8 @@ fi
 
 echo "Gtk3.22: ${GTK322}"
 echo "Gtk4:    ${GTK4}"
-echo "Qt5:     ${QT5}"
 echo "Qt6:     ${QT6}"
 echo "Sdl2:    ${SDL2}"
 echo "Ruledit: ${RULEDIT}"
 
-exit $RET
+exit ${RET}
diff --git a/windows/installer_cross/installer_build.sh b/windows/installer_cross/installer_build.sh
index c5472e5e04..9294a0f947 100755
--- a/windows/installer_cross/installer_build.sh
+++ b/windows/installer_cross/installer_build.sh
@@ -85,16 +85,6 @@ add_sdl2_env() {
   cp $1/bin/SDL2_ttf.dll $2/
 }
 
-add_qt5_env() {
-  cp -R $1/qt5/plugins $2/ &&
-  cp $1/bin/Qt5Core.dll $2/ &&
-  cp $1/bin/Qt5Gui.dll $2/ &&
-  cp $1/bin/Qt5Widgets.dll $2/ &&
-  cp $1/bin/libpcre2-16-0.dll $2/ &&
-  mkdir -p $2/bin &&
-  cp ./helpers/installer-helper-qt.cmd $2/bin/installer-helper.cmd
-}
-
 add_qt6_env() {
   cp -R $1/qt6/plugins $2/ &&
   cp $1/bin/Qt6Core.dll $2/ &&
@@ -134,11 +124,6 @@ case $GUI in
     GUINAME="GTK3.22"
     MPGUI="gtk3"
     FCMP="gtk3" ;;
-  qt5)
-    GUINAME="Qt5"
-    CLIENT="qt"
-    MPGUI="qt"
-    FCMP="qt" ;;
   qt6)
     GUINAME="Qt6"
     CLIENT="qt"
@@ -277,23 +262,13 @@ else
         echo "Copying SDL2 environment failed!" >&2
         exit 1
       fi ;;
-    qt5)
-      if ! cp freeciv-ruledit.cmd $INSTDIR/
-      then
-        echo "Adding cmd-file failed!" >&2
-        exit 1
-      fi
-      if ! add_qt5_env $DLLSPATH $INSTDIR ; then
-        echo "Copying Qt5 environment failed!" >&2
-        exit 1
-      fi ;;
     qt6)
-      if ! cp freeciv-ruledit.cmd $INSTDIR/
+      if ! cp freeciv-ruledit.cmd "${INSTDIR}/"
       then
         echo "Adding cmd-file failed!" >&2
         exit 1
       fi
-      if ! add_qt6_env $DLLSPATH $INSTDIR ; then
+      if ! add_qt6_env "${DLLSPATH}" "${INSTDIR}" ; then
         echo "Copying Qt6 environment failed!" >&2
         exit 1
       fi ;;
@@ -311,7 +286,7 @@ else
       exit 1
     fi
   else
-    if test "x$GUI" = "xqt5" || test "x$GUI" = "xqt6" ; then
+    if test "x$GUI" = "xqt6" ; then
       EXE_ID="qt"
     else
       EXE_ID="$GUI"
diff --git a/windows/installer_cross/meson-winbuild.sh b/windows/installer_cross/meson-winbuild.sh
index 1a09081339..5790568f92 100755
--- a/windows/installer_cross/meson-winbuild.sh
+++ b/windows/installer_cross/meson-winbuild.sh
@@ -23,10 +23,10 @@ fi
 
 GUI="$2"
 
-if test "$GUI" != "gtk3.22" && test "$GUI" != "gtk4" &&
-   test "$GUI" != "sdl2" &&
-   test "$GUI" != "qt5" && test "$GUI" != "qt6" &&
-   test "$GUI" != "ruledit" ; then
+if test "${GUI}" != "gtk3.22" && test "${GUI}" != "gtk4" &&
+   test "${GUI}" != "sdl2" &&
+   test "${GUI}" != "qt6" &&
+   test "${GUI}" != "ruledit" ; then
   echo "Unknown gui \"$2\"" >&2
   exit 1
 fi
@@ -80,10 +80,6 @@ case $GUI in
         RULEDIT=false ;;
   sdl2) FCMP="gtk4"
         RULEDIT=false ;;
-  qt5) CLIENT="qt"
-       FCMP="qt"
-       RULEDIT=true
-       QTPARAMS="-Dqtver=qt5" ;;
   qt6) CLIENT="qt"
        FCMP="qt"
        RULEDIT=true
diff --git a/windows/installer_cross/winbuild.sh b/windows/installer_cross/winbuild.sh
index 8b408e3ff7..74d75e734b 100755
--- a/windows/installer_cross/winbuild.sh
+++ b/windows/installer_cross/winbuild.sh
@@ -58,7 +58,7 @@ fi
 
 SETUP=$(grep "CrosserSetup=" $DLLSPATH/crosser.txt | sed -e 's/CrosserSetup="//' -e 's/"//')
 
-# Make this Qt5/Qt6 or Qt-client/Ruledit specific as upstream updates
+# Make this Qt-client/Ruledit specific as upstream updates
 # to Qt headers allow. Currently needed in all cases.
 CXXFLAGS="-Wno-error=attributes"
 
@@ -74,7 +74,7 @@ elif test "x$2" != "x" ; then
   SINGLE_GUI=true
   GUIP="-$2"
   SERVER="yes"
-  if test "x$2" = "xqt5" || test "x$2" = "xqt6" ; then
+  if test "x$2" = "xqt6" ; then
     RULEDIT="yes"
     CLIENTS="qt"
   else
@@ -86,8 +86,6 @@ elif test "x$2" != "x" ; then
     sdl2) FCMP="gtk4" ;;
     gtk3.22) FCMP="gtk3" ;;
     gtk4) FCMP="gtk4" ;;
-    qt5) FCMP="qt"
-         QTVER="Qt5" ;;
     qt6) FCMP="qt"
          QTVER="Qt6"
          MIN_WINVER="0x0A00" ;; # Qt6 requires Win10 anyway
@@ -139,42 +137,35 @@ else
   exit 1
 fi
 
-if test "$SINGLE_GUI" != "true" || test "$2" = "ruledit" ; then
-  if grep "CROSSER_QT6" $DLLSPATH/crosser.txt | grep yes > /dev/null
+if test "${SINGLE_GUI}" != "true" || test "$2" = "ruledit" ; then
+  if grep "CROSSER_QT6" "${DLLSPATH}/crosser.txt" | grep yes > /dev/null
   then
     QT6="yes"
     QTVER="Qt6"
-    if test "$SINGLE_GUI" = "true" ; then
+    if test "${SINGLE_GUI}" = "true" ; then
       # Build is ONLY about Qt6 programs
       MIN_WINVER="0x0A00" # Qt6 requires Win10 anyway
     fi
-  elif grep "CROSSER_QT5" $DLLSPATH/crosser.txt | grep yes > /dev/null
-  then
-    QT5="yes"
-    QTVER="Qt5"
   fi
 fi
 
-if test "$SINGLE_GUI" != "true" ; then
-  if test "$QT5" = "yes" || test "$QT6" = "yes"
+if test "${SINGLE_GUI}" != "true" ; then
+  if test "${QT6}" = "yes"
   then
-    CLIENTS="$CLIENTS,qt"
-    FCMP="$FCMP,qt"
+    CLIENTS="${CLIENTS},qt"
+    FCMP="${FCMP},qt"
   fi
 fi
 
-if test "x$QTVER" = "xQt5" ; then
-  QTPARAMS="--with-qtver=Qt5 --with-qt5-includes=${DLLSPATH}/qt5/include --with-qt5-libs=${DLLSPATH}/lib"
-  MOC_CROSSER="${DLLSPATH}/bin/moc"
-elif test "x$QTVER" = "xQt6"; then
+if test "x$QTVER" = "xQt6"; then
   QTPARAMS="--with-qtver=Qt6 --with-qt6-includes=${DLLSPATH}/qt6/include --with-qt6-libs=${DLLSPATH}/lib"
   MOC_CROSSER="${DLLSPATH}/linux/libexec/moc-qt6"
 fi
 
 echo "----------------------------------"
-echo "Building for $SETUP"
-echo "Freeciv version $VERREV"
-echo "Clients: $CLIENTS"
+echo "Building for ${SETUP}"
+echo "Freeciv version ${VERREV}"
+echo "Clients: ${CLIENTS}"
 echo "----------------------------------"
 
 export CC="$TARGET-gcc -static-libgcc -static-libstdc++"
-- 
2.42.0

