Changeset 182089 in webkit


Ignore:
Timestamp:
Mar 27, 2015, 4:08:01 PM (11 years ago)
Author:
mmaxfield@apple.com
Message:

Support building WTF on Windows without Cygwin
https://bugs.webkit.org/show_bug.cgi?id=143084

Reviewed by Brent Fulgham.

Tools:
Windows without Cygwin doesn't have curl, unzip, or grep. Luckily, Perl does all of these things.
This patch also migrates to using File::Spec->catfile() for directory separators.

  • Scripts/update-webkit-dependency:

(wanted):

  • Scripts/update-webkit-support-libs:

(wanted):
(downloadExpectedVersionNumber):
(zipFileVersion):
(toUnixPath): Deleted.

  • Scripts/webkitdirs.pm:

(determineSourceDir):
(windowsSourceSourceDir):
(windowsLibrariesDir):
(windowsOutputDir):
(checkInstalledTools):
(buildVisualStudioProject):

Source/WTF:
Windows doesn't have "touch".

  • WTF.vcxproj/WTFGenerated.make:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r182032 r182089  
     12015-03-27  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Support building WTF on Windows without Cygwin
     4        https://bugs.webkit.org/show_bug.cgi?id=143084
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Windows doesn't have "touch".
     9
     10        * WTF.vcxproj/WTFGenerated.make:
     11
    1122015-03-26  Alex Christensen  <achristensen@webkit.org>
    213
  • trunk/Source/WTF/WTF.vcxproj/WTFGenerated.make

    r180676 r182089  
    11all: WTFHeaderDetection.h
    2     @touch "%ConfigurationBuildDir%\buildfailed"
     2    @type NUL > "%ConfigurationBuildDir%\buildfailed"
    33    @perl build-generated-files.pl "%ConfigurationBuildDir%" "$(WEBKIT_LIBRARIES)" "$(DEBUGSUFFIX)" "%PlatformArchitecture%"
    44!IF "$(OFFICIAL_BUILD)"!="1"
  • trunk/Tools/ChangeLog

    r182065 r182089  
     12015-03-27  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Support building WTF on Windows without Cygwin
     4        https://bugs.webkit.org/show_bug.cgi?id=143084
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Windows without Cygwin doesn't have curl, unzip, or grep. Luckily, Perl does all of these things.
     9        This patch also migrates to using File::Spec->catfile() for directory separators.
     10
     11        * Scripts/update-webkit-dependency:
     12        (wanted):
     13        * Scripts/update-webkit-support-libs:
     14        (wanted):
     15        (downloadExpectedVersionNumber):
     16        (zipFileVersion):
     17        (toUnixPath): Deleted.
     18        * Scripts/webkitdirs.pm:
     19        (determineSourceDir):
     20        (windowsSourceSourceDir):
     21        (windowsLibrariesDir):
     22        (windowsOutputDir):
     23        (checkInstalledTools):
     24        (buildVisualStudioProject):
     25
    1262015-03-27  Alex Christensen  <achristensen@webkit.org>
    227
  • trunk/Tools/Scripts/update-webkit-dependency

    r181982 r182089  
    7171my $file = getLibraryName($libsURL);
    7272my $zipFile = "$file.zip";
    73 my $webkitLibrariesDir = $ENV{'WEBKIT_LIBRARIES'} || "$sourceDir/WebKitLibraries/win";
     73my $webkitLibrariesDir = $ENV{'WEBKIT_LIBRARIES'} || File::Spec->catdir($sourceDir, "WebKitLibraries", "win");
    7474my $tmpRelativeDir = File::Temp::tempdir("webkitlibsXXXXXXX", TMPDIR => 1, CLEANUP => 1);
    7575my $tmpAbsDir = File::Spec->rel2abs($tmpRelativeDir);
     
    8181if (defined $modified_time) {
    8282
    83     open NEW, ">", "$tmpAbsDir/$file.headers";
     83    open NEW, ">", File::Spec->catfile($tmpAbsDir, "$file.headers");
    8484    print NEW "Last-Modified: " . time2str($modified_time) . "\n";
    8585    close NEW;
     
    9292    $headerURL =~ s/\.zip$/\.headers/;
    9393
    94     my $result = getstore($headerURL, "$tmpAbsDir/$file.headers");
     94    my $result = getstore($headerURL, File::Spec->catfile($tmpAbsDir, "$file.headers"));
    9595
    9696    if (!is_success($result)) {
     
    9999        print STDERR "You may have to run \$ cpan LWP::Protocol::https\n";
    100100
    101         if (! -f "$webkitLibrariesDir/$file.headers") {
     101        if (! -f File::Spec->catfile($webkitLibrariesDir, "$file.headers")) {
    102102            print STDERR "Unable to check Last-Modified date and no version of $file to fall back to.\n";
    103103            exit 1;
     
    109109}
    110110
    111 if (open NEW, "$tmpAbsDir/$file.headers") {
     111if (open NEW, File::Spec->catfile($tmpAbsDir, "$file.headers")) {
    112112    my $new = lastModifiedToUnixTime(<NEW>);
    113113    close NEW;
    114114
    115     if (defined $new && open OLD, "$webkitLibrariesDir/$file.headers") {
     115    if (defined $new && open OLD, File::Spec->catfile($webkitLibrariesDir, "$file.headers")) {
    116116        my $old = lastModifiedToUnixTime(<OLD>);
    117117        close OLD;
     
    125125print "Downloading $zipFile...\n\n";
    126126print "$libsURL\n";
    127 my $result = getstore($libsURL, "$tmpAbsDir/$zipFile");
     127my $result = getstore($libsURL, File::Spec->catfile($tmpAbsDir, $zipFile));
    128128die "Couldn't download $zipFile!" if is_error($result);
    129129
    130 my $zip = Archive::Zip->new("$tmpAbsDir/$zipFile");
     130my $zip = Archive::Zip->new(File::Spec->catfile($tmpAbsDir, $zipFile));
    131131$result = $zip->extractTree("", $tmpAbsDir);
    132132die "Couldn't unzip $zipFile." if $result != AZ_OK;
     
    136136sub wanted
    137137{
    138     my $relativeName = File::Spec->abs2rel($File::Find::name, "$tmpAbsDir/$file/$prefixInZip");
    139     my $destination = "$webkitLibrariesDir/$relativeName";
     138    my $relativeName = File::Spec->abs2rel($File::Find::name, File::Spec->catdir($tmpAbsDir, $file, $prefixInZip));
     139    my $destination = File::Spec->catfile($webkitLibrariesDir, $relativeName);
    140140
    141141    if (-d $_) {
     
    147147}
    148148
    149 File::Find::find(\&wanted, "$tmpAbsDir/$file");
     149File::Find::find(\&wanted, File::Spec->catfile($tmpAbsDir, $file));
    150150
    151 $result = move("$tmpAbsDir/$file.headers", $webkitLibrariesDir);
     151$result = move(File::Spec->catfile($tmpAbsDir, "$file.headers"), $webkitLibrariesDir);
    152152print STDERR "Couldn't move $file.headers to $webkitLibrariesDir" . ".\n" if $result == 0;
    153153
  • trunk/Tools/Scripts/update-webkit-support-libs

    r165676 r182089  
    3333use warnings;
    3434
     35use Archive::Zip qw( :ERROR_CODES );
     36use File::Copy;
    3537use File::Find;
    3638use File::Temp ();
     
    3840use FindBin;
    3941use lib $FindBin::Bin;
     42use LWP::Simple;
    4043use webkitdirs;
    4144
     
    4548my $file = "WebKitSupportLibrary";
    4649my $zipFile = "$file.zip";
    47 my $zipDirectory = toUnixPath($ENV{'WEBKITSUPPORTLIBRARIESZIPDIR'}) || $sourceDir;
     50my $zipDirectory = $ENV{'WEBKITSUPPORTLIBRARIESZIPDIR'} || $sourceDir;
    4851my $pathToZip = File::Spec->catfile($zipDirectory, $zipFile);
    49 my $webkitLibrariesDir = toUnixPath($ENV{'WEBKIT_LIBRARIES'}) || "$sourceDir/WebKitLibraries/win";
     52my $webkitLibrariesDir = $ENV{'WEBKIT_LIBRARIES'} || File::Spec->catdir($sourceDir, "WebKitLibraries", "win");
    5053my $versionFile = $file . "Version";
    5154my $pathToVersionFile = File::Spec->catfile($webkitLibrariesDir, $versionFile);
     
    7275}
    7376
    74 my $result = system "unzip", "-q", "-d", $tmpAbsDir, $pathToZip;
    75 die "Couldn't unzip $zipFile." if $result;
     77my $zip = Archive::Zip->new($pathToZip);
     78my $result = $zip->extractTree("", $tmpAbsDir);
     79die "Couldn't unzip $zipFile." if $result != AZ_OK;
    7680
    7781print "\nInstalling $file...\n";
     
    7983sub wanted
    8084{
    81     my $relativeName = File::Spec->abs2rel($File::Find::name, "$tmpAbsDir/$file/win");
    82     my $destination = "$webkitLibrariesDir/$relativeName";
     85    my $relativeName = File::Spec->abs2rel($File::Find::name, File::Spec->catdir($tmpAbsDir, "$file", "win"));
     86    my $destination = File::Spec->catfile($webkitLibrariesDir, $relativeName);
    8387
    8488    if (-d $_) {
     
    8791    }
    8892
    89     system "cp", $_, $destination;
     93    copy($_, $destination);
    9094}
    9195
    92 File::Find::find(\&wanted, "$tmpAbsDir/$file");
     96File::Find::find(\&wanted, File::Spec->catfile($tmpAbsDir, $file));
    9397
    9498print "The $file has been sucessfully installed in\n $webkitLibrariesDir\n";
    9599exit;
    96 
    97 sub toUnixPath
    98 {
    99     my $path = shift;
    100     return unless $path;
    101     chomp($path = `cygpath -u '$path'`);
    102     return $path;
    103 }
    104100
    105101sub extractedVersion
     
    115111sub downloadExpectedVersionNumber
    116112{
    117     chomp(my $expectedVersion = `curl -s --sslv3 -k $versionFileURL`);
    118     return WEXITSTATUS($?) ? NOTAVERSION : $expectedVersion;
     113    chomp(my $expectedVersion = get($versionFileURL));
     114    return defined $expectedVersion ? $expectedVersion : NOTAVERSION;
    119115}
    120116
     
    122118{
    123119    return NOTAVERSION unless -f $pathToZip;
    124     chomp(my $zipFileVersion = `unzip -p "$pathToZip" $file/win/$versionFile`);
     120    my $zip = Archive::Zip->new($pathToZip);
     121    chomp(my $zipFileVersion = $zip->contents("$file/win/$versionFile"));
    125122    return $zipFileVersion;
    126123}
  • trunk/Tools/Scripts/webkitdirs.pm

    r182065 r182089  
    145145    # walks up path checking each directory to see if it is the main WebKit project dir,
    146146    # defined by containing Sources, WebCore, and WebKit
    147     until ((-d "$sourceDir/Source" && -d "$sourceDir/Source/WebCore" && -d "$sourceDir/Source/WebKit") || (-d "$sourceDir/Internal" && -d "$sourceDir/OpenSource"))
     147    until ((-d File::Spec->catdir($sourceDir, "Source") && -d File::Spec->catdir($sourceDir, "Source", "WebCore") && -d File::Spec->catdir($sourceDir, "Source", "WebKit")) || (-d File::Spec->catdir($sourceDir, "Internal") && -d File::Spec->catdir($sourceDir, "OpenSource")))
    148148    {
    149149        if ($sourceDir !~ s|/[^/]+$||) {
     
    152152    }
    153153
    154     $sourceDir = "$sourceDir/OpenSource" if -d "$sourceDir/OpenSource";
     154    $sourceDir = File::Spec->catdir($sourceDir, "OpenSource") if -d File::Spec->catdir($sourceDir, "OpenSource");
    155155}
    156156
     
    14341434sub windowsSourceSourceDir()
    14351435{
    1436     return windowsSourceDir() . "\\Source";
     1436    return File::Spec->catdir(windowsSourceDir(), "Source");
    14371437}
    14381438
    14391439sub windowsLibrariesDir()
    14401440{
    1441     return windowsSourceDir() . "\\WebKitLibraries\\win";
     1441    return File::Spec->catdir(windowsSourceDir(), "WebKitLibraries", "win");
    14421442}
    14431443
    14441444sub windowsOutputDir()
    14451445{
    1446     return windowsSourceDir() . "\\WebKitBuild";
     1446    return File::Spec->catdir(windowsSourceDir(), "WebKitBuild");
    14471447}
    14481448
     
    14571457sub checkInstalledTools()
    14581458{
    1459     # SVN 1.7.10 is known to be compatible with current servers. SVN 1.8.x seems to be missing some authentication
    1460     # protocols we use for svn.webkit.org:
    1461     my $svnVersion = `svn --version 2> NUL | grep "\\sversion"`;
    1462     chomp($svnVersion);
    1463     if (!$? and $svnVersion =~ /1\.8\./) {
    1464         print "svn 1.7.10 is known to be compatible with our servers. You are running $svnVersion,\nwhich may not work properly.\n"
    1465     }
    1466 
    14671459    # environment variables. Avoid until this is corrected.
    14681460    my $pythonVer = `python --version 2>&1`;
     
    14701462
    14711463    # cURL 7.34.0 has a bug that prevents authentication with opensource.apple.com (and other things using SSL3).
    1472     my $curlVer = `curl --version 2> NUL | grep "curl"`;
    1473     chomp($curlVer);
    1474     if (!$? and $curlVer =~ /libcurl\/7\.34\.0/) {
    1475         print "cURL version 7.34.0 has a bug that prevents authentication with SSL v2 or v3.\n";
    1476         print "cURL 7.33.0 is known to work. The cURL projects is preparing an update to\n";
    1477         print "correct this problem.\n\n";
    1478         die "Please install a working cURL and try again.\n";
     1464    my $curlVer = `curl --version 2> NUL`;
     1465    if (!$? and $curlVer =~ "(.*curl.*)") {
     1466        $curlVer = $1;
     1467        if ($curlVer =~ /libcurl\/7\.34\.0/) {
     1468            print "cURL version 7.34.0 has a bug that prevents authentication with SSL v2 or v3.\n";
     1469            print "cURL 7.33.0 is known to work. The cURL projects is preparing an update to\n";
     1470            print "correct this problem.\n\n";
     1471            die "Please install a working cURL and try again.\n";
     1472        }
    14791473    }
    14801474
     
    16761670    my $platform = "/p:Platform=" . (isWin64() ? "x64" : "Win32");
    16771671    my $logPath = File::Spec->catdir($baseProductDir, $configuration);
    1678     File::Path->make_path($logPath) unless -d $logPath or $logPath eq ".";
     1672    make_path($logPath) unless -d $logPath or $logPath eq ".";
    16791673
    16801674    my $errorLogFile = File::Spec->catfile($logPath, "webkit_errors.log");
Note: See TracChangeset for help on using the changeset viewer.