File 0001-Add-qmake-only-and-system-qmake-configure-option.patch of Package mingw64-libqt4

From 5b8f5a885218bf6662330dd555e8385748e8118e Mon Sep 17 00:00:00 2001
From: Ralf Habacker <ralf.habacker@freenet.de>
Date: Fri, 7 Feb 2020 19:53:31 +0100
Subject: [PATCH 1/2] Add -qmake-only and -system-qmake configure option

---
 configure    | 54 ++++++++++++++++++++++++++++++++++++++++++++----------
 projects.pro | 14 ++++++++------
 2 files changed, 52 insertions(+), 16 deletions(-)

diff --git a/configure b/configure
index a42ed6d243..8a948481ba 100755
--- a/configure
+++ b/configure
@@ -779,7 +779,7 @@ CFG_FONTCONFIG=auto
 CFG_QWS_FREETYPE=auto
 CFG_LIBFREETYPE=auto
 CFG_SQL_AVAILABLE=
-QT_DEFAULT_BUILD_PARTS="libs tools examples demos docs translations"
+QT_DEFAULT_BUILD_PARTS="qmake libs tools examples demos docs translations"
 CFG_BUILD_PARTS=""
 CFG_NOBUILD_PARTS=""
 CFG_RELEASE_QMAKE=no
@@ -1112,6 +1112,10 @@ while [ "$#" -gt 0 ]; do
         VAR=`echo $1 | sed "s,^--\(.*\),\1,"`
         VAL=yes
         ;;
+    -system-qmake)
+        VAR=system-qmake
+        VAL=yes
+        ;;
     -system-proxies)
         VAR=system-proxies
         VAL=yes
@@ -1144,7 +1148,7 @@ while [ "$#" -gt 0 ]; do
         VAL=no
         ;;
     #Qt style yes options
-    -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-harfbuzz|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-declarative|-declarative-debug|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-s60|-usedeffiles|-icu)
+    -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-harfbuzz|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-declarative|-declarative-debug|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-s60|-usedeffiles|-icu|-qmake-only|-system-qmake)
         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
         VAL=yes
         ;;
@@ -2519,6 +2523,13 @@ while [ "$#" -gt 0 ]; do
             UNKNOWN_OPT=yes
         fi
         ;;
+    system-qmake)
+        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
+            CFG_SYSTEM_QMAKE="$VAL"
+        else
+            UNKNOWN_OPT=yes
+        fi
+        ;;
     system-proxies)
         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
             CFG_SYSTEM_PROXIES="$VAL"
@@ -2526,6 +2537,13 @@ while [ "$#" -gt 0 ]; do
             UNKNOWN_OPT=yes
         fi
         ;;
+    qmake-only)
+        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
+            CFG_QMAKE_ONLY="$VAL"
+        else
+            UNKNOWN_OPT=yes
+        fi
+        ;;
     *)
         UNKNOWN_OPT=yes
         ;;
@@ -3856,7 +3874,7 @@ Usage:  $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir
         [-no-separate-debug-info] [-no-mmx] [-no-3dnow] [-no-sse] [-no-sse2]
         [-no-sse3] [-no-ssse3] [-no-sse4.1] [-no-sse4.2] [-no-avx] [-no-neon]
         [-qtnamespace <namespace>] [-qtlibinfix <infix>] [-separate-debug-info] [-armfpa]
-        [-no-optimized-qmake] [-optimized-qmake] [-no-xmlpatterns] [-xmlpatterns]
+        [-no-optimized-qmake] [-optimized-qmake] [-system-qmake] [-qmake-only] [-no-xmlpatterns] [-xmlpatterns]
         [-no-multimedia] [-multimedia] [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend]
         [-no-media-backend] [-media-backend] [-no-audio-backend] [-audio-backend] 
         [-no-openssl] [-openssl] [-openssl-linked]
@@ -4136,6 +4154,10 @@ Additional options:
     -silent ............ Reduce the build output so that warnings and errors
                          can be seen more easily.
 
+    -system-qmake ...... Use system qmake
+
+    -qmake-only ........ Only build qmake
+
  *  -no-optimized-qmake ... Do not build qmake optimized.
     -optimized-qmake ...... Build qmake optimized.
 
@@ -4918,8 +4940,17 @@ setBootstrapVariable()
     getQMakeConf "$1" | echo ${2-$1} = `if [ -n "$3" ]; then sed "$3"; else cat; fi` >> "$mkfile"
 }
 
+if [ "$CFG_SYSTEM_QMAKE" = "yes" ]; then
+    if test -z "$QMAKE"; then export QMAKE="/usr/bin/qmake"; fi
+    mkdir -p $outpath/bin
+    ln -s $QMAKE $outpath/bin/qmake
+    CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed 's,qmake,,g'`
+else
+    export QMAKE="$outpath/bin/qmake"
+fi
+
 # build qmake
-if  [ ! -f "$outpath/bin/qmake" ]; then
+if [ "$CFG_SYSTEM_QMAKE" != "yes" ] && [ ! -f "$QMAKE" ]; then
     echo "Creating qmake. Please wait..."
 
     OLD_QCONFIG_H=
@@ -5100,7 +5135,7 @@ if [ -z "$PKG_CONFIG" ]; then
     (echo TEMPLATE = subdirs
      echo 'message($$PKG_CONFIG)') > "$outpath/dummy.pro"
     echo "QT_BUILD_TREE = $outpath" > "$outpath/.qmake.cache.pkgconfig"
-    PKG_CONFIG=`"$outpath/bin/qmake" -cache "$outpath/.qmake.cache.pkgconfig" -spec "$XQMAKESPEC" "$outpath/dummy.pro" -o /dev/null 2>&1 > /dev/null | sed -n -e 's,Project MESSAGE: \(.*\),\1,p'`
+    PKG_CONFIG=`"$QMAKE" -cache "$outpath/.qmake.cache.pkgconfig" -spec "$XQMAKESPEC" "$outpath/dummy.pro" -o /dev/null 2>&1 > /dev/null | sed -n -e 's,Project MESSAGE: \(.*\),\1,p'`
     rm "$outpath/.qmake.cache.pkgconfig" "$outpath/dummy.pro"
 fi
 if [ -z "$PKG_CONFIG" ]; then
@@ -5352,7 +5387,7 @@ if [ "$XPLATFORM_INTEGRITY" = "yes" ]; then
     if [ "$CFG_SCRIPT" != "yes" ]; then
       CFG_SCRIPT="no"
     fi
-    CFG_BUILD_PARTS="libs examples demos"
+    CFG_BUILD_PARTS="qmake libs examples demos"
     CFG_GIF="no"
 fi
 
@@ -8751,6 +8751,11 @@
     mv -f "$QTCONFIG.tmp" "$QTCONFIG"
 fi
 
+# qconfig.pri was written, we can exit now
+if [ "$CFG_QMAKE_ONLY" = "yes" ]; then
+    exit 0
+fi
+
 #-------------------------------------------------------------------------------
 # save configuration into .qmake.cache
 #-------------------------------------------------------------------------------
@@ -9175,11 +9210,11 @@ EXEC=""
 
 echo "Finding project files. Please wait..."
 if [ "$CFG_NOPROCESS" != "yes" ]; then
-    "$outpath/bin/qmake" -prl -r "${relpath}/projects.pro"
+    "$QMAKE" -prl -r "${relpath}/projects.pro"
     if [ -f "${relpath}/projects.pro" ]; then
         mkfile="${outpath}/Makefile"
         [ -f "$mkfile" ] && chmod +w "$mkfile"
-        QTDIR="$outpath" "$outpath/bin/qmake" -spec "$XQMAKESPEC" "${relpath}/projects.pro" -o "$mkfile"
+        QTDIR="$outpath" "$QMAKE" -spec "$XQMAKESPEC" "${relpath}/projects.pro" -o "$mkfile"
     fi
 fi
 
@@ -9366,8 +9401,7 @@ for file in .projects .projects.3; do
         QMAKE_SPEC_ARGS="-spec $SPEC"
         echo $ECHO_N "  for $a$ECHO_C"
 
-        QMAKE="$outpath/bin/qmake"
-	QMAKE_ARGS="$QMAKE_SWITCHES $QMAKE_SPEC_ARGS"
+        QMAKE_ARGS="$QMAKE_SWITCHES $QMAKE_SPEC_ARGS"
         if [ "$file" = ".projects.3" ]; then
             echo " (fast)"
 
diff --git a/projects.pro b/projects.pro
index a2bc4b3be1..5902370445 100644
--- a/projects.pro
+++ b/projects.pro
@@ -140,13 +140,15 @@ CONFIG -= qt
 ### installations ####
 
 #qmake
-qmake.path=$$[QT_INSTALL_BINS]
-equals(QMAKE_HOST.os, Windows) {
-   qmake.files=$$QT_BUILD_TREE/bin/qmake.exe
-} else {
-   qmake.files=$$QT_BUILD_TREE/bin/qmake
+contains(QT_BUILD_PARTS, qmake) {
+    qmake.path=$$[QT_INSTALL_BINS]
+    equals(QMAKE_HOST.os, Windows) {
+        qmake.files=$$QT_BUILD_TREE/bin/qmake.exe
+    } else {
+        qmake.files=$$QT_BUILD_TREE/bin/qmake
+    }
+    INSTALLS += qmake
 }
-INSTALLS += qmake
 
 #mkspecs
 mkspecs.path=$$[QT_INSTALL_DATA]/mkspecs
-- 
2.16.4

openSUSE Build Service is sponsored by