3 # Copyright (C) 2009 Google Inc. All rights reserved.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
14 # 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
15 # its contributors may be used to endorse or promote products derived
16 # from this software without specific prior written permission.
18 # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 # Update script for the WebKit Chromium Port.
34 use lib $FindBin::Bin;
37 determineIsChromiumAndroid();
39 chdir("Source/WebKit/chromium") or die $!;
41 # Find gclient or install it.
43 if (commandExists('gclient')) {
44 $gclientPath = 'gclient';
45 } elsif (-e 'depot_tools/gclient') {
46 $gclientPath = 'depot_tools/gclient';
48 print "Installing chromium's depot_tools...\n";
49 system("svn co http://src.chromium.org/svn/trunk/tools/depot_tools") == 0 or die $1;
50 $gclientPath = 'depot_tools/gclient';
53 if (! -e ".gclient") {
54 # If .gclient configuration file doesn't exist, create it.
55 print "Configuring gclient...\n";
58 "--spec=solutions=[{'name':'./','url':None}]") == 0 or die $!;
61 # When building WebKit's Chromium port for Android, we need the Android NDK as
62 # it will allow us to cross-compile all sources to the target architecture.
63 if (isChromiumAndroid()) {
64 if (! -e "third_party/android-ndk-r7") {
65 print "Installing the Android NDK, version 7...\n";
66 if (! -e "third_party/") {
69 my $host_os = isLinux() ? "linux" : "darwin";
70 my $result = system("curl", "-o", "third_party/android-ndk-r7.tar.bz2", "http://dl.google.com/android/ndk/android-ndk-r7-" . $host_os . "-x86.tar.bz2");
71 die "Couldn't download the Android NDK." if $result;
73 $result = system("tar", "jxC", "third_party", "-f", "third_party/android-ndk-r7.tar.bz2");
74 die "Couldn't extract the Android NDK." if $result;
77 $ENV{ANDROID_NDK_ROOT} = sourceDir() . "/Source/WebKit/chromium/third_party/android-ndk-r7";
78 $ENV{WEBKIT_ANDROID_BUILD} = 1;
86 # Execute gclient sync.
87 print "Updating chromium port dependencies using gclient...\n";
88 my @gclientArgs = ($gclientPath, "sync");
89 push @gclientArgs, "--force" if $force;
90 # --reset could delete modified files if necessary to sync.
91 push @gclientArgs, "--reset" if $force;
92 push @gclientArgs, "--delete_unversioned_trees" if $force;
93 push @gclientArgs, "--deps=unix,android" if isChromiumAndroid();
95 my $cmd = join(" ",@gclientArgs);
99 # The following will call glient up to $max_attempts times before
100 # it gives up and fails. We need this because glcient can fail
101 # for several reasons, some of which are transient (flakiness).
103 for (1 .. $max_attempts) {
105 print "Re-trying '" . $cmd . "'\n" if $rc != 0;
109 die "Error: '$cmd' failed $max_attempts tries and returned " . $rc if ($rc);