⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webkitdirs.pm

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻 PM
📖 第 1 页 / 共 3 页
字号:
        if (@missing) {            my $list = join ", ", @missing;            die "ERROR: $list missing but required to build WebKit.\n";        }    }    # Win32 and other platforms may want to check for minimum config}sub setupCygwinEnv(){    return if !isCygwin();    return if $vcBuildPath;    my $programFilesPath = `cygpath "$ENV{'PROGRAMFILES'}"`;    chomp $programFilesPath;    $vcBuildPath = "$programFilesPath/Microsoft Visual Studio 8/Common7/IDE/devenv.com";    if (! -e $vcBuildPath) {        # VC++ not found, try VC++ Express        my $vsInstallDir;        if ($ENV{'VSINSTALLDIR'}) {            $vsInstallDir = $ENV{'VSINSTALLDIR'};        } else {            $programFilesPath = $ENV{'PROGRAMFILES'} || "C:\\Program Files";            $vsInstallDir = "$programFilesPath/Microsoft Visual Studio 8";        }        $vsInstallDir = `cygpath "$vsInstallDir"`;        chomp $vsInstallDir;        $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;        }    }    my $qtSDKPath = "$programFilesPath/QuickTime SDK";    if (0 && ! -e $qtSDKPath) {        print "*************************************************************\n";        print "Cannot find '$qtSDKPath'\n";        print "Please download the QuickTime SDK for Windows from\n";        print "http://developer.apple.com/quicktime/download/\n";        print "*************************************************************\n";        die;    }        chomp($ENV{'WEBKITLIBRARIESDIR'} = `cygpath -wa "$sourceDir/WebKitLibraries/win"`) unless $ENV{'WEBKITLIBRARIESDIR'};    $windowsTmpPath = `cygpath -w /tmp`;    chomp $windowsTmpPath;    print "Building results into: ", baseProductDir(), "\n";    print "WEBKITOUTPUTDIR is set to: ", $ENV{"WEBKITOUTPUTDIR"}, "\n";    print "WEBKITLIBRARIESDIR is set to: ", $ENV{"WEBKITLIBRARIESDIR"}, "\n";}sub buildXCodeProject($$@){    my ($project, $clean, @extraOptions) = @_;    if ($clean) {        push(@extraOptions, "-alltargets");        push(@extraOptions, "clean");    }    return system "xcodebuild", "-project", "$project.xcodeproj", @extraOptions;}sub buildVisualStudioProject{    my ($project, $clean) = @_;    setupCygwinEnv();    my $config = configurationForVisualStudio();    chomp(my $winProjectPath = `cygpath -w "$project"`);        my $command = "/build";    if ($clean) {        $command = "/clean";    }    print "$vcBuildPath $winProjectPath /build $config\n";    return system $vcBuildPath, $winProjectPath, $command, $config;}sub buildSconsProject{    my ($project, $shouldClean) = @_;    print "Building from $project/$project.scons\n";    my $sconsCommand = "scons";    if (isCygwin()) {        # HACK: Launch scons with Win32 python instead of CYGWIN python        # Scons + MSVC only works under Win32 python        # http://scons.tigris.org/issues/show_bug.cgi?id=2266        $sconsCommand = "cmd /c 'C:\\Python26\\Scripts\\scons'";    }    if ($shouldClean) {        return system $sconsCommand, "--clean";    }    return system $sconsCommand;}sub retrieveQMakespecVar{    my $mkspec = $_[0];    my $varname = $_[1];    my $compiler = "unknown";    #print "retrieveMakespecVar " . $mkspec . ", " . $varname . "\n";    local *SPEC;    open SPEC, "<$mkspec" or return "make";    while (<SPEC>) {        if ($_ =~ /\s*include\((.+)\)/) {            # open the included mkspec            my $oldcwd = getcwd();            (my $volume, my $directories, my $file) = File::Spec->splitpath($mkspec);            chdir "$volume$directories";            $compiler = retrieveQMakespecVar($1, $varname);            chdir $oldcwd;        } elsif ($_ =~ /$varname\s*=\s*([^\s]+)/) {            $compiler = $1;            last;        }    }    close SPEC;    return $compiler;}sub qtMakeCommand($){    my ($qmakebin) = @_;    chomp(my $mkspec = `$qmakebin -query QMAKE_MKSPECS`);    $mkspec .= "/default";    my $compiler = retrieveQMakespecVar("$mkspec/qmake.conf", "QMAKE_CC");    #print "default spec: " . $mkspec . "\n";    #print "compiler found: " . $compiler . "\n";    if ($compiler eq "cl") {        return "nmake";    }    return "make";}sub autotoolsFlag($$){    my ($flag, $feature) = @_;    my $prefix = $flag ? "--enable" : "--disable";    return $prefix . '-' . $feature;}sub buildAutotoolsProject($@){    my ($clean, @buildArgs) = @_;    my $make = 'make';    my $dir = productDir();    my $config = passedConfiguration() || configuration();    my $prefix = $ENV{"WebKitInstallationPrefix"};    push @buildArgs, "--prefix=" . $prefix if defined($prefix);    # check if configuration is Debug    if ($config =~ m/debug/i) {        push @buildArgs, "--enable-debug";    } else {        push @buildArgs, "--disable-debug";    }    # Use rm to clean the build directory since distclean may miss files    if ($clean && -d $dir) {        system "rm", "-rf", "$dir";    }    if (! -d $dir) {        system "mkdir", "-p", "$dir";        if (! -d $dir) {            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";    }    my $makeArgs = $ENV{"WebKitMakeArguments"} || "";    $result = system "$make $makeArgs";    if ($result ne 0) {        die "\nFailed to build WebKit using '$make'!\n";    }    chdir ".." or die;    return $result;}sub buildQMakeProject($@){    my ($clean, @buildParams) = @_;    my @buildArgs = ("-r");    push @buildArgs, "DEFINES+=QT_SHARED";    my $qmakebin = "qmake"; # Allow override of the qmake binary from $PATH    my $makeargs = "";    for my $i (0 .. $#buildParams) {        my $opt = $buildParams[$i];        if ($opt =~ /^--qmake=(.*)/i ) {            $qmakebin = $1;        } elsif ($opt =~ /^--qmakearg=(.*)/i ) {            push @buildArgs, $1;        } elsif ($opt =~ /^--makeargs=(.*)/i ) {            $makeargs = $1;        } else {            push @buildArgs, $opt;        }    }    my $make = qtMakeCommand($qmakebin);    my $config = configuration();    my $prefix = $ENV{"WebKitInstallationPrefix"};    push @buildArgs, "OUTPUT_DIR=" . baseProductDir() . "/$config";    push @buildArgs, sourceDir() . "/WebKit.pro";    if ($config =~ m/debug/i) {        push @buildArgs, "CONFIG-=release";        push @buildArgs, "CONFIG+=debug";    } else {        push @buildArgs, "CONFIG+=release";        push @buildArgs, "CONFIG-=debug";    }    my $dir = baseProductDir();    if (! -d $dir) {        system "mkdir", "-p", "$dir";        if (! -d $dir) {            die "Failed to create product directory " . $dir;        }    }    $dir = $dir . "/$config";    if (! -d $dir) {        system "mkdir", "-p", "$dir";        if (! -d $dir) {            die "Failed to create build directory " . $dir;        }    }    chdir $dir or die "Failed to cd into " . $dir . "\n";    print "Calling '$qmakebin @buildArgs' in " . $dir . "\n\n";    print "Installation directory: $prefix\n" if(defined($prefix));    my $result = system $qmakebin, @buildArgs;    if ($result ne 0) {       die "Failed to setup build environment using $qmakebin!\n";    }    if ($clean) {      $result = system "$make $makeargs distclean";    } else {      $result = system "$make $makeargs";    }    chdir ".." or die;    return $result;}sub buildQMakeQtProject($$@){    my ($project, $clean, @buildArgs) = @_;    push @buildArgs, "CONFIG+=qt-port";    return buildQMakeProject($clean, @buildArgs);}sub buildGtkProject($$@){    my ($project, $clean, @buildArgs) = @_;    if ($project ne "WebKit") {        die "The Gtk port builds JavaScriptCore, WebCore and WebKit in one shot! Only call it for 'WebKit'.\n";    }    return buildAutotoolsProject($clean, @buildArgs);}sub setPathForRunningWebKitApp{    my ($env) = @_;    return unless isAppleWinWebKit();    $env->{PATH} = join(':', productDir(), dirname(installedSafariPath()), $env->{PATH} || "");}sub exitStatus($){    my ($returnvalue) = @_;    if ($^O eq "MSWin32") {        return $returnvalue >> 8;    }    return WEXITSTATUS($returnvalue);}sub runSafari{    my ($debugger) = @_;    if (isAppleMacWebKit()) {        return system "$FindBin::Bin/gdb-safari", @ARGV if $debugger;        my $productDir = productDir();        print "Starting Safari 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";        exportArchPreference();        if (!isTiger()) {            return system "arch", safariPath(), @ARGV;        } else {            return system safariPath(), @ARGV;        }    }    if (isAppleWinWebKit()) {        my $script = "run-webkit-nightly.cmd";        my $result = system "cp", "$FindBin::Bin/$script", productDir();        return $result if $result;        my $cwd = getcwd();        chdir productDir();        my $debuggerFlag = $debugger ? "/debugger" : "";        $result = system "cmd", "/c", "call $script $debuggerFlag";        chdir $cwd;        return $result;    }    return 1;}sub setRun64Bit($){    ($forceRun64Bit) = @_;}sub preferredArchitecture{    return unless isAppleMacWebKit();        my $framework = shift;    $framework = "WebKit" if !defined($framework);    my $currentArchitecture = `arch`;    chomp($currentArchitecture);    my $run64Bit = 0;    if (!defined($forceRun64Bit)) {        my $frameworkPath = builtDylibPathForName($framework);        die "Couldn't find path for $framework" if !defined($frameworkPath);        # The binary is 64-bit if one of the architectures it contains has "64" in the name        $run64Bit = `lipo -info "$frameworkPath"` =~ /(are|architecture):.*64/;    }    if ($forceRun64Bit or $run64Bit) {        return ($currentArchitecture eq "i386") ? "x86_64" : "ppc64";    }    return $currentArchitecture;}sub exportArchPreference{    $ENV{ARCHPREFERENCE} = preferredArchitecture() if isAppleMacWebKit();}1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -