<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[162545] trunk/Tools</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/162545">162545</a></dd>
<dt>Author</dt> <dd>mrobinson@webkit.org</dd>
<dt>Date</dt> <dd>2014-01-22 11:55:57 -0800 (Wed, 22 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[GTK][CMake] build-webkit should try harder to avoid re-running cmake
https://bugs.webkit.org/show_bug.cgi?id=127073
Reviewed by Daniel Bates.
* Scripts/build-webkit: Unify all the ports that call buildCMakeProjectOrExit with
the new isCMakeBuild conditional. This allows us to share more code between ports.
Pass the build arguments to the removeCMakeCache function.
* Scripts/webkitdirs.pm:
(runAutogenForAutotoolsProjectIfNecessary): Renamed mustReRunAutogen to cachedArgumentFileOutOfDate
because it's now shared with the CMake build.
(cachedArgumentFileOutOfDate): Renamed.
(cmakeCachePath): Added this helper which gets the CMakeCache.txt path.
(shouldRemoveCMakeCache): Tries to preserve current behavior for all ports,
except GTK+ which examines the OptionsGTK.cmake and OptionsCommon.cmake file
as well as checking if build-webkit has been run with different arguments.
(removeCMakeCache): Call shouldRemoveCMakeCache now.
(generateBuildSystemFromCMakeProject): Exit early if CMakeCache.txt exists for GTK+.
(isCMakeBuild): Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptsbuildwebkit">trunk/Tools/Scripts/build-webkit</a></li>
<li><a href="#trunkToolsScriptswebkitdirspm">trunk/Tools/Scripts/webkitdirs.pm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (162544 => 162545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-01-22 19:55:11 UTC (rev 162544)
+++ trunk/Tools/ChangeLog        2014-01-22 19:55:57 UTC (rev 162545)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2014-01-15 Martin Robinson <mrobinson@igalia.com>
+
+ [GTK][CMake] build-webkit should try harder to avoid re-running cmake
+ https://bugs.webkit.org/show_bug.cgi?id=127073
+
+ Reviewed by Daniel Bates.
+
+ * Scripts/build-webkit: Unify all the ports that call buildCMakeProjectOrExit with
+ the new isCMakeBuild conditional. This allows us to share more code between ports.
+ Pass the build arguments to the removeCMakeCache function.
+ * Scripts/webkitdirs.pm:
+ (runAutogenForAutotoolsProjectIfNecessary): Renamed mustReRunAutogen to cachedArgumentFileOutOfDate
+ because it's now shared with the CMake build.
+ (cachedArgumentFileOutOfDate): Renamed.
+ (cmakeCachePath): Added this helper which gets the CMakeCache.txt path.
+ (shouldRemoveCMakeCache): Tries to preserve current behavior for all ports,
+ except GTK+ which examines the OptionsGTK.cmake and OptionsCommon.cmake file
+ as well as checking if build-webkit has been run with different arguments.
+ (removeCMakeCache): Call shouldRemoveCMakeCache now.
+ (generateBuildSystemFromCMakeProject): Exit early if CMakeCache.txt exists for GTK+.
+ (isCMakeBuild): Added.
+
</ins><span class="cx"> 2014-01-22 Thiago de Barros Lacerda <thiago.lacerda@openbossa.org>
</span><span class="cx">
</span><span class="cx"> [EFL][GTK] Get EFL and GTK compiling with ACCESSIBILITY disabled
</span></span></pre></div>
<a id="trunkToolsScriptsbuildwebkit"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/build-webkit (162544 => 162545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/build-webkit        2014-01-22 19:55:11 UTC (rev 162544)
+++ trunk/Tools/Scripts/build-webkit        2014-01-22 19:55:57 UTC (rev 162545)
</span><span class="lines">@@ -252,24 +252,23 @@
</span><span class="cx"> @projects = ("Source/WebInspectorUI");
</span><span class="cx"> }
</span><span class="cx">
</span><del>-if (isEfl() || isGtkCMake()) {
- # By default we build using all of the available CPUs.
- $makeArgs .= ($makeArgs ? " " : "") . "-j" . numberOfCPUs() if $makeArgs !~ /-j\s*\d+/;
</del><ins>+if (isCMakeBuild()) {
</ins><span class="cx"> $cmakeArgs = "-DENABLE_WEBKIT=OFF " . $cmakeArgs if $noWebKit1;
</span><span class="cx"> $cmakeArgs = "-DENABLE_WEBKIT2=OFF " . $cmakeArgs if $noWebKit2;
</span><span class="cx">
</span><ins>+ # By default we build using all of the available CPUs.
+ if (!isWinCE()) {
+ $makeArgs .= ($makeArgs ? " " : "") . "-j" . numberOfCPUs() if $makeArgs !~ /-j\s*\d+/;
+ }
+
</ins><span class="cx"> # We remove CMakeCache to avoid the bots to reuse cached flags when
</span><span class="cx"> # we enable new features. This forces a reconfiguration.
</span><del>- removeCMakeCache();
</del><ins>+ my @featureArgs = cMakeArgsFromFeatures();
+ removeCMakeCache(@featureArgs);
</ins><span class="cx">
</span><del>- my $portName = (isEfl() ? "Efl" : "GTK");
- buildCMakeProjectOrExit($clean, $portName, $prefixPath, $makeArgs, (cmakeBasedPortArguments(), cMakeArgsFromFeatures()), $cmakeArgs);
</del><ins>+ buildCMakeProjectOrExit($clean, cmakeBasedPortName(), $prefixPath, $makeArgs, (cmakeBasedPortArguments(), @featureArgs), $cmakeArgs);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-if (isWinCE()) {
- buildCMakeProjectOrExit($clean, "WinCE", $prefixPath, $makeArgs, (cmakeBasedPortArguments(), cMakeArgsFromFeatures()), $cmakeArgs);
-}
-
</del><span class="cx"> # Build, and abort if the build fails.
</span><span class="cx"> for my $dir (@projects) {
</span><span class="cx"> chdir $dir or die;
</span></span></pre></div>
<a id="trunkToolsScriptswebkitdirspm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitdirs.pm (162544 => 162545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitdirs.pm        2014-01-22 19:55:11 UTC (rev 162544)
+++ trunk/Tools/Scripts/webkitdirs.pm        2014-01-22 19:55:57 UTC (rev 162545)
</span><span class="lines">@@ -1660,8 +1660,8 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # Run autogen.sh again if either the features overrided by build-webkit or build arguments have changed.
</span><del>- if (!mustReRunAutogen($sourceDir, "WebKitFeatureOverrides.txt", $joinedOverridableFeatures)
- && !mustReRunAutogen($sourceDir, "previous-autogen-arguments.txt", $joinedBuildArgs)) {
</del><ins>+ if (!isCachedArgumentfileOutOfDate("WebKitFeatureOverrides.txt", $joinedOverridableFeatures)
+ && !isCachedArgumentfileOutOfDate("previous-autogen-arguments.txt", $joinedBuildArgs)) {
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1711,9 +1711,9 @@
</span><span class="cx"> return File::Spec->catdir(@jhbuildPath);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-sub mustReRunAutogen($@)
</del><ins>+sub isCachedArgumentfileOutOfDate($@)
</ins><span class="cx"> {
</span><del>- my ($sourceDir, $filename, $currentContents) = @_;
</del><ins>+ my ($filename, $currentContents) = @_;
</ins><span class="cx">
</span><span class="cx"> if (! -e $filename) {
</span><span class="cx"> return 1;
</span><span class="lines">@@ -1723,10 +1723,6 @@
</span><span class="cx"> chomp(my $previousContents = <CONTENTS_FILE>);
</span><span class="cx"> close(CONTENTS_FILE);
</span><span class="cx">
</span><del>- # We only care about the WebKit2 argument when we are building WebKit itself.
- # build-jsc never passes --enable-webkit2, so if we didn't do this, autogen.sh
- # would run for every single build on the bots, since it runs both build-webkit
- # and build-jsc.
</del><span class="cx"> if ($previousContents ne $currentContents) {
</span><span class="cx"> print "Contents for file $filename have changed.\n";
</span><span class="cx"> print "Previous contents were: $previousContents\n\n";
</span><span class="lines">@@ -1873,12 +1869,61 @@
</span><span class="cx"> return ();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-sub removeCMakeCache()
</del><ins>+sub cmakeCachePath()
</ins><span class="cx"> {
</span><del>- my $cacheFilePath = File::Spec->catdir(baseProductDir(), configuration(), "CMakeCache.txt");
- unlink($cacheFilePath) if -e $cacheFilePath;
</del><ins>+ return File::Spec->catdir(baseProductDir(), configuration(), "CMakeCache.txt");
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+sub shouldRemoveCMakeCache(@)
+{
+ my ($cacheFilePath, @buildArgs) = @_;
+ if (isWinCE()) {
+ return 0;
+ }
+
+ if (!isGtk()) {
+ return 1;
+ }
+
+ # We check this first, because we always want to create this file for a fresh build.
+ my $optionsCache = File::Spec->catdir(baseProductDir(), configuration(), "build-webkit-options.txt");
+ my $joinedBuildArgs = join(" ", @buildArgs);
+ if (isCachedArgumentfileOutOfDate($optionsCache, $joinedBuildArgs)) {
+ open(CACHED_ARGUMENTS, ">", $optionsCache);
+ print CACHED_ARGUMENTS $joinedBuildArgs;
+ close(CACHED_ARGUMENTS);
+
+ return 1;
+ }
+
+ my $cmakeCache = cmakeCachePath();
+ unless (-e $cmakeCache) {
+ return 0;
+ }
+
+ my $cacheFileModifiedTime = stat($cmakeCache)->mtime;
+ my $platformConfiguration = File::Spec->catdir(sourceDir(), "Source", "cmake", "Options" . cmakeBasedPortName() . ".cmake");
+ if ($cacheFileModifiedTime < stat($platformConfiguration)->mtime) {
+ return 1;
+ }
+
+ my $globalConfiguration = File::Spec->catdir(sourceDir(), "Source", "cmake", "OptionsCommon.cmake");
+ if ($cacheFileModifiedTime < stat($globalConfiguration)->mtime) {
+ return 1;
+ }
+
+ return 0;
+}
+
+sub removeCMakeCache(@)
+{
+ my (@buildArgs) = @_;
+ if (shouldRemoveCMakeCache(@buildArgs)) {
+ my $cmakeCache = cmakeCachePath();
+ unlink($cmakeCache) if -e $cmakeCache;
+ }
+}
+
</ins><span class="cx"> sub generateBuildSystemFromCMakeProject
</span><span class="cx"> {
</span><span class="cx"> my ($port, $prefixPath, @cmakeArgs, $additionalCMakeArgs) = @_;
</span><span class="lines">@@ -1888,6 +1933,11 @@
</span><span class="cx"> my $originalWorkingDirectory = getcwd();
</span><span class="cx"> chdir($buildPath) or die;
</span><span class="cx">
</span><ins>+ # For GTK+ we try to be smart about when to rerun cmake, so that we can have faster incremental builds.
+ if (isGtk() && -e cmakeCachePath()) {
+ return 0;
+ }
+
</ins><span class="cx"> my @args;
</span><span class="cx"> push @args, "-DPORT=\"$port\"";
</span><span class="cx"> push @args, "-DCMAKE_INSTALL_PREFIX=\"$prefixPath\"" if $prefixPath;
</span><span class="lines">@@ -1980,6 +2030,11 @@
</span><span class="cx"> return "";
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+sub isCMakeBuild()
+{
+ return isEfl() || isWinCE() || isGtkCMake();
+}
+
</ins><span class="cx"> sub promptUser
</span><span class="cx"> {
</span><span class="cx"> my ($prompt, $default) = @_;
</span></span></pre>
</div>
</div>
</body>
</html>