diff options
Diffstat (limited to 'Tools/Scripts/webkitdirs.pm')
-rwxr-xr-x | Tools/Scripts/webkitdirs.pm | 67 |
1 files changed, 59 insertions, 8 deletions
diff --git a/Tools/Scripts/webkitdirs.pm b/Tools/Scripts/webkitdirs.pm index 203853b94..6d5d9984f 100755 --- a/Tools/Scripts/webkitdirs.pm +++ b/Tools/Scripts/webkitdirs.pm @@ -103,6 +103,7 @@ my $forceChromiumUpdate; my $isInspectorFrontend; my $isWK2; my $shouldTargetWebProcess; +my $shouldUseGuardMalloc; my $xcodeVersion; # Variables for Win32 support @@ -301,10 +302,6 @@ sub determineArchitecture if ($host_triple =~ m/^host = ([^-]+)-/) { # We have a configured build tree; use it. $architecture = $1; - } else { - # Fall back to output of `arch', if it is present. - $architecture = `arch`; - chomp $architecture; } } elsif (isAppleMacWebKit()) { if (open ARCHITECTURE, "$baseProductDir/Architecture") { @@ -316,9 +313,22 @@ sub determineArchitecture } else { my $supports64Bit = `sysctl -n hw.optional.x86_64`; chomp $supports64Bit; - $architecture = $supports64Bit ? 'x86_64' : `arch`; - chomp $architecture; + $architecture = 'x86_64' if $supports64Bit; } + } elsif (isEfl()) { + my $host_processor = ""; + $host_processor = `cmake --system-information | grep CMAKE_SYSTEM_PROCESSOR`; + if ($host_processor =~ m/^CMAKE_SYSTEM_PROCESSOR \"([^"]+)\"/) { + # We have a configured build tree; use it. + $architecture = $1; + $architecture = 'x86_64' if $architecture eq 'amd64'; + } + } + + if (!$architecture && (isGtk() || isAppleMacWebKit() || isEfl())) { + # Fall back to output of `arch', if it is present. + $architecture = `arch`; + chomp $architecture; } } @@ -1383,6 +1393,32 @@ sub determineShouldTargetWebProcess $shouldTargetWebProcess = checkForArgumentAndRemoveFromARGV("--target-web-process"); } +sub appendToEnvironmentVariableList +{ + my ($environmentVariableName, $value) = @_; + + if (defined($ENV{$environmentVariableName})) { + $ENV{$environmentVariableName} .= ":" . $value; + } else { + $ENV{$environmentVariableName} = $value; + } +} + +sub setUpGuardMallocIfNeeded +{ + if (!isDarwin()) { + return; + } + + if (!defined($shouldUseGuardMalloc)) { + $shouldUseGuardMalloc = checkForArgumentAndRemoveFromARGV("--guard-malloc"); + } + + if ($shouldUseGuardMalloc) { + appendToEnvironmentVariableList("DYLD_INSERT_LIBRARIES", "/usr/lib/libgmalloc.dylib"); + } +} + sub relativeScriptsDir() { my $scriptDir = File::Spec->catpath("", File::Spec->abs2rel($FindBin::Bin, getcwd()), ""); @@ -1833,7 +1869,7 @@ sub runAutogenForAutotoolsProjectIfNecessary($@) # used on Chromium build. determineArchitecture(); if ($architecture ne "x86_64" && !isARM()) { - $ENV{'CXXFLAGS'} = "-march=pentium4 -msse2 -mfpmath=sse"; + $ENV{'CXXFLAGS'} = "-march=pentium4 -msse2 -mfpmath=sse " . $ENV{'CXXFLAGS'}; } # Prefix the command with jhbuild run. @@ -2053,6 +2089,13 @@ sub generateBuildSystemFromCMakeProject push @args, '"' . sourceDir() . '"'; + # Compiler options to keep floating point values consistent + # between 32-bit and 64-bit architectures. + determineArchitecture(); + if ($architecture ne "x86_64" && !isARM()) { + $ENV{'CXXFLAGS'} = "-march=pentium4 -msse2 -mfpmath=sse " . $ENV{'CXXFLAGS'}; + } + # We call system("cmake @args") instead of system("cmake", @args) so that @args is # parsed for shell metacharacters. my $wrapper = jhbuildWrapperPrefixIfNeeded() . " "; @@ -2484,6 +2527,7 @@ sub printHelpAndExitForRunAndDebugWebKitAppIfNeeded() Usage: @{[basename($0)]} [options] [args ...] --help Show this help message --no-saved-state Disable application resume for the session on Mac OS 10.7 + --guard-malloc Enable Guard Malloc (Mac OS X only) EOF exit(1); } @@ -2502,6 +2546,9 @@ sub runMacWebKitApp($;$) print "Starting @{[basename($appPath)]} with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n"; $ENV{DYLD_FRAMEWORK_PATH} = $productDir; $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES"; + + setUpGuardMallocIfNeeded(); + if (defined($useOpenCommand) && $useOpenCommand == USE_OPEN_COMMAND) { return system("open", "-W", "-a", $appPath, "--args", argumentsForRunAndDebugMacWebKitApp()); } @@ -2521,6 +2568,9 @@ sub execMacWebKitAppForDebugging($) my $productDir = productDir(); $ENV{DYLD_FRAMEWORK_PATH} = $productDir; $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES"; + + setUpGuardMallocIfNeeded(); + my @architectureFlags = ("-arch", architecture()); if (!shouldTargetWebProcess()) { print "Starting @{[basename($appPath)]} under gdb with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n"; @@ -2529,7 +2579,8 @@ sub execMacWebKitAppForDebugging($) my $webProcessShimPath = File::Spec->catfile($productDir, "WebProcessShim.dylib"); my $webProcessPath = File::Spec->catdir($productDir, "WebProcess.app"); my $webKit2ExecutablePath = File::Spec->catfile($productDir, "WebKit2.framework", "WebKit2"); - $ENV{DYLD_INSERT_LIBRARIES} = $webProcessShimPath; + + appendToEnvironmentVariableList("DYLD_INSERT_LIBRARIES", $webProcessShimPath); print "Starting WebProcess under gdb with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n"; exec { $gdbPath } $gdbPath, @architectureFlags, "--args", $webProcessPath, $webKit2ExecutablePath, "-type", "webprocess", "-client-executable", $appPath or die; |