diff options
Diffstat (limited to 'WebKitTools/Scripts/webkitdirs.pm')
-rw-r--r-- | WebKitTools/Scripts/webkitdirs.pm | 352 |
1 files changed, 294 insertions, 58 deletions
diff --git a/WebKitTools/Scripts/webkitdirs.pm b/WebKitTools/Scripts/webkitdirs.pm index a788b3d..745e808 100644 --- a/WebKitTools/Scripts/webkitdirs.pm +++ b/WebKitTools/Scripts/webkitdirs.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved. +# Copyright (C) 2005, 2006, 2007, 2010 Apple Inc. All rights reserved. # Copyright (C) 2009 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -50,6 +50,7 @@ BEGIN { our @EXPORT_OK; my $architecture; +my $numberOfCPUs; my $baseProductDir; my @baseProductDirOption; my $configuration; @@ -63,6 +64,7 @@ my $isSymbian; my %qtFeatureDefaults; my $isGtk; my $isWx; +my $isEfl; my @wxArgs; my $isChromium; my $isInspectorFrontend; @@ -71,6 +73,8 @@ my $isInspectorFrontend; my $vcBuildPath; my $windowsTmpPath; my $windowsSourceDir; +my $winVersion; +my $willUseVCExpressWhenBuilding = 0; # Defined in VCSUtils. sub exitStatus($); @@ -113,7 +117,9 @@ sub determineBaseProductDir return if defined $baseProductDir; determineSourceDir(); - if (isAppleMacWebKit()) { + $baseProductDir = $ENV{"WEBKITOUTPUTDIR"}; + + if (!defined($baseProductDir) and isAppleMacWebKit()) { # Silently remove ~/Library/Preferences/xcodebuild.plist which can # cause build failure. The presence of # ~/Library/Preferences/xcodebuild.plist can prevent xcodebuild from @@ -146,7 +152,7 @@ sub determineBaseProductDir } if (!defined($baseProductDir)) { # Port-spesific checks failed, use default - $baseProductDir = $ENV{"WEBKITOUTPUTDIR"} || "$sourceDir/WebKitBuild"; + $baseProductDir = "$sourceDir/WebKitBuild"; } if (isGit() && isGitBranchBuild()) { @@ -225,12 +231,35 @@ sub determineArchitecture } } +sub determineNumberOfCPUs +{ + return if defined $numberOfCPUs; + if (isLinux()) { + # First try the nproc utility, if it exists. If we get no + # results fall back to just interpretting /proc directly. + chomp($numberOfCPUs = `nproc 2> /dev/null`); + if ($numberOfCPUs eq "") { + $numberOfCPUs = (grep /processor/, `cat /proc/cpuinfo`); + } + } elsif (isWindows() || isCygwin()) { + if (defined($ENV{NUMBER_OF_PROCESSORS})) { + $numberOfCPUs = $ENV{NUMBER_OF_PROCESSORS}; + } else { + # Assumes cygwin + $numberOfCPUs = `ls /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor | wc -w`; + } + } elsif (isDarwin()) { + $numberOfCPUs = `sysctl -n hw.ncpu`; + } +} + sub jscPath($) { my ($productDir) = @_; my $jscName = "jsc"; $jscName .= "_debug" if (isCygwin() && ($configuration eq "Debug")); - return "$productDir/$jscName"; + return "$productDir/$jscName" if -e "$productDir/$jscName"; + return "$productDir/JavaScriptCore.framework/Resources/$jscName"; } sub argumentsForConfiguration() @@ -245,6 +274,7 @@ sub argumentsForConfiguration() push(@args, '--qt') if isQt(); push(@args, '--symbian') if isSymbian(); push(@args, '--gtk') if isGtk(); + push(@args, '--efl') if isEfl(); push(@args, '--wx') if isWx(); push(@args, '--chromium') if isChromium(); push(@args, '--inspector-frontend') if isInspectorFrontend(); @@ -270,11 +300,11 @@ sub determineConfigurationProductDir if (isAppleWinWebKit() && !isWx()) { $configurationProductDir = "$baseProductDir/bin"; } else { - # [Gtk] We don't have Release/Debug configurations in straight + # [Gtk][Efl] We don't have Release/Debug configurations in straight # autotool builds (non build-webkit). In this case and if # WEBKITOUTPUTDIR exist, use that as our configuration dir. This will # allows us to run run-webkit-tests without using build-webkit. - if ($ENV{"WEBKITOUTPUTDIR"} && isGtk()) { + if ($ENV{"WEBKITOUTPUTDIR"} && (isGtk() || isEfl())) { $configurationProductDir = "$baseProductDir"; } else { $configurationProductDir = "$baseProductDir/$configuration"; @@ -325,7 +355,7 @@ sub jscProductDir my $productDir = productDir(); $productDir .= "/JavaScriptCore" if isQt(); $productDir .= "/$configuration" if (isQt() && isWindows()); - $productDir .= "/Programs" if isGtk(); + $productDir .= "/Programs" if (isGtk() || isEfl()); return $productDir; } @@ -463,6 +493,12 @@ sub architecture() return $architecture; } +sub numberOfCPUs() +{ + determineNumberOfCPUs(); + return $numberOfCPUs; +} + sub setArchitecture { if (my $arch = shift @_) { @@ -541,6 +577,11 @@ sub builtDylibPathForName if (isDarwin() and -d "$configurationProductDir/lib/$libraryName.framework") { return "$configurationProductDir/lib/$libraryName.framework/$libraryName"; } elsif (isWindows()) { + if (configuration() eq "Debug") { + # On Windows, there is a "d" suffix to the library name. See <http://trac.webkit.org/changeset/53924/>. + $libraryName .= "d"; + } + my $mkspec = `qmake -query QMAKE_MKSPECS`; $mkspec =~ s/[\n|\r]$//g; my $qtMajorVersion = retrieveQMakespecVar("$mkspec/qconfig.pri", "QT_MAJOR_VERSION"); @@ -556,7 +597,10 @@ sub builtDylibPathForName return "$configurationProductDir/libwxwebkit.dylib"; } if (isGtk()) { - return "$configurationProductDir/$libraryName/../.libs/libwebkit-1.0.so"; + return "$configurationProductDir/$libraryName/../.libs/libwebkitgtk-1.0.so"; + } + if (isEfl()) { + return "$configurationProductDir/$libraryName/../.libs/libewebkit.so"; } if (isAppleMacWebKit()) { return "$configurationProductDir/$libraryName.framework/Versions/A/$libraryName"; @@ -569,7 +613,7 @@ sub builtDylibPathForName } } - die "Unsupported platform, can't determine built library locations."; + die "Unsupported platform, can't determine built library locations.\nTry `build-webkit --help` for more information.\n"; } # Check to see that all the frameworks are built. @@ -614,15 +658,23 @@ sub qtFeatureDefaults() return %qtFeatureDefaults; } +sub commandExists($) +{ + my $command = shift; + my $devnull = File::Spec->devnull(); + return `$command --version 2> $devnull`; +} + sub determineQtFeatureDefaults() { return if %qtFeatureDefaults; + die "ERROR: qmake missing but required to build WebKit.\n" if not commandExists("qmake"); my $originalCwd = getcwd(); chdir File::Spec->catfile(sourceDir(), "WebCore"); my $defaults = `qmake CONFIG+=compute_defaults 2>&1`; chdir $originalCwd; - while ($defaults =~ m/(\S*?)=(.*?)( |$)/gi) { + while ($defaults =~ m/(\S+?)=(\S+?)/gi) { $qtFeatureDefaults{$1}=$2; } } @@ -649,8 +701,8 @@ sub determineIsQt() return; } - # The presence of QTDIR only means Qt if --gtk is not on the command-line - if (isGtk() || isWx()) { + # The presence of QTDIR only means Qt if --gtk or --wx or --efl are not on the command-line + if (isGtk() || isWx() || isEfl()) { $isQt = 0; return; } @@ -666,8 +718,18 @@ sub determineIsSymbian() $isSymbian = 1; return; } +} + +sub determineIsEfl() +{ + return if defined($isEfl); + $isEfl = checkForArgumentAndRemoveFromARGV("--efl"); +} - $isSymbian = defined($ENV{'EPOCROOT'}); +sub isEfl() +{ + determineIsEfl(); + return $isEfl; } sub isGtk() @@ -739,6 +801,41 @@ sub isCygwin() return ($^O eq "cygwin") || 0; } +sub determineWinVersion() +{ + return if $winVersion; + + if (!isCygwin()) { + $winVersion = -1; + return; + } + + my $versionString = `uname -s`; + $versionString =~ /(\d\.\d)/; + $winVersion = $1; +} + +sub winVersion() +{ + determineWinVersion(); + return $winVersion; +} + +sub isWindows7() +{ + return winVersion() eq "6.1"; +} + +sub isWindowsVista() +{ + return winVersion() eq "6.0"; +} + +sub isWindowsXP() +{ + return winVersion() eq "5.1"; +} + sub isDarwin() { return ($^O eq "darwin") || 0; @@ -761,7 +858,7 @@ sub isLinux() sub isAppleWebKit() { - return !(isQt() or isGtk() or isWx() or isChromium()); + return !(isQt() or isGtk() or isWx() or isChromium() or isEfl()); } sub isAppleMacWebKit() @@ -848,7 +945,7 @@ sub relativeScriptsDir() sub launcherPath() { my $relativeScriptsPath = relativeScriptsDir(); - if (isGtk() || isQt() || isWx()) { + if (isGtk() || isQt() || isWx() || isEfl()) { return "$relativeScriptsPath/run-launcher"; } elsif (isAppleWebKit()) { return "$relativeScriptsPath/run-safari"; @@ -860,11 +957,13 @@ sub launcherName() if (isGtk()) { return "GtkLauncher"; } elsif (isQt()) { - return "QtLauncher"; + return "QtTestBrowser"; } elsif (isWx()) { return "wxBrowser"; } elsif (isAppleWebKit()) { return "Safari"; + } elsif (isEfl()) { + return "EWebLauncher"; } } @@ -887,14 +986,13 @@ sub checkRequiredSystemConfig print "http://developer.apple.com/tools/xcode\n"; print "*************************************************************\n"; } - } elsif (isGtk() or isQt() or isWx()) { + } elsif (isGtk() or isQt() or isWx() or isEfl()) { my @cmds = qw(flex bison gperf); my @missing = (); foreach my $cmd (@cmds) { - if (not `$cmd --version`) { - push @missing, $cmd; - } + push @missing, $cmd if not commandExists($cmd); } + if (@missing) { my $list = join ", ", @missing; die "ERROR: $list missing but required to build WebKit.\n"; @@ -995,6 +1093,7 @@ sub setupCygwinEnv() print "*************************************************************\n"; die; } + $willUseVCExpressWhenBuilding = 1; } my $qtSDKPath = "$programFilesPath/QuickTime SDK"; @@ -1016,6 +1115,27 @@ sub setupCygwinEnv() print "WEBKITLIBRARIESDIR is set to: ", $ENV{"WEBKITLIBRARIESDIR"}, "\n"; } +sub dieIfWindowsPlatformSDKNotInstalled +{ + my $registry32Path = "/proc/registry/"; + my $registry64Path = "/proc/registry64/"; + my $windowsPlatformSDKRegistryEntry = "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1"; + + # FIXME: It would be better to detect whether we are using 32- or 64-bit Windows + # and only check the appropriate entry. But for now we just blindly check both. + return if (-e $registry32Path . $windowsPlatformSDKRegistryEntry) || (-e $registry64Path . $windowsPlatformSDKRegistryEntry); + + print "*************************************************************\n"; + print "Cannot find registry entry '$windowsPlatformSDKRegistryEntry'.\n"; + print "Please download and install the Microsoft Windows Server 2003 R2\n"; + print "Platform SDK from <http://www.microsoft.com/downloads/details.aspx?\n"; + print "familyid=0baf2b35-c656-4969-ace8-e4c0c0716adb&displaylang=en>.\n\n"; + print "Then follow step 2 in the Windows section of the \"Installing Developer\n"; + print "Tools\" instructions at <http://www.webkit.org/building/tools.html>.\n"; + print "*************************************************************\n"; + die; +} + sub copyInspectorFrontendFiles { my $productDir = productDir(); @@ -1033,6 +1153,9 @@ sub copyInspectorFrontendFiles } elsif (isQt() || isGtk()) { my $prefix = $ENV{"WebKitInstallationPrefix"}; $inspectorResourcesDirPath = (defined($prefix) ? $prefix : "/usr/share") . "/webkit-1.0/webinspector"; + } elsif (isEfl()) { + my $prefix = $ENV{"WebKitInstallationPrefix"}; + $inspectorResourcesDirPath = (defined($prefix) ? $prefix : "/usr/share") . "/ewebkit/webinspector"; } if (! -d $inspectorResourcesDirPath) { @@ -1045,7 +1168,7 @@ sub copyInspectorFrontendFiles print "*************************************************************\n"; die; } - return system "rsync", "-aut", "--exclude=/.DS_Store", "--exclude=.svn/", !isQt() ? "--exclude=/WebKit.qrc" : "", $sourceInspectorPath, $inspectorResourcesDirPath; + return system "rsync", "-aut", "--exclude=/.DS_Store", "--exclude=*.re2js", "--exclude=.svn/", !isQt() ? "--exclude=/WebKit.qrc" : "", $sourceInspectorPath, $inspectorResourcesDirPath; } sub buildXCodeProject($$@) @@ -1067,6 +1190,8 @@ sub buildVisualStudioProject my $config = configurationForVisualStudio(); + dieIfWindowsPlatformSDKNotInstalled() if $willUseVCExpressWhenBuilding; + chomp(my $winProjectPath = `cygpath -w "$project"`); my $action = "/build"; @@ -1162,7 +1287,7 @@ sub qtMakeCommand($) #print "default spec: " . $mkspec . "\n"; #print "compiler found: " . $compiler . "\n"; - if ($compiler eq "cl") { + if ($compiler && $compiler eq "cl") { return "nmake"; } @@ -1184,7 +1309,7 @@ sub buildAutotoolsProject($@) my $make = 'make'; my $dir = productDir(); my $config = passedConfiguration() || configuration(); - my $prefix = $ENV{"WebKitInstallationPrefix"}; + my $prefix; my @buildArgs = (); my $makeArgs = $ENV{"WebKitMakeArguments"} || ""; @@ -1192,11 +1317,20 @@ sub buildAutotoolsProject($@) my $opt = $buildParams[$i]; if ($opt =~ /^--makeargs=(.*)/i ) { $makeArgs = $makeArgs . " " . $1; + } elsif ($opt =~ /^--prefix=(.*)/i ) { + $prefix = $1; } else { push @buildArgs, $opt; } } + # Automatically determine the number of CPUs for make only + # if make arguments haven't already been specified. + if ($makeArgs eq "") { + $makeArgs = "-j" . numberOfCPUs(); + } + + $prefix = $ENV{"WebKitInstallationPrefix"} if !defined($prefix); push @buildArgs, "--prefix=" . $prefix if defined($prefix); # check if configuration is Debug @@ -1212,31 +1346,29 @@ sub buildAutotoolsProject($@) } if (! -d $dir) { - system "mkdir", "-p", "$dir"; - if (! -d $dir) { - die "Failed to create build directory " . $dir; - } + File::Path::mkpath($dir) or die "Failed to create build directory " . $dir } - chdir $dir or die "Failed to cd into " . $dir . "\n"; - my $result; if ($clean) { - #$result = system $make, "distclean"; return 0; } - print "Calling configure in " . $dir . "\n\n"; - print "Installation directory: $prefix\n" if(defined($prefix)); - - # Make the path relative since it will appear in all -I compiler flags. - # Long argument lists cause bizarre slowdowns in libtool. - my $relSourceDir = File::Spec->abs2rel($sourceDir); - $relSourceDir = "." if !$relSourceDir; - - $result = system "$relSourceDir/autogen.sh", @buildArgs; - if ($result ne 0) { - die "Failed to setup build environment using 'autotools'!\n"; + # If GNUmakefile exists, don't run autogen.sh. The makefile should be + # smart enough to track autotools dependencies and re-run autogen.sh + # when build files change. + my $result; + if (! -e "GNUmakefile") { + print "Calling configure in " . $dir . "\n\n"; + print "Installation prefix directory: $prefix\n" if(defined($prefix)); + + # Make the path relative since it will appear in all -I compiler flags. + # Long argument lists cause bizarre slowdowns in libtool. + my $relSourceDir = File::Spec->abs2rel($sourceDir) || "."; + $result = system "$relSourceDir/autogen.sh", @buildArgs; + if ($result ne 0) { + die "Failed to setup build environment using 'autotools'!\n"; + } } $result = system "$make $makeArgs"; @@ -1256,6 +1388,8 @@ sub buildQMakeProject($@) my $qmakebin = "qmake"; # Allow override of the qmake binary from $PATH my $makeargs = ""; + my $installHeaders; + my $installLibs; for my $i (0 .. $#buildParams) { my $opt = $buildParams[$i]; if ($opt =~ /^--qmake=(.*)/i ) { @@ -1264,6 +1398,10 @@ sub buildQMakeProject($@) push @buildArgs, $1; } elsif ($opt =~ /^--makeargs=(.*)/i ) { $makeargs = $1; + } elsif ($opt =~ /^--install-headers=(.*)/i ) { + $installHeaders = $1; + } elsif ($opt =~ /^--install-libs=(.*)/i ) { + $installLibs = $1; } else { push @buildArgs, $opt; } @@ -1271,7 +1409,8 @@ sub buildQMakeProject($@) my $make = qtMakeCommand($qmakebin); my $config = configuration(); - my $prefix = $ENV{"WebKitInstallationPrefix"}; + push @buildArgs, "INSTALL_HEADERS=" . $installHeaders if defined($installHeaders); + push @buildArgs, "INSTALL_LIBS=" . $installLibs if defined($installLibs); my $dir = File::Spec->canonpath(baseProductDir()); $dir = File::Spec->catfile($dir, $config) unless isSymbian(); File::Path::mkpath($dir); @@ -1323,7 +1462,8 @@ sub buildQMakeProject($@) } print "Calling '$qmakebin @buildArgs' in " . $dir . "\n\n"; - print "Installation directory: $prefix\n" if(defined($prefix)); + print "Installation headers directory: $installHeaders\n" if(defined($installHeaders)); + print "Installation libraries directory: $installLibs\n" if(defined($installLibs)); $result = system "$qmakebin @buildArgs"; if ($result ne 0) { @@ -1364,15 +1504,15 @@ sub buildGtkProject($$@) return buildAutotoolsProject($clean, @buildArgs); } -sub buildChromiumMakefile($$$) +sub buildChromiumMakefile($$) { - my ($dir, $target, $clean) = @_; - chdir $dir; + my ($target, $clean) = @_; if ($clean) { return system qw(rm -rf out); } my $config = configuration(); - my @command = ("make", "-j4", "BUILDTYPE=$config", $target); + my $numCpus = numberOfCPUs(); + my @command = ("make", "-fMakefile.chromium", "-j$numCpus", "BUILDTYPE=$config", $target); print join(" ", @command) . "\n"; return system @command; } @@ -1396,6 +1536,19 @@ sub buildChromiumVisualStudioProject($$) $vsInstallDir = `cygpath "$vsInstallDir"` if isCygwin(); chomp $vsInstallDir; $vcBuildPath = "$vsInstallDir/Common7/IDE/devenv.com"; + if (! -e $vcBuildPath) { + # Visual Studio not found, try VC++ Express + $vcBuildPath = "$vsInstallDir/Common7/IDE/VCExpress.exe"; + if (! -e $vcBuildPath) { + print "*************************************************************\n"; + print "Cannot find '$vcBuildPath'\n"; + print "Please execute the file 'vcvars32.bat' from\n"; + print "'$programFilesPath\\Microsoft Visual Studio 8\\VC\\bin\\'\n"; + print "to setup the necessary environment variables.\n"; + print "*************************************************************\n"; + die; + } + } # Create command line and execute it. my @command = ($vcBuildPath, $projectPath, $action, $config); @@ -1408,16 +1561,19 @@ sub buildChromium($@) { my ($clean, @options) = @_; + # We might need to update DEPS or re-run GYP if things have changed. + system("perl", "WebKitTools/Scripts/update-webkit-chromium") == 0 or die $!; + my $result = 1; if (isDarwin()) { # Mac build - builds the root xcode project. - $result = buildXCodeProject("WebKit/chromium/WebKit", $clean, (@options)); + $result = buildXCodeProject("WebKit/chromium/WebKit", $clean, "-configuration", configuration(), @options); } elsif (isCygwin() || isWindows()) { # Windows build - builds the root visual studio solution. $result = buildChromiumVisualStudioProject("WebKit/chromium/WebKit.sln", $clean); } elsif (isLinux()) { # Linux build - build using make. - $ result = buildChromiumMakefile("WebKit/chromium/", "all", $clean); + $ result = buildChromiumMakefile("all", $clean); } else { print STDERR "This platform is not supported by chromium.\n"; } @@ -1454,7 +1610,7 @@ sub runSafari my ($debugger) = @_; if (isAppleMacWebKit()) { - return system "$FindBin::Bin/gdb-safari", @ARGV if $debugger; + return system "$FindBin::Bin/gdb-safari", argumentsForConfiguration() if $debugger; my $productDir = productDir(); print "Starting Safari with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n"; @@ -1468,17 +1624,97 @@ sub runSafari } if (isAppleWinWebKit()) { - my $script = "run-webkit-nightly.cmd"; - my $result = system "cp", "$FindBin::Bin/$script", productDir(); + my $result; + my $productDir = productDir(); + if ($debugger) { + setupCygwinEnv(); + chomp($ENV{WEBKITNIGHTLY} = `cygpath -wa "$productDir"`); + my $safariPath = safariPath(); + chomp($safariPath = `cygpath -wa "$safariPath"`); + $result = system $vcBuildPath, "/debugexe", "\"$safariPath\"", @ARGV; + } else { + $result = system File::Spec->catfile(productDir(), "WebKit.exe"), @ARGV; + } return $result if $result; + } + + return 1; +} + +sub runMiniBrowser +{ + if (isAppleMacWebKit()) { + my $productDir = productDir(); + print "Starting MiniBrowser with DYLD_FRAMEWORK_PATH set to point to $productDir.\n"; + $ENV{DYLD_FRAMEWORK_PATH} = $productDir; + $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES"; + my $miniBrowserPath = "$productDir/MiniBrowser.app/Contents/MacOS/MiniBrowser"; + if (!isTiger() && architecture()) { + return system "arch", "-" . architecture(), $miniBrowserPath, @ARGV; + } else { + return system $miniBrowserPath, @ARGV; + } + } + + return 1; +} + +sub debugMiniBrowser +{ + if (isAppleMacWebKit()) { + my $gdbPath = "/usr/bin/gdb"; + die "Can't find gdb executable. Is gdb installed?\n" unless -x $gdbPath; + + my $productDir = productDir(); + + $ENV{DYLD_FRAMEWORK_PATH} = $productDir; + $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = 'YES'; + + my $miniBrowserPath = "$productDir/MiniBrowser.app/Contents/MacOS/MiniBrowser"; + + print "Starting MiniBrowser under gdb with DYLD_FRAMEWORK_PATH set to point to built WebKit2 in $productDir.\n"; + my @architectureFlags = ("-arch", architecture()) if !isTiger(); + exec $gdbPath, @architectureFlags, $miniBrowserPath or die; + return; + } + + return 1; +} + +sub runWebKitTestRunner +{ + if (isAppleMacWebKit()) { + my $productDir = productDir(); + print "Starting WebKitTestRunner with DYLD_FRAMEWORK_PATH set to point to $productDir.\n"; + $ENV{DYLD_FRAMEWORK_PATH} = $productDir; + $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES"; + my $webKitTestRunnerPath = "$productDir/WebKitTestRunner"; + if (!isTiger() && architecture()) { + return system "arch", "-" . architecture(), $webKitTestRunnerPath, @ARGV; + } else { + return system $webKitTestRunnerPath, @ARGV; + } + } + + return 1; +} + +sub debugWebKitTestRunner +{ + if (isAppleMacWebKit()) { + my $gdbPath = "/usr/bin/gdb"; + die "Can't find gdb executable. Is gdb installed?\n" unless -x $gdbPath; - my $cwd = getcwd(); - chdir productDir(); + my $productDir = productDir(); + $ENV{DYLD_FRAMEWORK_PATH} = $productDir; + $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = 'YES'; - my $debuggerFlag = $debugger ? "/debugger" : ""; - $result = system "cmd", "/c", "call $script $debuggerFlag"; - chdir $cwd; - return $result; + my $webKitTestRunnerPath = "$productDir/WebKitTestRunner"; + + print "Starting WebKitTestRunner under gdb with DYLD_FRAMEWORK_PATH set to point to $productDir.\n"; + my @architectureFlags = ("-arch", architecture()) if !isTiger(); + exec $gdbPath, @architectureFlags, $webKitTestRunnerPath or die; + return; } return 1; |