3 # Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
4 # Copyright (C) 2009 Google Inc. All rights reserved.
5 # Copyright (C) 2010 moiji-mobile.com All rights reserved.
6 # Copyright (C) 2011 Research In Motion Limited. All rights reserved.
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
12 # 1. Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
14 # 2. Redistributions in binary form must reproduce the above copyright
15 # notice, this list of conditions and the following disclaimer in the
16 # documentation and/or other materials provided with the distribution.
17 # 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
18 # its contributors may be used to endorse or promote products derived
19 # from this software without specific prior written permission.
21 # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
22 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
25 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 # Build script wrapper for the WebKit Open Source Project.
39 use Getopt::Long qw(:config pass_through);
40 use lib $FindBin::Bin;
42 use webkitperl::features;
45 sub cMakeArgsFromFeatures();
46 sub checkForJavaSDK();
47 sub formatBuildTime($);
50 my $originalWorkingDirectory = getcwd();
62 my $onlyWebKitProject = 0;
64 my $startTime = time();
67 $requestAnimationFrameSupport,
69 $threeDRenderingSupport,
70 $accelerated2dCanvasSupport,
73 $channelMessagingSupport,
74 $clientBasedGeolocationSupport,
79 $dataTransferItemsSupport,
81 $deviceOrientationSupport,
82 $directoryUploadSupport,
87 $fullscreenAPISupport,
91 $indexedDatabaseSupport,
94 $javaScriptDebuggerSupport,
98 $mediaStatisticsSupport,
102 $netscapePluginSupport,
103 $notificationsSupport,
104 $offlineWebApplicationSupport,
105 $orientationEventsSupport,
106 $pageVisibilityApiSupport,
109 $registerProtocolHandlerSupport,
110 $sharedWorkersSupport,
112 $svgAnimationSupport,
114 $svgDOMObjCBindingsSupport,
116 $systemMallocSupport,
117 $tiledBackingStoreSupport,
119 $touchIconLoadingSupport,
123 $webInspectorSupport,
133 { option => "request-animation-frame", desc => "Toggle requestAnimationFrame support",
134 define => "ENABLE_REQUEST_ANIMATION_FRAME", default => (isAppleMacWebKit()), value => \$requestAnimationFrameSupport },
136 { option => "3d-canvas", desc => "Toggle 3D canvas (WebGL) support",
137 define => "ENABLE_WEBGL", default => (isAppleMacWebKit() && !isLeopard()), value => \$threeDCanvasSupport },
139 { option => "3d-rendering", desc => "Toggle 3D rendering support",
140 define => "ENABLE_3D_RENDERING", default => (isAppleMacWebKit() || isQt()), value => \$threeDRenderingSupport },
142 { option => "accelerated-2d-canvas", desc => "Toggle accelerated 2D canvas support",
143 define => "ENABLE_ACCELERATED_2D_CANVAS", default => 0, value => \$accelerated2dCanvasSupport },
145 { option => "animation-api", desc => "Toggle animation API support",
146 define => "ENABLE_ANIMATION_API", default => 0, value => \$animationAPISupport },
148 { option => "blob", desc => "Toggle Blob support",
149 define => "ENABLE_BLOB", default => (isAppleMacWebKit() || isGtk()), value => \$blobSupport },
151 { option => "channel-messaging", desc => "Toggle MessageChannel and MessagePort support",
152 define => "ENABLE_CHANNEL_MESSAGING", default => 1, value => \$channelMessagingSupport },
154 { option => "client-based-geolocation", desc => "Toggle client-based Geolocation support",
155 define => "ENABLE_CLIENT_BASED_GEOLOCATION", default => isAppleWebKit(), value => \$clientBasedGeolocationSupport },
157 { option => "css3-flexbox", desc => "Toggle CSS3 Flexbox support",
158 define => "ENABLE_CSS3_FLEXBOX", default => 0, value => \$css3FlexboxSupport },
160 { option => "coverage", desc => "Toggle code coverage support",
161 define => "", default => 0, value => \$coverageSupport },
163 { option => "database", desc => "Toggle Database Support",
164 define => "ENABLE_DATABASE", default => 1, value => \$databaseSupport },
166 { option => "datalist", desc => "Toggle HTML5 datalist support",
167 define => "ENABLE_DATALIST", default => 1, value => \$datalistSupport },
169 { option => "data-transfer-items", desc => "Toggle HTML5 data transfer items support",
170 define => "ENABLE_DATA_TRANSFER_ITEMS", default => 0, value => \$dataTransferItemsSupport },
172 { option => "details", desc => "Toggle HTML5 details support",
173 define => "ENABLE_DETAILS", default => 1, value => \$detailsSupport },
175 { option => "device-orientation", desc => "Toggle DeviceOrientation support",
176 define => "ENABLE_DEVICE_ORIENTATION", default => 0, value => \$deviceOrientationSupport },
178 { option => "directory-upload", desc => "Toogle Directory upload support",
179 define => "ENABLE_DIRECTORY_UPLOAD", default => 0, value => \$directoryUploadSupport },
181 { option => "dom-storage", desc => "Toggle DOM Storage Support",
182 define => "ENABLE_DOM_STORAGE", default => 1, value => \$domStorageSupport },
184 { option => "eventsource", desc => "Toggle server-sent events support",
185 define => "ENABLE_EVENTSOURCE", default => 1, value => \$eventsourceSupport },
187 { option => "file-system", desc => "Toggle FileSystem support",
188 define => "ENABLE_FILE_SYSTEM", default => 0, value => \$fileSystemSupport },
190 { option => "filters", desc => "Toggle Filters support",
191 define => "ENABLE_FILTERS", default => (isAppleWebKit() || isGtk() || isQt() || isEfl()), value => \$filtersSupport },
193 { option => "fullscreen-api", desc => "Toggle Fullscreen API support",
194 define => "ENABLE_FULLSCREEN_API", default => (isAppleMacWebKit() || isGtk()), value => \$fullscreenAPISupport },
196 { option => "geolocation", desc => "Toggle Geolocation support",
197 define => "ENABLE_GEOLOCATION", default => (isAppleWebKit() || isGtk()), value => \$geolocationSupport },
199 { option => "icon-database", desc => "Toggle Icon database support",
200 define => "ENABLE_ICONDATABASE", default => 1, value => \$iconDatabaseSupport },
202 { option => "indexed-database", desc => "Toggle Indexed Database API support",
203 define => "ENABLE_INDEXED_DATABASE", default => 0, value => \$indexedDatabaseSupport },
205 { option => "input-color", desc => "Color Input support",
206 define => "ENABLE_INPUT_COLOR", default => 0, value => \$inputColorSupport },
208 { option => "input-speech", desc => "Speech Input API support",
209 define => "ENABLE_INPUT_SPEECH", default => 0, value => \$inputSpeechSupport },
211 { option => "inspector", desc => "Toggle Web Inspector support",
212 define => "ENABLE_INSPECTOR", default => 1, value => \$webInspectorSupport },
214 { option => "javascript-debugger", desc => "Toggle JavaScript Debugger/Profiler support",
215 define => "ENABLE_JAVASCRIPT_DEBUGGER", default => 1, value => \$javaScriptDebuggerSupport },
217 { option => "link-prefetch", desc => "Toggle pre fetching support",
218 define => "ENABLE_LINK_PREFETCH", default => 0, value => \$linkPrefetchSupport },
220 { option => "mathml", desc => "Toggle MathML support",
221 define => "ENABLE_MATHML", default => 1, value => \$mathmlSupport },
223 { option => "media-source", desc => "Toggle Media Source support",
224 define => "ENABLE_MEDIA_SOURCE", default => 0, value => \$mediaSourceSupport },
226 { option => "media-statistics", desc => "Toggle Media Statistics support",
227 define => "ENABLE_MEDIA_STATISTICS", default => 0, value => \$mediaStatisticsSupport },
229 { option => "media-stream", desc => "Toggle Media Stream API support (implies Blob support, currently Chromium and GTK only)",
230 define => "ENABLE_MEDIA_STREAM", default => (isChromium() || isGtk()), value => \$mediaStreamSupport },
232 { option => "meter-tag", desc => "Meter Tag support",
233 define => "ENABLE_METER_TAG", default => !isAppleWinWebKit(), value => \$meterTagSupport },
235 { option => "mhtml", desc => "Toggle MHTML support",
236 define => "ENABLE_MHTML", default => 0, value => \$mhtmlSupport },
238 { option => "netscape-plugin", desc => "Netscape Plugin support",
239 define => "ENABLE_NETSCAPE_PLUGIN_API", default => !isEfl(), value => \$netscapePluginSupport },
241 { option => "notifications", desc => "Toggle Desktop Notifications Support",
242 define => "ENABLE_NOTIFICATIONS", default => 0, value => \$notificationsSupport },
244 { option => "offline-web-applications", desc => "Toggle Offline Web Application Support",
245 define => "ENABLE_OFFLINE_WEB_APPLICATIONS", default => 1, value => \$offlineWebApplicationSupport },
247 { option => "orientation-events", desc => "Toggle Orientation Events support",
248 define => "ENABLE_ORIENTATION_EVENTS", default => 0, value => \$orientationEventsSupport },
250 { option => "page-visibility-api", desc => "Page Visibility API support",
251 define => "ENABLE_PAGE_VISIBILITY_API", default => 0, value => \$pageVisibilityApiSupport },
253 { option => "progress-tag", desc => "Progress Tag support",
254 define => "ENABLE_PROGRESS_TAG", default => 1, value => \$progressTagSupport },
256 { option => "quota", desc => "Toggle Quota support",
257 define => "ENABLE_QUOTA", default => 0, value => \$quotaSupport },
259 { option => "register-protocol-handler", desc => "Register Protocol Handler support",
260 define => "ENABLE_REGISTER_PROTOCOL_HANDLER", default => 0, value => \$registerProtocolHandlerSupport },
262 { option => "system-malloc", desc => "Toggle system allocator instead of TCmalloc",
263 define => "USE_SYSTEM_MALLOC", default => 0, value => \$systemMallocSupport },
265 { option => "shared-workers", desc => "Toggle SharedWorkers support",
266 define => "ENABLE_SHARED_WORKERS", default => (isAppleWebKit() || isGtk()), value => \$sharedWorkersSupport },
268 { option => "svg", desc => "Toggle SVG support",
269 define => "ENABLE_SVG", default => 1, value => \$svgSupport },
271 { option => "svg-animation", desc => "Toggle SVG animation support (implies SVG support)",
272 define => "ENABLE_SVG_ANIMATION", default => 1, value => \$svgAnimationSupport },
274 { option => "svg-as-image", desc => "Toggle SVG as Image support (implies SVG support)",
275 define => "ENABLE_SVG_AS_IMAGE", default => 1, value => \$svgAsImageSupport },
277 { option => "svg-dom-objc-bindings", desc => "Toggle SVG DOM Objective-C bindings support (implies SVG support)",
278 define => "ENABLE_SVG_DOM_OBJC_BINDINGS", default => isAppleMacWebKit(), value => \$svgDOMObjCBindingsSupport },
280 { option => "svg-fonts", desc => "Toggle SVG fonts support (imples SVG support)",
281 define => "ENABLE_SVG_FONTS", default => 1, value => \$svgFontsSupport },
283 { option => "tiled-backing-store", desc => "Toggle Tiled Backing Store support",
284 define => "ENABLE_TILED_BACKING_STORE", default => isQt(), value => \$tiledBackingStoreSupport },
286 { option => "touch-events", desc => "Toggle Touch Events support",
287 define => "ENABLE_TOUCH_EVENTS", default => isQt(), value => \$touchEventsSupport },
289 { option => "touch-icon-loading", desc => "Toggle Touch Icon Loading Support",
290 define => "ENABLE_TOUCH_ICON_LOADING", default => 0, value => \$touchIconLoadingSupport },
292 { option => "video", desc => "Toggle Video support",
293 define => "ENABLE_VIDEO", default => (isAppleWebKit() || isGtk()), value => \$videoSupport },
295 { option => "wcss", desc => "Toggle WCSS support",
296 define => "ENABLE_WCSS", default => 0, value => \$wcssSupport },
298 { option => "web-audio", desc => "Toggle Web Audio support",
299 define => "ENABLE_WEB_AUDIO", default => 0, value=> \$webAudioSupport },
301 { option => "web-sockets", desc => "Toggle Web Sockets support",
302 define => "ENABLE_WEB_SOCKETS", default => 1, value=> \$webSocketsSupport },
304 { option => "web-timing", desc => "Toggle Web Timing support",
305 define => "ENABLE_WEB_TIMING", default => 0, value=> \$webTimingSupport },
307 { option => "workers", desc => "Toggle Web Workers support",
308 define => "ENABLE_WORKERS", default => (isAppleWebKit() || isGtk()), value => \$workersSupport },
310 { option => "xhtmlmp", desc => "Toggle XHTML-MP support",
311 define => "ENABLE_XHTMLMP", default => 0, value => \$xhtmlmpSupport },
313 { option => "xpath", desc => "Toggle XPath support",
314 define => "ENABLE_XPATH", default => 1, value => \$xpathSupport },
316 { option => "xslt", desc => "Toggle XSLT support",
317 define => "ENABLE_XSLT", default => 1, value => \$xsltSupport },
320 # Update defaults from Qt's project file
322 # Take a sneek peek at the arguments, since we will need the qmake binary early
323 # on to do profile parsing.
325 if (/^--qmake=(.*)/) {
326 setQmakeBinaryPath($1);
329 my %qtDefaults = qtFeatureDefaults();
330 foreach (@features) {
331 $_->{default} = $qtDefaults{$_->{define}} || 0;
335 # Additional environment parameters
336 push @ARGV, split(/ /, $ENV{'BUILD_WEBKIT_ARGS'}) if ($ENV{'BUILD_WEBKIT_ARGS'});
338 # Initialize values from defaults
340 if ($_ eq '--minimal') {
342 } elsif ($_ eq '--v8') {
347 # Initialize values from defaults
348 foreach (@features) {
349 ${$_->{value}} = ($_->{default} && !$minimal) || 0;
352 $svgSupport = $svgSupport || $svgAnimationSupport || $svgAsImageSupport
353 || $svgDOMObjCBindingsSupport || $svgFontsSupport;
355 $blobSupport = $blobSupport || $mediaStreamSupport;
357 my $programName = basename($0);
359 Usage: $programName [options] [options to pass to build system]
360 --help Show this help message
361 --clean Cleanup the build directory
362 --debug Compile in debug mode
363 --gyp Use GYP-generated project files
364 --dsym Change debugging format to dwarf-with-dsym (Mac only)
366 --chromium Build the Chromium port on Mac/Win/Linux
367 --chromium-android Build the Chromium port on Android
368 --efl Build the EFL port
369 --gtk Build the GTK+ port
370 --qt Build the Qt port
371 --wincairo Build using Cairo (rather than CoreGraphics) on Windows
372 --wince Build the WinCE port
374 --inspector-frontend Copy changes to the inspector front-end files to the build directory
376 --install-headers=<path> Set installation path for the headers (Qt only)
377 --install-libs=<path> Set installation path for the libraries (Qt only)
378 --v8 Use V8 as JavaScript engine (Qt only)
379 -2 build WebKit2 (Qt only)
381 --prefix=<path> Set installation prefix to the given path (Gtk/Efl only)
382 --makeargs=<arguments> Optional Makefile flags
383 --qmakearg=<arguments> Optional qmake flags (Qt only, e.g. --qmakearg="CONFIG+=webkit2" to build WebKit2)
385 --minimal No optional features, unless explicitly enabled
387 --only-webkit Build only the WebKit project
388 --no-webkit2 Omit WebKit2 code from the build
393 'help' => \$showHelp,
396 'install-headers=s' => \$installHeaders,
397 'install-libs=s' => \$installLibs,
398 'prefix=s' => \$prefixPath,
399 'makeargs=s' => \$makeArgs,
400 'minimal' => \$minimal,
402 'only-webkit' => \$onlyWebKitProject,
403 'no-webkit2' => \$noWebKit2,
406 # Build usage text and options list from features
407 foreach (@features) {
408 my $opt = sprintf("%-35s", " --[no-]$_->{option}");
409 $usage .= "$opt $_->{desc} (default: $_->{default})\n";
410 $options{"$_->{option}!"} = $_->{value};
413 GetOptions(%options);
420 checkRequiredSystemConfig();
423 my $productDir = productDir();
425 # Remove Qt makefiles from productDir.
426 # https://bugs.webkit.org/show_bug.cgi?id=54466
427 File::Find::find(sub {unlink $File::Find::name if $File::Find::name =~ m/Makefile/;}, $productDir) if (isQt() && !isSymbian() && -e $productDir);
429 # Remove 0 byte sized files from productDir after slave lost for Qt buildbots.
430 File::Find::find(\&unlinkZeroFiles, $productDir) if (isQt() && !isSymbian() && -e $productDir);
432 sub unlinkZeroFiles()
434 my $file = $File::Find::name;
437 print "0 byte sized file removed from build directory: $file\n";
441 # Check that all the project directories are there.
442 my @projects = ("Source/JavaScriptCore", "Source/WebCore", "Source/WebKit");
444 for my $dir (@projects) {
446 die "Error: No $dir directory found. Please do a fresh checkout.\n";
450 if (!isQt() && !-d "WebKitLibraries") {
451 die "Error: No WebKitLibraries directory found. Please do a fresh checkout.\n";
454 # Generate the generate project files from .gyp files
456 system("perl", "Tools/Scripts/generate-project-files") == 0 or die "Failed to run generate-project-files";
461 # enable autotool options accordingly
464 foreach (@features) {
465 push @options, autotoolsFlag(${$_->{value}}, $_->{option});
468 push @options, "--prefix=" . $prefixPath if defined($prefixPath);
469 push @options, "--makeargs=" . $makeArgs if $makeArgs;
470 } elsif (isAppleMacWebKit()) {
472 push @options, XcodeOptions();
476 my ($feature, $isEnabled, $defaultValue) = @_;
477 return "" if $defaultValue == $isEnabled;
478 return $feature . "=" . ($isEnabled ? $feature : "");
481 foreach (@features) {
482 if ($_->{option} ne "coverage") {
483 my $option = option($_->{define}, ${$_->{value}}, $_->{default});
484 push @options, $option unless $option eq "";
488 # Apple builds JavaScriptGlue, and only on the Mac.
489 splice @projects, 1, 0, "Source/JavaScriptGlue";
491 # ANGLE must come before WebCore
492 splice @projects, 0, 0, "Source/ThirdParty/ANGLE";
494 # WebKit2 is only supported in SnowLeopard and later at present.
495 push @projects, ("Source/WebKit2", "Tools/MiniBrowser") if osXVersion()->{"minor"} >= 6 and !$noWebKit2;
497 # Copy library and header from WebKitLibraries to a findable place in the product directory.
498 my @librariesToCopy = (
499 "libWebKitSystemInterfaceLeopard.a",
500 "libWebKitSystemInterfaceSnowLeopard.a",
501 "libWebKitSystemInterfaceLion.a",
502 "libWebCoreSQLite3.a",
504 foreach my $libName (@librariesToCopy) {
505 my $srcLib = "WebKitLibraries/" . $libName;
506 my $lib = "$productDir/" . $libName;
507 if (!-e $lib || -M $lib > -M $srcLib) {
508 print "Updating $lib\n";
509 system "ditto", $srcLib, $lib;
510 system "ranlib", $lib;
514 # FIXME: This code should be abstracted to not be copy/paste.
515 my $srcHeader = "WebKitLibraries/WebKitSystemInterface.h";
516 my $header = "$productDir/usr/local/include/WebKitSystemInterface.h";
517 if (!-e $header || -M $header > -M $srcHeader) {
518 print "Updating $header\n";
519 system "mkdir", "-p", "$productDir/usr/local/include";
520 system "ditto", $srcHeader, $header;
523 my $srcHeaderDir = "WebKitLibraries/WebCoreSQLite3";
524 my $headerDir = "$productDir/WebCoreSQLite3";
525 if (!-e $headerDir || -M $headerDir > -M $srcHeaderDir) {
526 print "Updating $headerDir\n";
527 system "ditto", $srcHeaderDir, $headerDir;
529 } elsif (isWinCairo()) {
530 (system("perl Tools/Scripts/update-webkit-wincairo-libs") == 0) or die;
531 } elsif (isAppleWinWebKit()) {
532 # Copy WebKitSupportLibrary to the correct location in WebKitLibraries so it can be found.
533 # Will fail if WebKitSupportLibrary.zip is not in source root.
534 (system("perl Tools/Scripts/update-webkit-support-libs") == 0) or die;
536 push @options, "--install-headers=" . $installHeaders if defined($installHeaders);
537 push @options, "--install-libs=" . $installLibs if defined($installLibs);
538 push @options, "--makeargs=" . $makeArgs if $makeArgs;
539 push @options, "--qmakearg=CONFIG+=webkit2" if isWK2();
540 @options = (@ARGV, @options);
542 foreach (@features) {
543 push @options, "DEFINES+=$_->{define}=${$_->{value}}" if ${$_->{value}} != $_->{default};
547 push @options, "CONFIG+=minimal";
551 push @options, "CONFIG+=v8";
555 # If asked to build just the WebKit project, overwrite the projects
556 # list after all of the port specific tweaks have been made to
557 # build options, etc.
558 @projects = ("Source/WebKit") if $onlyWebKitProject;
560 # Force re-link of existing libraries if different than expected
561 removeLibraryDependingOnFeature("WebCore", "SVG", $svgSupport);
563 if (isInspectorFrontend()) {
564 exit exitStatus(copyInspectorFrontendFiles());
568 $makeArgs .= " --port=wx";
570 downloadWafIfNeeded();
571 @options = split(/ /, $makeArgs);
573 my $result = buildWafProject('.', $clean, @options);
574 exit exitStatus($result) if exitStatus($result);
579 # Chromium doesn't build by project directories.
581 push @options, "--makeargs=" . $makeArgs if $makeArgs;
582 my $result = buildChromium($clean, @options);
583 exit exitStatus($result) if exitStatus($result);
587 # By default we build using all of the available CPUs.
588 $makeArgs .= ($makeArgs ? " " : "") . "-j" . numberOfCPUs() if $makeArgs !~ /-j\s*\d+/;
589 buildCMakeProjectOrExit($clean, "Efl", $prefixPath, $makeArgs, cMakeArgsFromFeatures());
593 buildCMakeProjectOrExit($clean, "WinCE", $prefixPath, $makeArgs, ("-DCMAKE_WINCE_SDK=\"STANDARDSDK_500 (ARMV4I)\"", cMakeArgsFromFeatures()));
596 # Build, and abort if the build fails.
597 for my $dir (@projects) {
601 # For Gtk and Qt the WebKit project builds all others
602 if ((isGtk() || isQt()) && $dir ne "Source/WebKit") {
607 my $project = basename($dir);
609 $result = buildGtkProject($project, $clean, @options);
611 #FIXME: $dir should probably be $project.
612 $result = buildQMakeQtProject($dir, $clean, @options);
613 } elsif (isAppleMacWebKit()) {
614 my @local_options = @options;
615 push @local_options, XcodeCoverageSupportOptions() if $coverageSupport && $project ne "ANGLE";
616 my $useGYPProject = $useGYP && ($project =~ "WebCore|JavaScriptCore|JavaScriptGlue");
617 my $projectPath = $useGYPProject ? "gyp/$project" : $project;
618 $result = buildXCodeProject($projectPath, $clean, @local_options, @ARGV);
619 } elsif (isAppleWinWebKit()) {
620 if ($project eq "WebKit") {
621 $result = buildVisualStudioProject("win/WebKit.vcproj/WebKit.sln", $clean);
624 # Various build* calls above may change the CWD.
627 if (exitStatus($result)) {
628 my $scriptDir = relativeScriptsDir();
629 if (usingVisualStudioExpress()) {
630 # Visual Studio Express is so lame it can't stdout build failures.
631 # So we find its logs and dump them to the console ourselves.
632 system(File::Spec->catfile($scriptDir, "print-vse-failure-logs"));
634 if (isAppleWinWebKit()) {
635 print "\n\n===== BUILD FAILED ======\n\n";
636 print "Please ensure you have run $scriptDir/update-webkit to install dependencies.\n\n";
637 my $baseProductDir = baseProductDir();
638 print "You can view build errors by checking the BuildLog.htm files located at:\n$baseProductDir/obj/<project>/<config>.\n";
640 exit exitStatus($result);
644 # Don't report the "WebKit is now built" message after a clean operation.
647 # Write out congratulations message.
652 sub cMakeArgsFromFeatures()
655 foreach (@features) {
656 my $featureName = $_->{define};
658 my $featureEnabled = ${$_->{value}} ? "ON" : "OFF";
659 push @args, "-D$featureName=$featureEnabled";
665 sub checkForJavaSDK()
667 my $jniHeader = "/System/Library/Frameworks/JavaVM.framework/Headers/jni.h";
671 print "\nCan't find required $jniHeader, build will fail.\n\n";
672 print "After installing \"Java for Mac OS X 10.6 Update 3\", the Java Developer Package is required to build WebKit.\n";
673 print "Please install the package from http://connect.apple.com (found under Downloads > Java).\n\n";
674 print "For more information, see:\n";
675 print "https://lists.webkit.org/pipermail/webkit-dev/2010-October/014867.html\n";
676 print "https://webkit.org/building/tools.html\n\n";
680 sub formatBuildTime($)
682 my ($buildTime) = @_;
684 my $buildHours = int($buildTime / 3600);
685 my $buildMins = int(($buildTime - $buildHours * 3600) / 60);
686 my $buildSecs = $buildTime - $buildHours * 3600 - $buildMins * 60;
689 return sprintf("%dh:%02dm:%02ds", $buildHours, $buildMins, $buildSecs);
691 return sprintf("%02dm:%02ds", $buildMins, $buildSecs);
696 my $launcherPath = launcherPath();
697 my $launcherName = launcherName();
698 my $endTime = time();
699 my $buildTime = formatBuildTime($endTime - $startTime);
702 print "===========================================================\n";
703 print " WebKit is now built ($buildTime). \n";
705 print " To run $launcherName with this newly-built code, use the\n";
706 print " \"$launcherPath\" script.\n";
708 print "===========================================================\n";