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
66f05b935882198ccf7d81675736e3aeb089c5113aBen Murdochchdir "Tools/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);
736c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen} elsif (isQt() || isGtk() || isWx() || isChromium()) {
746c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    # Qt, Gtk wxWindows, and Chromium build everything in one shot. No need to build anything here.
75563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    $result = 0;
76563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} else {
77563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    die "Building not defined for this platform!\n";
78563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
790bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
80563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkexit exitStatus($result);
81