if sys.platform not in ('darwin',):
args.append('--no-circular-check')
- # On linux, we want gyp to output a makefile (default is scons).
- if (sys.platform.startswith('linux') or
+ generators = os.environ.get('GYP_GENERATORS', '')
+ if 'ninja' in generators:
+ args.extend([ '--toplevel-dir=../../..' ])
+ elif (sys.platform.startswith('linux') or
'WEBKIT_ANDROID_BUILD' in os.environ or
- (sys.platform == 'darwin' and
- os.environ.get('GYP_GENERATORS', '').find('make') != -1)):
+ (sys.platform == 'darwin' and 'make' in generators)):
args.extend(['-fmake',
'--suffix=.chromium',
'--toplevel-dir=../../..',
+2012-01-28 Nico Weber <thakis@chromium.org>
+
+ [chromium] Add support for building standalone webkit/chromium checkouts with ninja.
+ https://bugs.webkit.org/show_bug.cgi?id=77243
+
+ Reviewed by Adam Barth.
+
+ * Scripts/update-webkit:
+ * Scripts/webkitdirs.pm:
+ (isChromiumNinja):
+ (determineIsChromiumNinja):
+ (buildChromiumNinja):
+ (buildChromium):
+
2012-01-27 Kentaro Hara <haraken@chromium.org>
The cpp parser of prepare-ChangeLog treats if(...) {} as a method
my $showHelp;
my $useGYP = 0;
my $useMake = 0;
+my $useNinja = 0;
determineIsChromium();
determineIsChromiumAndroid();
'q|quiet' => \$quiet,
'gyp' => \$useGYP,
'make' => \$useMake,
+ 'ninja' => \$useNinja,
);
if (!$getOptionsResult || $showHelp) {
Usage: @{[ basename($0) ]} [options]
--chromium also update dependencies of the chromium port
--make generate the Makefile-based build system (Chromium only)
+ --ninja generate the ninja-based build system (Chromium only)
--chromium-android also update dependencies of the chromium port for Android
-h|--help show the help message
-q|--quiet pass -q to svn update for quiet updates
if ($useMake) {
$ENV{"GYP_GENERATORS"} = "make";
}
+if ($useNinja) {
+ $ENV{"GYP_GENERATORS"} = "ninja";
+}
my $startTime = time();
my $isChromium;
my $isChromiumAndroid;
my $isChromiumMacMake;
+my $isChromiumNinja;
my $forceChromiumUpdate;
my $isInspectorFrontend;
my $isWK2;
$isChromiumMacMake = isDarwin() && $hasUpToDateMakefile;
}
+sub isChromiumNinja()
+{
+ determineIsChromiumNinja();
+ return $isChromiumNinja;
+}
+
+sub determineIsChromiumNinja()
+{
+ return if defined($isChromiumNinja);
+
+ my $config = configuration();
+
+ my $hasUpToDateNinjabuild = 0;
+ if (-e "out/$config/build.ninja") {
+ my $statNinja = stat("out/$config/build.ninja");
+
+ my $statXcode = 0;
+ if (-e 'Source/WebKit/chromium/WebKit.xcodeproj') {
+ $statXcode = stat('Source/WebKit/chromium/WebKit.xcodeproj')->mtime;
+ }
+
+ my $statMake = 0;
+ if (-e 'Makefile.chromium') {
+ $statXcode = stat('Makefile.chromium')->mtime;
+ }
+
+ $hasUpToDateNinjabuild = $statNinja > $statXcode && $statNinja > $statMake;
+ }
+ $isChromiumNinja = $hasUpToDateNinjabuild;
+}
+
sub forceChromiumUpdate()
{
determineIsChromium();
return system $command;
}
+sub buildChromiumNinja($$@)
+{
+ # rm -rf out requires rerunning gyp, so don't support --clean for now.
+ my ($target, @options) = @_;
+ my $config = configuration();
+ my $command = "";
+
+ $command .= "ninja -C out/$config $target";
+
+ print "$command\n";
+ return system $command;
+}
+
sub buildChromiumVisualStudioProject($$)
{
my ($projectPath, $clean) = @_;
}
my $result = 1;
- if (isDarwin() && !isChromiumAndroid() && !isChromiumMacMake()) {
+ if (isDarwin() && !isChromiumAndroid() && !isChromiumMacMake() && !isChromiumNinja()) {
# Mac build - builds the root xcode project.
$result = buildXCodeProject("Source/WebKit/chromium/All", $clean, "-configuration", configuration(), @options);
} elsif (isCygwin() || isWindows()) {
# Windows build - builds the root visual studio solution.
$result = buildChromiumVisualStudioProject("Source/WebKit/chromium/All.sln", $clean);
+ } elsif (isChromiumNinja()) {
+ $result = buildChromiumNinja("all", $clean, @options);
} elsif (isLinux() || isChromiumAndroid() || isChromiumMacMake()) {
# Linux build - build using make.
$result = buildChromiumMakefile("all", $clean, @options);