Title: [100130] trunk/Tools
Revision
100130
Author
[email protected]
Date
2011-11-14 04:58:46 -0800 (Mon, 14 Nov 2011)

Log Message

[Qt] Add support for config tests for Qt 5

This allows us to build and run configure-tests at build
time to determine if a given platform feature is available.

Reviewed by Simon Hausmann.

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/ChangeLog (100129 => 100130)


--- trunk/Tools/ChangeLog	2011-11-14 12:46:56 UTC (rev 100129)
+++ trunk/Tools/ChangeLog	2011-11-14 12:58:46 UTC (rev 100130)
@@ -1,3 +1,19 @@
+2011-11-14  Tor Arne Vestbø  <[email protected]>
+
+        [Qt] Add support for config tests for Qt 5
+
+        This allows us to build and run configure-tests at build
+        time to determine if a given platform feature is available.
+
+        Reviewed by Simon Hausmann.
+
+        * Scripts/build-webkit:
+        * Scripts/webkitdirs.pm:
+        (qtFeatureDefaults):
+        * qmake/configure.pro: Added.
+        * qmake/mkspecs/features/features.prf:
+        * qmake/sync.profile: Added.
+
 2011-11-11  Pierre Rossi  <[email protected]>
 
         [Qt] Remove the QStyle dependency in Qt's mobile theme

Modified: trunk/Tools/Scripts/build-webkit (100129 => 100130)


--- trunk/Tools/Scripts/build-webkit	2011-11-14 12:46:56 UTC (rev 100129)
+++ trunk/Tools/Scripts/build-webkit	2011-11-14 12:58:46 UTC (rev 100130)
@@ -332,15 +332,22 @@
 # Update defaults from Qt's project file
 if (isQt()) {
     # Take a sneek peek at the arguments, since we will need the qmake binary early
-    # on to do profile parsing.
+    # on to do profile parsing. We also need to know if we're showing the help-text.
     foreach (@ARGV) {
         if (/^--qmake=(.*)/) {
             setQmakeBinaryPath($1);
+        } elsif (/^--help$/) {
+            $showHelp = 1;
         }
     }
-    my %qtDefaults = qtFeatureDefaults();
+
+    my %qtDefaults;
+    if ($showHelp) {
+        %qtDefaults = qtFeatureDefaults();
+    }
+
     foreach (@features) {
-        $_->{default} = $qtDefaults{$_->{define}} || 0;
+        $_->{default} = (%qtDefaults ? $qtDefaults{$_->{define}} : -1);
     }
 }
 
@@ -358,7 +365,7 @@
 
 # Initialize values from defaults
 foreach (@features) {
-    ${$_->{value}} = ($_->{default} && !$minimal) || 0;
+    ${$_->{value}} = ($minimal ? 0 : $_->{default});
 }
 
 $svgSupport = $svgSupport || $svgDOMObjCBindingsSupport || $svgFontsSupport;

Modified: trunk/Tools/Scripts/webkitdirs.pm (100129 => 100130)


--- trunk/Tools/Scripts/webkitdirs.pm	2011-11-14 12:46:56 UTC (rev 100129)
+++ trunk/Tools/Scripts/webkitdirs.pm	2011-11-14 12:58:46 UTC (rev 100130)
@@ -736,8 +736,6 @@
     my @buildArgs = @_;
     my %qtFeatureDefaults;
 
-    push @buildArgs, "CONFIG+=compute_defaults";
-
     die "ERROR: qmake missing but required to build WebKit.\n" if not commandExists($qmakebin);
 
     my $qmakepath = File::Spec->catfile(sourceDir(), "Tools", "qmake");
@@ -747,13 +745,29 @@
     } else {
         $qmakecommand = "QMAKEPATH=$qmakepath $qmakebin";
     }
-    my $dir = File::Spec->catfile($qmakepath, "mkspecs", "features", "features.prf");
-    my $defaults = `$qmakecommand @buildArgs $dir 2>&1`;
 
+    my $originalCwd = getcwd();
+
+    my $file;
+    if (!@buildArgs) {
+        # Do a quick check of the features without running the config tests
+        $file = File::Spec->catfile($qmakepath, "mkspecs", "features", "features.prf");
+        push @buildArgs, "CONFIG+=compute_defaults";
+    } else {
+        my $dir = File::Spec->catfile(productDir(), "Tools", "qmake");
+        File::Path::mkpath($dir);
+        chdir $dir or die "Failed to cd into " . $dir . "\n";
+        $file = File::Spec->catfile($qmakepath, "configure.pro");
+    }
+
+    my $defaults = `$qmakecommand @buildArgs $file 2>&1`;
+
     while ($defaults =~ m/(\S+?)=(\S+?)/gi) {
         $qtFeatureDefaults{$1}=$2;
     }
 
+    chdir $originalCwd;
+
     return %qtFeatureDefaults;
 }
 

Added: trunk/Tools/qmake/configure.pro (0 => 100130)


--- trunk/Tools/qmake/configure.pro	                        (rev 0)
+++ trunk/Tools/qmake/configure.pro	2011-11-14 12:58:46 UTC (rev 100130)
@@ -0,0 +1,3 @@
+load(features)
+message($$DEFINES)
+error("Done computing defaults")

Modified: trunk/Tools/qmake/mkspecs/features/features.prf (100129 => 100130)


--- trunk/Tools/qmake/mkspecs/features/features.prf	2011-11-14 12:46:56 UTC (rev 100129)
+++ trunk/Tools/qmake/mkspecs/features/features.prf	2011-11-14 12:58:46 UTC (rev 100130)
@@ -5,6 +5,9 @@
 # See 'Tools/qmake/README' for an overview of the build system
 # -------------------------------------------------------------------
 
+# Load results of config tests (only supported in Qt 5)
+haveQt(5): include($${ROOT_BUILD_DIR}/Tools/qmake/.qmake.cache, , true)
+
 CONFIG(minimal) {
     DEFINES += ENABLE_NETSCAPE_PLUGIN_API=0
 }

Added: trunk/Tools/qmake/sync.profile (0 => 100130)


--- trunk/Tools/qmake/sync.profile	                        (rev 0)
+++ trunk/Tools/qmake/sync.profile	2011-11-14 12:58:46 UTC (rev 100130)
@@ -0,0 +1,3 @@
+# This file is only used for config tests
+%configtests = (
+);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to