Commit 06f46f9a authored by mrobinson@webkit.org's avatar mrobinson@webkit.org

[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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162545 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent fb21bf27
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.
2014-01-22 Thiago de Barros Lacerda <thiago.lacerda@openbossa.org>
[EFL][GTK] Get EFL and GTK compiling with ACCESSIBILITY disabled
......
......@@ -252,22 +252,21 @@ if (isInspectorFrontend()) {
@projects = ("Source/WebInspectorUI");
}
if (isEfl() || isGtkCMake()) {
# By default we build using all of the available CPUs.
$makeArgs .= ($makeArgs ? " " : "") . "-j" . numberOfCPUs() if $makeArgs !~ /-j\s*\d+/;
if (isCMakeBuild()) {
$cmakeArgs = "-DENABLE_WEBKIT=OFF " . $cmakeArgs if $noWebKit1;
$cmakeArgs = "-DENABLE_WEBKIT2=OFF " . $cmakeArgs if $noWebKit2;
# By default we build using all of the available CPUs.
if (!isWinCE()) {
$makeArgs .= ($makeArgs ? " " : "") . "-j" . numberOfCPUs() if $makeArgs !~ /-j\s*\d+/;
}
# We remove CMakeCache to avoid the bots to reuse cached flags when
# we enable new features. This forces a reconfiguration.
removeCMakeCache();
my $portName = (isEfl() ? "Efl" : "GTK");
buildCMakeProjectOrExit($clean, $portName, $prefixPath, $makeArgs, (cmakeBasedPortArguments(), cMakeArgsFromFeatures()), $cmakeArgs);
}
my @featureArgs = cMakeArgsFromFeatures();
removeCMakeCache(@featureArgs);
if (isWinCE()) {
buildCMakeProjectOrExit($clean, "WinCE", $prefixPath, $makeArgs, (cmakeBasedPortArguments(), cMakeArgsFromFeatures()), $cmakeArgs);
buildCMakeProjectOrExit($clean, cmakeBasedPortName(), $prefixPath, $makeArgs, (cmakeBasedPortArguments(), @featureArgs), $cmakeArgs);
}
# Build, and abort if the build fails.
......
......@@ -1660,8 +1660,8 @@ sub runAutogenForAutotoolsProjectIfNecessary($@)
}
# Run autogen.sh again if either the features overrided by build-webkit or build arguments have changed.
if (!mustReRunAutogen($sourceDir, "WebKitFeatureOverrides.txt", $joinedOverridableFeatures)
&& !mustReRunAutogen($sourceDir, "previous-autogen-arguments.txt", $joinedBuildArgs)) {
if (!isCachedArgumentfileOutOfDate("WebKitFeatureOverrides.txt", $joinedOverridableFeatures)
&& !isCachedArgumentfileOutOfDate("previous-autogen-arguments.txt", $joinedBuildArgs)) {
return;
}
}
......@@ -1711,9 +1711,9 @@ sub getJhbuildPath()
return File::Spec->catdir(@jhbuildPath);
}
sub mustReRunAutogen($@)
sub isCachedArgumentfileOutOfDate($@)
{
my ($sourceDir, $filename, $currentContents) = @_;
my ($filename, $currentContents) = @_;
if (! -e $filename) {
return 1;
......@@ -1723,10 +1723,6 @@ sub mustReRunAutogen($@)
chomp(my $previousContents = <CONTENTS_FILE>);
close(CONTENTS_FILE);
# 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.
if ($previousContents ne $currentContents) {
print "Contents for file $filename have changed.\n";
print "Previous contents were: $previousContents\n\n";
......@@ -1873,10 +1869,59 @@ sub jhbuildWrapperPrefixIfNeeded()
return ();
}
sub removeCMakeCache()
sub cmakeCachePath()
{
my $cacheFilePath = File::Spec->catdir(baseProductDir(), configuration(), "CMakeCache.txt");
unlink($cacheFilePath) if -e $cacheFilePath;
return File::Spec->catdir(baseProductDir(), configuration(), "CMakeCache.txt");
}
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;
}
}
sub generateBuildSystemFromCMakeProject
......@@ -1888,6 +1933,11 @@ sub generateBuildSystemFromCMakeProject
my $originalWorkingDirectory = getcwd();
chdir($buildPath) or die;
# 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;
}
my @args;
push @args, "-DPORT=\"$port\"";
push @args, "-DCMAKE_INSTALL_PREFIX=\"$prefixPath\"" if $prefixPath;
......@@ -1980,6 +2030,11 @@ sub cmakeBasedPortName()
return "";
}
sub isCMakeBuild()
{
return isEfl() || isWinCE() || isGtkCMake();
}
sub promptUser
{
my ($prompt, $default) = @_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment