+2008-11-26 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Nikolas Zimmermann.
+
+ Pre-work for getting build-webkit --chromium to work
+ https://bugs.webkit.org/show_bug.cgi?id=22515
+ Rename isOSX to isAppleMacWebKit to match what the code does, and add isChromium()
+
+ * Scripts/build-dumprendertree:
+ * Scripts/build-jsc:
+ * Scripts/build-webkit:
+ * Scripts/gdb-safari:
+ * Scripts/run-javascriptcore-tests:
+ * Scripts/run-webkit-tests:
+ * Scripts/webkitdirs.pm:
+
2008-11-26 David Kilzer <ddkilzer@apple.com>
Bug 22488: Make DRT smarter about charset encoding when post-processing webarchive content
# Build
chdir "WebKitTools/DumpRenderTree" or die;
my $result;
-if (isOSX()) {
+if (isAppleMacWebKit()) {
$result = system "xcodebuild", "-project", "DumpRenderTree.xcodeproj", @options, @ARGV;
} elsif (isCygwin()) {
$result = buildVisualStudioProject("DumpRenderTree.sln");
chdir "JavaScriptCore" or die "Can't find JavaScriptCore directory to build from";
my $result;
-if (isOSX()) {
+if (isAppleMacWebKit()) {
$result = system "sh", "-c", 'xcodebuild -project JavaScriptCore.xcodeproj -target jsc "$@" | grep -v setenv && exit ${PIPESTATUS[0]}', "xcodebuild", @options, @ARGV;
} elsif (isCygwin()) {
$result = buildVisualStudioProject("JavaScriptCore.vcproj/JavaScriptCore.sln");
my $xsltSupport = 1;
my $wmlSupport = 0;
my $coverageSupport = 0;
-my $videoSupport = (isOSX() || isCygwin()); # Enable by default on OSX and Windows
-my $workersSupport = (isOSX() || isCygwin() || isGtk()); # Enable by default on OSX, Windows and Gtk+
+my $videoSupport = (isAppleMacWebKit() || isCygwin()); # Enable by default on OSX and Windows
+my $workersSupport = (isAppleMacWebKit() || isCygwin() || isGtk()); # Enable by default on OSX, Windows and Gtk+
my $showHelp = 0;
my $clean = 0;
my $buildUniversal = 0;
my @options = ();
-if ($clean && isOSX()) {
+if ($clean && isAppleMacWebKit()) {
push(@options, "-alltargets");
push(@options, "clean");
}
-if ($buildSixtyFourBit && isOSX()) {
+if ($buildSixtyFourBit && isAppleMacWebKit()) {
my $cpuVendor = `sysctl -n machdep.cpu.vendor`;
chomp $cpuVendor;
} else {
push(@options, "ARCHS=ppc ppc64");
}
-} elsif ($buildUniversal && isOSX()) {
+} elsif ($buildUniversal && isAppleMacWebKit()) {
push(@options, "ARCHS=ppc i386");
}
push @options, autotoolsFlag($coverageSupport, "coverage");
}
-if (isOSX()) {
+if (isAppleMacWebKit()) {
push(@options, XcodeOptions());
chdir $dir or die;
my $result = 0;
- if (isGtk()) {
- if ($dir ne "WebKit") {
- chdir ".." or die;
- next;
- }
+ # For Gtk and Qt the WebKit project builds all others
+ if ((isGtk() || isQt()) && $dir ne "WebKit") {
+ chdir ".." or die;
+ next;
+ }
+ if (isGtk()) {
$result = buildGtkProject($dir, $clean, @options);
} elsif (isQt()) {
- if ($dir ne "WebKit") {
- chdir ".." or die;
- next;
- }
$result = buildQMakeQtProject($dir, $clean, @ARGV);
- } elsif (isOSX()) {
+ } elsif (isAppleMacWebKit()) {
$result = system "xcodebuild", "-project", "$dir.xcodeproj", @options, $overrideFeatureDefinesString, @coverageSupportOption, @ARGV;
} elsif (isCygwin()) {
if ($dir eq "WebKit") {
print $fh "set env DYLD_FRAMEWORK_PATH $productDir\n";
print $fh "set env WEBKIT_UNSET_DYLD_FRAMEWORK_PATH YES\n";
-my @architectureFlags = ("-arch", preferredArchitecture()) if isOSX();
+my @architectureFlags = ("-arch", preferredArchitecture()) if isAppleMacWebKit();
# Start up Safari.
print "Start Safari under gdb with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
exec $gdbPath, "-x", $path, @architectureFlags, $safariPath or die;
setConfigurationProductDir(Cwd::abs_path($root)) if (defined($root));
-if (isOSX() && !isTiger()) {
+if (isAppleMacWebKit() && !isTiger()) {
my $preferredArch = preferredArchitecture("JavaScriptCore");
setRun64Bit($run64Bit);
my $arch = preferredArchitecture("JavaScriptCore");
push(@xcodeArgs, "--wx") if isWx();
my $arch = preferredArchitecture("JavaScriptCore");
- push(@xcodeArgs, "ARCHS=$arch") if (isOSX());
+ push(@xcodeArgs, "ARCHS=$arch") if (isAppleMacWebKit());
my $buildResult = system "perl", "WebKitTools/Scripts/build-jsc", @xcodeArgs;
if ($buildResult) {
} elsif (isSnowLeopard()) {
$platform = "mac-snowleopard";
$tolerance = 0.1;
-} elsif (isOSX()) {
+} elsif (isAppleMacWebKit()) {
$platform = "mac";
} elsif (isQt()) {
$platform = "qt";
push(@args, "--qt") if isQt();
push(@args, "--gtk") if isGtk();
- if (isOSX()) {
+ if (isAppleMacWebKit()) {
my $arch = preferredArchitecture();
push(@args, "ARCHS=$arch");
}
close EXPECTED;
}
my $expectedMac;
- if (!isOSX() && $strictTesting && !$isText) {
+ if (!isAppleMacWebKit() && $strictTesting && !$isText) {
if (!$resetResults && open EXPECTED, "<", "$testDirectory/platform/mac/$expectedFileName") {
$expectedMac = "";
while (<EXPECTED>) {
}
}
- if (!isOSX() && $strictTesting && !$isText) {
+ if (!isAppleMacWebKit() && $strictTesting && !$isText) {
if (defined $expectedMac) {
my $simplified_actual;
$simplified_actual = $actual;
my @args = @toolArgs;
unshift @args, $dumpTool;
- if (isOSX and !isTiger()) {
+ if (isAppleMacWebKit and !isTiger()) {
unshift @args, "arch";
}
if ($useValgrind) {
return 1 if ($pid == $dumpToolPID);
# On Mac OS X, crashing may be significantly delayed by crash reporter.
- return 0 unless isOSX();
+ return 0 unless isAppleMacWebKit();
my $tryingToExit = 0;
open PS, "ps -o state -p $dumpToolPID |";
sub sampleDumpTool()
{
- return unless isOSX();
+ return unless isAppleMacWebKit();
return unless $runSample;
my $outputDirectory = "$ENV{HOME}/Library/Logs/DumpRenderTree";
my $isQt;
my $isGtk;
my $isWx;
+my $isChromium;
my $forceRun64Bit;
# Variables for Win32 support
{
return if defined $baseProductDir;
determineSourceDir();
- if (isOSX()) {
+ if (isAppleMacWebKit()) {
open PRODUCT, "defaults read com.apple.Xcode PBXApplicationwideBuildSettings 2> /dev/null |" or die;
$baseProductDir = join '', <PRODUCT>;
close PRODUCT;
}
}
- if ($baseProductDir && isOSX()) {
+ if ($baseProductDir && isAppleMacWebKit()) {
$baseProductDir =~ s|^\Q$(SRCROOT)/..\E$|$sourceDir|;
$baseProductDir =~ s|^\Q$(SRCROOT)/../|$sourceDir/|;
$baseProductDir =~ s|^~/|$ENV{HOME}/|;
$baseProductDir = "$baseProductDir/$branch";
}
- @baseProductDirOption = ("SYMROOT=$baseProductDir", "OBJROOT=$baseProductDir") if (isOSX());
+ @baseProductDirOption = ("SYMROOT=$baseProductDir", "OBJROOT=$baseProductDir") if (isAppleMacWebKit());
if (isCygwin()) {
my $dosBuildPath = `cygpath --windows \"$baseProductDir\"`;
chomp $dosBuildPath;
{
my ($safariBundle) = @_;
- return "$safariBundle/Contents/MacOS/Safari" if isOSX();
+ return "$safariBundle/Contents/MacOS/Safari" if isAppleMacWebKit();
return $safariBundle if isCygwin();
}
{
my $safariBundle;
- if (isOSX()) {
+ if (isAppleMacWebKit()) {
$safariBundle = "/Applications/Safari.app";
} elsif (isCygwin()) {
$safariBundle = `"$configurationProductDir/FindSafari.exe"`;
if (!$safariBundle) {
determineConfigurationProductDir();
# Use Safari.app in product directory if present (good for Safari development team).
- if (isOSX() && -d "$configurationProductDir/Safari.app") {
+ if (isAppleMacWebKit() && -d "$configurationProductDir/Safari.app") {
$safariBundle = "$configurationProductDir/Safari.app";
} elsif (isCygwin() && -x "$configurationProductDir/bin/Safari.exe") {
$safariBundle = "$configurationProductDir/bin/Safari.exe";
}
}
my $safariPath = safariPathFromSafariBundle($safariBundle);
- die "Can't find executable at $safariPath.\n" if isOSX() && !-x $safariPath;
+ die "Can't find executable at $safariPath.\n" if isAppleMacWebKit() && !-x $safariPath;
return $safariPath;
}
if (isQt() or isGtk()) {
return "$configurationProductDir/$framework";
}
- if (isOSX()) {
+ if (isAppleMacWebKit()) {
return "$configurationProductDir/$framework.framework/Versions/A/$framework";
}
if (isCygwin()) {
{
return if isCygwin();
my @frameworks = ("JavaScriptCore", "WebCore");
- push(@frameworks, "WebKit") if isOSX();
+ push(@frameworks, "WebKit") if isAppleMacWebKit();
for my $framework (@frameworks) {
my $path = builtDylibPathForName($framework);
die "Can't find built framework at \"$path\".\n" unless -x $path;
return -e "/etc/debian_version";
}
+sub isChromium()
+{
+ determineIsChromium();
+ return $isChromium;
+}
+
+sub determineIsChromium()
+{
+ return if defined($isChromium);
+
+ if (checkArgv("--chromium")) {
+ $isChromium = 1;
+ } else {
+ $isChromium = 0;
+ }
+}
+
sub isCygwin()
{
return ($^O eq "cygwin") || 0;
return ($^O eq "darwin") || 0;
}
-# isOSX() only returns true for Apple's port, not for other ports that can be
-# built/run on OS X.
-sub isOSX()
+# isAppleMacWebKit() only returns true for Apple's port,
+# not for other ports that can be built/run on OS X.
+sub isAppleMacWebKit()
{
- return isDarwin() unless (isQt() or isGtk() or isWx());
- return 0;
+ return isDarwin() and !(isQt() or isGtk() or isWx() or isChromium());
+}
+
+# isAppleWinWebKit() only returns true for Apple's port,
+# not for other ports that can be built/run on Windows
+sub isAppleWinWebKit()
+{
+ return isCygwin() and !(isQt() or isGtk() or isWx() or isChromium());
}
sub determineOSXVersion()
{
return if $osXVersion;
- if (!isOSX()) {
+ if (!isAppleMacWebKit()) {
$osXVersion = -1;
return;
}
sub isTiger()
{
- return isOSX() && osXVersion()->{"minor"} == 4;
+ return isAppleMacWebKit() && osXVersion()->{"minor"} == 4;
}
sub isLeopard()
{
- return isOSX() && osXVersion()->{"minor"} == 5;
+ return isAppleMacWebKit() && osXVersion()->{"minor"} == 5;
}
sub isSnowLeopard()
{
- return isOSX() && osXVersion()->{"minor"} == 6;
+ return isAppleMacWebKit() && osXVersion()->{"minor"} == 6;
}
sub relativeScriptsDir()
my $relativeScriptsPath = relativeScriptsDir();
if (isGtk() || isQt()) {
return "$relativeScriptsPath/run-launcher";
- } elsif (isOSX() || isCygwin()) {
+ } elsif (isAppleMacWebKit() || isCygwin()) {
return "$relativeScriptsPath/run-safari";
}
}
return "GtkLauncher";
} elsif (isQt()) {
return "QtLauncher";
- } elsif (isOSX() || isCygwin()) {
+ } elsif (isAppleMacWebKit() || isCygwin()) {
return "Safari";
}
}
sub checkRequiredSystemConfig
{
- if (isOSX()) {
+ if (isAppleMacWebKit()) {
chomp(my $productVersion = `sw_vers -productVersion`);
if ($productVersion lt "10.4") {
print "*************************************************************\n";
{
my ($debugger) = @_;
- if (isOSX()) {
+ if (isAppleMacWebKit()) {
return system "$FindBin::Bin/gdb-safari", @ARGV if $debugger;
my $productDir = productDir();
sub preferredArchitecture
{
- return unless isOSX();
+ return unless isAppleMacWebKit();
my $framework = shift;
$framework = "WebKit" if !defined($framework);
sub exportArchPreference
{
- $ENV{ARCHPREFERENCE} = preferredArchitecture() if isOSX();
+ $ENV{ARCHPREFERENCE} = preferredArchitecture() if isAppleMacWebKit();
}
1;