build-dumprendertree revision dcc8cf2e65d1aa555cce12431a16547e66b469ee
1563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#!/usr/bin/perl -w
2563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
30bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
4563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#
5563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# Redistribution and use in source and binary forms, with or without
6563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# modification, are permitted provided that the following conditions
7563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# are met:
8563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#
9563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# 1.  Redistributions of source code must retain the above copyright
10563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#     notice, this list of conditions and the following disclaimer. 
11563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# 2.  Redistributions in binary form must reproduce the above copyright
12563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#     notice, this list of conditions and the following disclaimer in the
13563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#     documentation and/or other materials provided with the distribution. 
14563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
15563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#     its contributors may be used to endorse or promote products derived
16563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#     from this software without specific prior written permission. 
17563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#
18563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
29563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkuse strict;
300bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochuse File::Basename;
31563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkuse FindBin;
320bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochuse Getopt::Long qw(:config pass_through);
33563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkuse lib $FindBin::Bin;
34563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkuse webkitdirs;
35563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkuse POSIX;
36563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
370bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochmy $showHelp = 0;
380bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochmy $clean = 0;
390bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
400bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochmy $programName = basename($0);
410bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochmy $usage = <<EOF;
420bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben MurdochUsage: $programName [options] [options to pass to build system]
430bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch  --help        Show this help message
440bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch  --clean       Clean up the build directory
450bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch  --gtk         Build the GTK+ port
460bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch  --qt          Build the Qt port
470bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch  --wx          Build the wxWindows port
48dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block  --chromium    Build the Chromium port
490bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben MurdochEOF
500bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
510bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben MurdochGetOptions(
520bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    'help' => \$showHelp,
530bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    'clean' => \$clean,
540bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch);
550bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
560bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochif ($showHelp) {
570bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch   print STDERR $usage;
580bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch   exit 1;
590bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch}
600bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
61563af33bc48281d19dce701398dbb88cb54fd7ecCary ClarkcheckRequiredSystemConfig();
62563af33bc48281d19dce701398dbb88cb54fd7ecCary ClarksetConfiguration();
63563af33bc48281d19dce701398dbb88cb54fd7ecCary ClarkchdirWebKit();
64563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
65563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# Build
66563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkchdir "WebKitTools/DumpRenderTree" or die;
670bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
68563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkmy $result;
69563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkif (isAppleMacWebKit()) {
700bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    $result = buildXCodeProject("DumpRenderTree", $clean, XcodeOptions(), @ARGV);
71563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} elsif (isAppleWinWebKit()) {
720bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    $result = buildVisualStudioProject("DumpRenderTree.sln", $clean);
730bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch} elsif (isQt() || isGtk() || isWx()) {
740bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    # Qt, Gtk and wxWindows build everything in one shot. No need to build anything here.
75563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    $result = 0;
76dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block} elsif (isChromium()) {
77dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    if (isDarwin()) {
78dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        $result = buildXCodeProject("DumpRenderTree.gyp/DumpRenderTree", $clean, @ARGV);
79dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    } elsif (isCygwin() || isWindows()) {
80dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        # Windows build - builds the root visual studio solution.
81dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        $result = buildChromiumVisualStudioProject("DumpRenderTree.gyp/DumpRenderTree.sln", $clean);
82dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    } elsif (isLinux()) {
83dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        $result = buildChromiumMakefile("../../WebKit/chromium/", "DumpRenderTree", $clean);
84dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    } else {
85dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        die "This platform is not supported by Chromium.\n";
86dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    }
87563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} else {
88563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    die "Building not defined for this platform!\n";
89563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
900bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
91563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkexit exitStatus($result);
92