1563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#!/usr/bin/perl -w
2563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
3563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# Copyright (C) 2007 Apple Computer, Inc.  All rights reserved.
4563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# Copyright (C) 2007 Staikos Computing Services, Inc.  <info@staikos.net>
5563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#
6563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# Redistribution and use in source and binary forms, with or without
7563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# modification, are permitted provided that the following conditions
8563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# are met:
9563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#
10563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# 1.  Redistributions of source code must retain the above copyright
11563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#     notice, this list of conditions and the following disclaimer. 
12563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# 2.  Redistributions in binary form must reproduce the above copyright
13563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#     notice, this list of conditions and the following disclaimer in the
14563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#     documentation and/or other materials provided with the distribution. 
15563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
16563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#     its contributors may be used to endorse or promote products derived
17563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#     from this software without specific prior written permission. 
18563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#
19563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
20563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
23563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
30563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# Simplified "run" script for WebKit Open Source Project.
31563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
32563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkuse strict;
33563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkuse File::Spec::Functions qw/catdir/;
34563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkuse File::Temp qw/tempfile/;
35563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkuse FindBin;
36563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkuse lib $FindBin::Bin;
37563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkuse webkitdirs;
38563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
39563af33bc48281d19dce701398dbb88cb54fd7ecCary ClarksetConfiguration();
40563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkmy $productDir = productDir();
41563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkmy $launcherPath = productDir();
42563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkmy @args = @ARGV;
43563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
44563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# Check to see that all the frameworks are built.
45563af33bc48281d19dce701398dbb88cb54fd7ecCary ClarkcheckFrameworks();
46563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
47563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark# Set paths according to the build system used
48563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkif (isQt()) {
49563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    my $libDir = catdir(productDir(), 'lib');
5081bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    if (isWK2()) {
5181bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch        $launcherPath = catdir($launcherPath, "bin", "MiniBrowser");
5281bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    } else {
5381bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch        $launcherPath = catdir($launcherPath, "bin", "QtTestBrowser");
5481bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    }
55563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
56cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block    $ENV{QTWEBKIT_PLUGIN_PATH} = catdir($libDir, 'plugins');
57cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block
580bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    print "Starting webkit launcher, running against the built WebKit in $libDir...\n";
590bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    if (isDarwin()) {
600bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch        $ENV{DYLD_LIBRARY_PATH} = $ENV{DYLD_LIBRARY_PATH} ? "$libDir:$ENV{DYLD_LIBRARY_PATH}" : $libDir;
610bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch        $ENV{DYLD_FRAMEWORK_PATH} = $ENV{DYLD_FRAMEWORK_PATH} ? "$libDir:$ENV{DYLD_FRAMEWORK_PATH}" : $libDir;
620bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    } else {
630bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch        $ENV{LD_LIBRARY_PATH} = $ENV{LD_LIBRARY_PATH} ? "$libDir:$ENV{LD_LIBRARY_PATH}" : $libDir;
640bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    }
65563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} else {
66563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
67563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    if (isGtk()) {
68563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark        $launcherPath = catdir($launcherPath, "Programs", "GtkLauncher");
69563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    }
70231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    
71dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    if (isEfl()) {
72dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        $launcherPath = catdir($launcherPath, "Programs", "EWebLauncher");
73dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    }
74dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    
75231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    if (isWx()) {
76231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        if (isDarwin()) {
77231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block            $launcherPath = catdir($launcherPath, 'wxBrowser.app', 'Contents', 'MacOS', 'wxBrowser');
78231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        } else {
79231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block            $ENV{LD_LIBRARY_PATH} = $ENV{LD_LIBRARY_PATH} ? "$productDir:$ENV{LD_LIBRARY_PATH}" : $productDir;
80231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block            $launcherPath = catdir($launcherPath, 'wxBrowser');
81231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        }
82231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    }
83563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
84563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark    print "Starting webkit launcher.\n";
85563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark}
86563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
87563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkexec $launcherPath, @args or die;
88563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark
89