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

See RM #27

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 .../installer_cross/build_all_installers.sh   | 17 +--------
 .../installer_cross/installer_build.sh        | 33 +++--------------
 .../meson-build_all_installers.sh             | 17 +--------
 .../installer_cross/meson-installer_build.sh  | 35 +++----------------
 .../windows/installer_cross/meson-winbuild.sh |  6 +---
 platforms/windows/installer_cross/winbuild.sh | 35 +++++++------------
 6 files changed, 24 insertions(+), 119 deletions(-)

diff --git a/platforms/windows/installer_cross/build_all_installers.sh b/platforms/windows/installer_cross/build_all_installers.sh
index 173f695b93..34e1722615 100755
--- a/platforms/windows/installer_cross/build_all_installers.sh
+++ b/platforms/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/platforms/windows/installer_cross/installer_build.sh b/platforms/windows/installer_cross/installer_build.sh
index 6c0943fa5d..bab93041cd 100755
--- a/platforms/windows/installer_cross/installer_build.sh
+++ b/platforms/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/ &&
@@ -135,11 +125,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"
@@ -288,23 +273,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 ;;
@@ -324,10 +299,10 @@ else
       exit 1
     fi
   else
-    if test "$GUI" = "qt5" || test "$GUI" = "qt6" ; then
+    if test "${GUI}" = "qt6" ; then
       EXE_ID="qt"
     else
-      EXE_ID="$GUI"
+      EXE_ID="${GUI}"
     fi
     if test "$GUI" = "gtk3.22" || test "$GUI" = "gtk4" ; then
       UNINSTALLER="helpers/uninstaller-helper-gtk3.sh"
diff --git a/platforms/windows/installer_cross/meson-build_all_installers.sh b/platforms/windows/installer_cross/meson-build_all_installers.sh
index b6737163cc..efaa50d744 100755
--- a/platforms/windows/installer_cross/meson-build_all_installers.sh
+++ b/platforms/windows/installer_cross/meson-build_all_installers.sh
@@ -51,11 +51,6 @@ then
   CROSSER_QT6=yes
 fi
 
-if grep "CROSSER_QT5" "${DLLSPATH}/crosser.txt" | grep yes > /dev/null
-then
-  CROSSER_QT5=yes
-fi
-
 if ! ./meson-installer_build.sh "${DLLSPATH}" gtk3.22 ; then
   RET=1
   GTK322="Fail"
@@ -90,15 +85,6 @@ else
   QT6="Success"
 fi
 
-if test "${CROSSER_QT5}" != "yes" ; then
-  QT5="N/A"
-elif ! ./meson-installer_build.sh "${DLLSPATH}" qt5 ; then
-  RET=1
-  QT5="Fail"
-else
-  QT5="Success"
-fi
-
 # sdl2-client comes with gtk4 modpack installer
 if test "${CROSSER_GTK4}" != "yes" ; then
   SDL2="N/A"
@@ -122,8 +108,7 @@ echo "Gtk3.22: ${GTK322}"
 echo "Gtk4:    ${GTK4}"
 echo "Gtk4x:   ${GTK4x}"
 echo "Qt6:     ${QT6}"
-echo "Qt5:     ${QT5}"
 echo "Sdl2:    ${SDL2}"
 echo "Ruledit: ${RULEDIT}"
 
-exit $RET
+exit ${RET}
diff --git a/platforms/windows/installer_cross/meson-installer_build.sh b/platforms/windows/installer_cross/meson-installer_build.sh
index 6c824f492b..55129bf5e7 100755
--- a/platforms/windows/installer_cross/meson-installer_build.sh
+++ b/platforms/windows/installer_cross/meson-installer_build.sh
@@ -89,17 +89,6 @@ add_qt6_env() {
   cp ./helpers/installer-helper-qt.cmd $2/bin/installer-helper.cmd
 }
 
-add_qt5_env() {
-  add_glib_env $1 $2 &&
-  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_sdl2_env() {
   cp $1/bin/SDL2_image.dll $2/ &&
   cp $1/bin/SDL2_ttf.dll $2/
@@ -135,11 +124,6 @@ case $GUI in
     CLIENT="qt"
     MPGUI="qt"
     FCMP="qt" ;;
-  qt5)
-    GUINAME="Qt5"
-    CLIENT="qt"
-    MPGUI="qt"
-    FCMP="qt" ;;
   ruledit)
     ;;
   *)
@@ -266,33 +250,22 @@ else
       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
       ;;
-    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
-      ;;
   esac
 
-  if test "$GUI" = "qt5" || test "$GUI" = "qt6" ; then
+  if test "${GUI}" = "qt6" ; then
     EXE_ID="qt"
   else
-    EXE_ID="$GUI"
+    EXE_ID="${GUI}"
   fi
 
   if test "$GUI" = "gtk3.22" || test "$GUI" = "gtk4" ||
diff --git a/platforms/windows/installer_cross/meson-winbuild.sh b/platforms/windows/installer_cross/meson-winbuild.sh
index 0d31afa5e2..a03fcc89d9 100755
--- a/platforms/windows/installer_cross/meson-winbuild.sh
+++ b/platforms/windows/installer_cross/meson-winbuild.sh
@@ -26,7 +26,7 @@ GUI="$2"
 if test "${GUI}" != "gtk3.22" && test "${GUI}" != "gtk4" &&
    test "${GUI}" != "gtk4x" &&
    test "${GUI}" != "sdl2" &&
-   test "${GUI}" != "qt5" && test "${GUI}" != "qt6" &&
+   test "${GUI}" != "qt6" &&
    test "${GUI}" != "ruledit" ; then
   echo "Unknown gui \"$2\"" >&2
   exit 1
@@ -82,10 +82,6 @@ case "${GUI}" in
   gtk4) FCMP="gtk4" ;;
   gtk4x) FCMP="gtk4x" ;;
   sdl2) FCMP="gtk4" ;;
-  qt5) CLIENT="qt"
-       FCMP="qt"
-       TOOLS="${TOOLS},ruledit"
-       QTPARAMS="-Dqtver=qt5" ;;
   qt6) CLIENT="qt"
        FCMP="qt"
        TOOLS="${TOOLS},ruledit"
diff --git a/platforms/windows/installer_cross/winbuild.sh b/platforms/windows/installer_cross/winbuild.sh
index 0cb16423d4..8911c7d329 100755
--- a/platforms/windows/installer_cross/winbuild.sh
+++ b/platforms/windows/installer_cross/winbuild.sh
@@ -60,7 +60,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"
 
@@ -76,7 +76,7 @@ elif test "$2" != "" ; then
   SINGLE_GUI=true
   GUIP="-client-$2"
   SERVER="yes"
-  if test "$2" = "qt5" || test "$2" = "qt6" ; then
+  if test "$2" = "qt6" ; then
     RULEDIT="yes"
     CLIENTS="qt"
   else
@@ -87,8 +87,6 @@ elif test "$2" != "" ; 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
@@ -140,42 +138,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 "$QTVER" = "Qt5" ; then
-  QTPARAMS="--with-qtver=Qt5 --with-qt5-includes=${DLLSPATH}/qt5/include --with-qt5-libs=${DLLSPATH}/lib"
-  MOC_CROSSER="${DLLSPATH}/bin/moc"
-elif test "$QTVER" = "Qt6"; then
+if test "${QTVER}" = "Qt6"; 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

