From e7115f55a8d7d621da46654030a72ca7ae144b56 Mon Sep 17 00:00:00 2001
From: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Date: Tue, 19 Mar 2013 21:30:13 +0100
Subject: [PATCH] make use of <module>_BUILD_PARTS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

this avoids the nasty hack of running qmake in a submodule before its
dependencies have been built.

Change-Id: I75d2bdab7682e07bce2ef1a4807fb28672d8c4cf
Reviewed-by: Simo Fält <simo.falt@digia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
---
 scripts/qt/qtmod_test.pl | 40 ++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)

diff --git a/scripts/qt/qtmod_test.pl b/scripts/qt/qtmod_test.pl
index d2353213..f087b6f2 100755
--- a/scripts/qt/qtmod_test.pl
+++ b/scripts/qt/qtmod_test.pl
@@ -965,39 +965,29 @@ sub run_compile
     my @make_args = split(/ /, $make_args);
     my @commands;
 
+    my @qmake_args;
+    if ($qt_minimal_deps) {
+        # Qt 5 only:
+        # minimal deps mode?  Then we turned off some build parts in configure, and must
+        # now explicitly enable them for this module only.
+        push @qmake_args, uc($qt_gitmodule)."_BUILD_PARTS = ".join(" ", @OPTIONAL_BUILD_PARTS);
+    }
+
     if (($self->{'qt.gitmodule'} eq 'qt5') or ($self->{'qt.gitmodule'} eq 'qt')) {
         # Building qt5 or qt4; just do a `make' of all default targets in the top-level makefile.
         push @commands, sub { $self->exe( $make_bin, @make_args ) };
     }
     elsif ($module_in_qt5) {
-        if ($qt_minimal_deps) {
-            # minimal deps mode?  Then we turned off some build parts in configure, and must
-            # now explicitly enable them for this module only.
-
-            if (! -e $qt_gitmodule_build_dir) {
-                mkpath( $qt_gitmodule_build_dir );
-                # Note, we don't have to worry about emptying the build dir,
-                # because it's always under the top-level build dir, and we already
-                # cleaned that if it existed.
-            }
-
-            push @commands, sub {
-                local $CWD = $qt_gitmodule_build_dir;
-                $self->exe(
-                    $qmake_bin,
-                    $qt_gitmodule_dir,
-                    map { "QT_BUILD_PARTS+=$_" } @OPTIONAL_BUILD_PARTS
-                );
-            };
-        }
-
         # Building a module hosted in qt5; `configure' is expected to have generated a
         # makefile with a `module-FOO' target for this module, with correct dependency
         # information. Issuing a `make module-FOO' should automatically build the module
         # and all deps, as parallel as possible.
         my $make_target = "module-$qt_gitmodule";
 
-        push @commands, sub { $self->exe( $make_bin, @make_args, $make_target ) };
+        push @commands, sub {
+            local $ENV{'QMAKEFLAGS'} = join(" ", map { '"'.$_.'"' } @qmake_args);
+            $self->exe( $make_bin, @make_args, $make_target );
+        };
     }
     else {
         # Building a module, hosted outside of qt5.
@@ -1019,12 +1009,6 @@ sub run_compile
 
         push @commands, sub { chdir( $qt_gitmodule_build_dir ) };
 
-        my @qmake_args;
-        if ($qt_minimal_deps) {
-            # minimal deps mode?  Then we turned off some build parts in configure, and must
-            # now explicitly enable them for this module only.
-            push @qmake_args, map { "QT_BUILD_PARTS+=$_" } @OPTIONAL_BUILD_PARTS;
-        }
         push @commands, sub { $self->exe(
             $qmake_bin,
             $qt_gitmodule_dir,
-- 
GitLab