#!/usr/bin/perl -w # Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. # Copyright (C) 2009 Google Inc. All rights reserved. # Copyright (C) 2010 moiji-mobile.com All rights reserved. # Copyright (C) 2011 Research In Motion Limited. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of # its contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Build script wrapper for the WebKit Open Source Project. use strict; use File::Basename; use File::Find; use File::Spec; use FindBin; use Getopt::Long qw(:config pass_through); use lib $FindBin::Bin; use webkitdirs; use webkitperl::features; use POSIX; sub cMakeArgsFromFeatures(); sub checkForJavaSDK(); sub formatBuildTime($); sub writeCongrats(); my $originalWorkingDirectory = getcwd(); chdirWebKit(); my $showHelp = 0; my $clean = 0; my $useGYP = 0; my $minimal = 0; my $v8 = 0; my $installHeaders; my $installLibs; my $prefixPath; my $makeArgs = ""; my $cmakeArgs; my $onlyWebKitProject = 0; my $noWebKit2 = 0; my $startTime = time(); my ( $requestAnimationFrameSupport, $threeDCanvasSupport, $threeDRenderingSupport, $accelerated2dCanvasSupport, $animationAPISupport, $blobSupport, $channelMessagingSupport, $clientBasedGeolocationSupport, $coverageSupport, $cssFiltersSupport, $cssGridLayoutSupport, $cssShadersSupport, $sqlDatabaseSupport, $datalistSupport, $dataTransferItemsSupport, $detailsSupport, $deviceOrientationSupport, $directoryUploadSupport, $fileSystemSupport, $filtersSupport, $fullscreenAPISupport, $gamepadSupport, $geolocationSupport, $iconDatabaseSupport, $imageResizerSupport, $indexedDatabaseSupport, $inputColorSupport, $inputSpeechSupport, $inputTypeDateSupport, $inputTypeDatetimeSupport, $inputTypeDatetimelocalSupport, $inputTypeMonthSupport, $inputTypeTimeSupport, $inputTypeWeekSupport, $javaScriptDebuggerSupport, $linkPrefetchSupport, $mathmlSupport, $mediaSourceSupport, $mediaStatisticsSupport, $mediaStreamSupport, $meterTagSupport, $mhtmlSupport, $microdataSupport, $mutationObserversSupport, $netscapePluginSupport, $notificationsSupport, $orientationEventsSupport, $pageVisibilityApiSupport, $progressTagSupport, $quotaSupport, $registerProtocolHandlerSupport, $sharedWorkersSupport, $styleScopedSupport, $svgSupport, $svgDOMObjCBindingsSupport, $svgFontsSupport, $systemMallocSupport, $tiledBackingStoreSupport, $touchEventsSupport, $touchIconLoadingSupport, $videoSupport, $webAudioSupport, $webInspectorSupport, $webSocketsSupport, $webTimingSupport, $workersSupport, $xsltSupport, ); my @features = ( { option => "request-animation-frame", desc => "Toggle requestAnimationFrame support", define => "ENABLE_REQUEST_ANIMATION_FRAME", default => (isAppleMacWebKit()), value => \$requestAnimationFrameSupport }, { option => "3d-canvas", desc => "Toggle 3D canvas (WebGL) support", define => "ENABLE_WEBGL", default => (isAppleMacWebKit() && !isLeopard()), value => \$threeDCanvasSupport }, { option => "3d-rendering", desc => "Toggle 3D rendering support", define => "ENABLE_3D_RENDERING", default => (isAppleMacWebKit() || isQt()), value => \$threeDRenderingSupport }, { option => "accelerated-2d-canvas", desc => "Toggle accelerated 2D canvas support", define => "ENABLE_ACCELERATED_2D_CANVAS", default => 0, value => \$accelerated2dCanvasSupport }, { option => "animation-api", desc => "Toggle animation API support", define => "ENABLE_ANIMATION_API", default => isBlackBerry(), value => \$animationAPISupport }, { option => "blob", desc => "Toggle Blob support", define => "ENABLE_BLOB", default => (isAppleMacWebKit() || isGtk() || isChromium()), value => \$blobSupport }, { option => "channel-messaging", desc => "Toggle MessageChannel and MessagePort support", define => "ENABLE_CHANNEL_MESSAGING", default => 1, value => \$channelMessagingSupport }, { option => "client-based-geolocation", desc => "Toggle client-based Geolocation support", define => "ENABLE_CLIENT_BASED_GEOLOCATION", default => (isAppleWebKit() || isGtk() || isBlackBerry()), value => \$clientBasedGeolocationSupport }, { option => "css-filters", desc => "Toggle CSS Filters support", define => "ENABLE_CSS_FILTERS", default => isAppleWebKit(), value => \$cssFiltersSupport }, { option => "css-grid-layout", desc => "Toggle CSS Grid Layout support", define => "ENABLE_CSS_GRID_LAYOUT", default => 0, value => \$cssGridLayoutSupport }, { option => "css-shaders", desc => "Toggle CSS Shaders (within CSS Filters) support", define => "ENABLE_CSS_SHADERS", default => isAppleWebKit(), value => \$cssShadersSupport }, { option => "coverage", desc => "Toggle code coverage support", define => "", default => 0, value => \$coverageSupport }, { option => "sql-database", desc => "Toggle SQL Database Support", define => "ENABLE_SQL_DATABASE", default => 1, value => \$sqlDatabaseSupport }, { option => "datalist", desc => "Toggle HTML5 datalist support", define => "ENABLE_DATALIST", default => 1, value => \$datalistSupport }, { option => "data-transfer-items", desc => "Toggle HTML5 data transfer items support", define => "ENABLE_DATA_TRANSFER_ITEMS", default => 0, value => \$dataTransferItemsSupport }, { option => "details", desc => "Toggle HTML5 details support", define => "ENABLE_DETAILS", default => 1, value => \$detailsSupport }, { option => "device-orientation", desc => "Toggle DeviceOrientation support", define => "ENABLE_DEVICE_ORIENTATION", default => isBlackBerry(), value => \$deviceOrientationSupport }, { option => "directory-upload", desc => "Toogle Directory upload support", define => "ENABLE_DIRECTORY_UPLOAD", default => 0, value => \$directoryUploadSupport }, { option => "mutation-observers", desc => "Toggle DOM mutation observer support", define => "ENABLE_MUTATION_OBSERVERS", default => 0, value => \$mutationObserversSupport }, { option => "file-system", desc => "Toggle FileSystem support", define => "ENABLE_FILE_SYSTEM", default => 0, value => \$fileSystemSupport }, { option => "filters", desc => "Toggle SVG Filters support", define => "ENABLE_FILTERS", default => (isAppleWebKit() || isGtk() || isQt() || isEfl() || isBlackBerry()), value => \$filtersSupport }, { option => "fullscreen-api", desc => "Toggle Fullscreen API support", define => "ENABLE_FULLSCREEN_API", default => (isAppleMacWebKit() || isGtk()), value => \$fullscreenAPISupport }, { option => "gamepad", desc => "Toggle Gamepad support", define => "ENABLE_GAMEPAD", default => 0, value => \$gamepadSupport }, { option => "geolocation", desc => "Toggle Geolocation support", define => "ENABLE_GEOLOCATION", default => (isAppleWebKit() || isGtk() || isBlackBerry()), value => \$geolocationSupport }, { option => "icon-database", desc => "Toggle Icon database support", define => "ENABLE_ICONDATABASE", default => 1, value => \$iconDatabaseSupport }, { option => "indexed-database", desc => "Toggle Indexed Database API support", define => "ENABLE_INDEXED_DATABASE", default => 0, value => \$indexedDatabaseSupport }, { option => "input-color", desc => "Color Input support", define => "ENABLE_INPUT_COLOR", default => isBlackBerry(), value => \$inputColorSupport }, { option => "input-speech", desc => "Speech Input API support", define => "ENABLE_INPUT_SPEECH", default => 0, value => \$inputSpeechSupport }, { option => "input-type-date", desc => "Toggle date type support", define => "ENABLE_INPUT_TYPE_DATE", default => 0, value => \$inputTypeDateSupport }, { option => "input-type-datetime", desc => "Toggle datetime type support", define => "ENABLE_INPUT_TYPE_DATETIME", default => 0, value => \$inputTypeDatetimeSupport }, { option => "input-type-datetimelocal", desc => "Toggle datetime-local type support", define => "ENABLE_INPUT_TYPE_DATETIMELOCAL", default => 0, value => \$inputTypeDatetimelocalSupport }, { option => "input-type-month", desc => "Toggle month type support", define => "ENABLE_INPUT_TYPE_MONTH", default => 0, value => \$inputTypeMonthSupport }, { option => "input-type-time", desc => "Toggle time type support", define => "ENABLE_INPUT_TYPE_TIME", default => 0, value => \$inputTypeTimeSupport }, { option => "input-type-week", desc => "Toggle week type support", define => "ENABLE_INPUT_TYPE_WEEK", default => 0, value => \$inputTypeWeekSupport }, { option => "inspector", desc => "Toggle Web Inspector support", define => "ENABLE_INSPECTOR", default => 1, value => \$webInspectorSupport }, { option => "javascript-debugger", desc => "Toggle JavaScript Debugger/Profiler support", define => "ENABLE_JAVASCRIPT_DEBUGGER", default => 1, value => \$javaScriptDebuggerSupport }, { option => "link-prefetch", desc => "Toggle pre fetching support", define => "ENABLE_LINK_PREFETCH", default => 0, value => \$linkPrefetchSupport }, { option => "mathml", desc => "Toggle MathML support", define => "ENABLE_MATHML", default => 1, value => \$mathmlSupport }, { option => "media-source", desc => "Toggle Media Source support", define => "ENABLE_MEDIA_SOURCE", default => 0, value => \$mediaSourceSupport }, { option => "media-statistics", desc => "Toggle Media Statistics support", define => "ENABLE_MEDIA_STATISTICS", default => 0, value => \$mediaStatisticsSupport }, { option => "media-stream", desc => "Toggle Media Stream API support (implies Blob support, currently Chromium and GTK only)", define => "ENABLE_MEDIA_STREAM", default => (isChromium() || isGtk()), value => \$mediaStreamSupport }, { option => "meter-tag", desc => "Meter Tag support", define => "ENABLE_METER_TAG", default => !isAppleWinWebKit(), value => \$meterTagSupport }, { option => "mhtml", desc => "Toggle MHTML support", define => "ENABLE_MHTML", default => 0, value => \$mhtmlSupport }, { option => "microdata", desc => "Toggle Microdata support", define => "ENABLE_MICRODATA", default => 0, value => \$microdataSupport }, { option => "netscape-plugin", desc => "Netscape Plugin support", define => "ENABLE_NETSCAPE_PLUGIN_API", default => !isEfl(), value => \$netscapePluginSupport }, { option => "notifications", desc => "Toggle Desktop Notifications Support", define => "ENABLE_NOTIFICATIONS", default => isEfl(), value => \$notificationsSupport }, { option => "orientation-events", desc => "Toggle Orientation Events support", define => "ENABLE_ORIENTATION_EVENTS", default => isBlackBerry(), value => \$orientationEventsSupport }, { option => "page-visibility-api", desc => "Page Visibility API support", define => "ENABLE_PAGE_VISIBILITY_API", default => 0, value => \$pageVisibilityApiSupport }, { option => "progress-tag", desc => "Progress Tag support", define => "ENABLE_PROGRESS_TAG", default => 1, value => \$progressTagSupport }, { option => "quota", desc => "Toggle Quota support", define => "ENABLE_QUOTA", default => 0, value => \$quotaSupport }, { option => "register-protocol-handler", desc => "Register Protocol Handler support", define => "ENABLE_REGISTER_PROTOCOL_HANDLER", default => 0, value => \$registerProtocolHandlerSupport }, { option => "system-malloc", desc => "Toggle system allocator instead of TCmalloc", define => "USE_SYSTEM_MALLOC", default => 0, value => \$systemMallocSupport }, { option => "shared-workers", desc => "Toggle SharedWorkers support", define => "ENABLE_SHARED_WORKERS", default => (isAppleWebKit() || isGtk() || isBlackBerry()), value => \$sharedWorkersSupport }, { option => "style-scoped", desc => "Toggle