#!/usr/bin/perl -w

# Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1.  Redistributions of source code must retain the above copyright
#     notice, this list of conditions and the following disclaimer. 
# 2.  Redistributions in binary form must reproduce the above copyright
#     notice, this list of conditions and the following disclaimer in the
#     documentation and/or other materials provided with the distribution. 
# 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
#     its contributors may be used to endorse or promote products derived
#     from this software without specific prior written permission. 
#
# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# A script to download the extra libraries needed to build WebKit on Windows.

use strict;
use FindBin;
use lib $FindBin::Bin;
use webkitdirs;
use Win32API::Registry 0.21 qw( :ALL );

checkRequiredSystemConfig();
chdirWebKit();
my $webkitDir = `pwd`;
chomp $webkitDir;

chdir "WebKitLibraries";

if (! -e "icu-3.4-win32-msvc7.1.zip") {
    print "Downloading icu-3.4-win32-msvc7.1.zip...\n\n";
    `rm -rf icu*`;
    `curl -O ftp://ftp.software.ibm.com/software/globalization/icu/3.4/icu-3.4-Win32-msvc7.1.zip`;
    print "\nInstalling icu-3.4-win32-msvc7.1.zip...\n";
    `unzip icu-3.4-win32-msvc7.1.zip`;
    `rm -rf ../icu`;
    `cp -rp icu ..`;
}
`chmod 755 ../icu/bin/*.dll`;

if (! -e "iconv-1.9.1.win32.zip") {
    print "Downloading iconv-1.9.1.win32.zip...\n\n";
    `rm -rf iconv*`;
    `curl -O ftp://fr.rpmfind.net/pub/libxml/win32/iconv-1.9.1.win32.zip`;
    print "\nInstalling iconv-1.9.1.win32.zip...\n";
    `unzip iconv-1.9.1.win32.zip`;
    `rm -rf ../iconv`;
    `cp -rp iconv-1.9.1.win32 ../iconv`;
}
`chmod 755 ../iconv/bin/*.dll`;

if (! -e "libxml2-2.6.23.win32.zip") {
    print "Downloading libxml2-2.6.23.win32.zip...\n\n";
    `rm -rf libxml*`;
    `curl -O ftp://fr.rpmfind.net/pub/libxml/win32/libxml2-2.6.23.win32.zip`;
    print "\nInstalling libxml2-2.6.23.win32.zip...\n";
    `unzip libxml2-2.6.23.win32.zip`;
    `rm -rf ../libxml`;
    `cp -rp libxml2-2.6.23.win32 ../libxml`;
}
`chmod 755 ../libxml/bin/*.dll`;

if (! -e "libxslt-1.1.15.win32.zip") {
    print "Downloading libxmslt-1.1.15.win32.zip...\n";
    `rm -rf libxslt*`;
    `curl -O ftp://fr.rpmfind.net/pub/libxml/win32/libxslt-1.1.15.win32.zip`;
    print "Installing libxmslt-1.1.15.win32.zip...\n";
    `unzip libxslt-1.1.15.win32.zip`;
    `rm -rf ../libxslt`;
    `cp -rp libxslt-1.1.15.win32 ../libxslt`;
}
`chmod 755 ../libxslt/bin/*.dll`;

if (! -e "zlib-1.2.3.win32.zip") {
    print "Downloading zlib-1.2.3.win32.zip...\n\n";
    `rm -rf zlib*`;
    `curl -O ftp://fr.rpmfind.net/pub/libxml/win32/zlib-1.2.3.win32.zip`;
    print "\nInstalling zlib-1.2.3.win32.zip...\n";
    `unzip zlib-1.2.3.win32.zip`;
    `rm -rf ../zlib`;
    `cp -rp zlib-1.2.3.win32 ../zlib`;
}
`chmod 755 ../zlib/bin/*.dll`;

my $PROGRAMFILES = $ENV{"PROGRAMFILES"};
my $unixProgramFiles = `cygpath -u "$PROGRAMFILES"`;
chomp $unixProgramFiles;

my $setx = "$unixProgramFiles/Resource\ Kit/setx.exe";

if (! -x "$setx") {
    unlink("setx_setup.exe"); 
    print "Downloading setx_setup.exe...\n\n";
    `curl -O http://download.microsoft.com/download/win2000platform/setx/1.00.0.1/nt5/en-us/setx_setup.exe`;
    print "Installing setx_setup.exe, please install in the default location...\n";
    `chmod +x ./setx_setup.exe`;
    `./setx_setup.exe`;
    `chmod +x "$setx"`;

    print "$setx WebKitOutputDir 'c:\\WebKitBuild'\n";
    system "$setx", "WebKitOutputDir", 'c:\\WebKitBuild';

    my $PATH = $ENV{"PATH"};
    my $WINPATH = `cygpath -p -w "$PATH"`;
    chomp $WINPATH;
    my $winScripts = `cygpath -w "$webkitDir/WebKitTools/Scripts"`;
    chomp $winScripts;
    
    if (! ($WINPATH =~ /WebKitTools/)) {
	$WINPATH = "$winScripts;$WINPATH";
    }
    if (! ($WINPATH =~ /Resource Kit/)) {
	$WINPATH = "c:\\Program Files\\Resource Kit;$WINPATH";
    }
    if (! ($WINPATH =~ /cygwin\\bin/)) {
	$WINPATH = "c:\\cygwin\\bin;$WINPATH";
    }

    print "$setx Path \"$WINPATH\" -m\n";
    system "$setx", "Path", "$WINPATH", "-m";
}

# Disable error reporting UI
my $key;
RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug", 0, KEY_WRITE, $key);
RegSetValueEx($key, "Auto", 0, REG_SZ, "1" );
RegSetValueEx($key, "Debugger", 0, REG_SZ, "drwtsn32 -p %ld -e %ld -g");
RegCloseKey($key );
RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\PCHealth\\ErrorReporting", 0, KEY_WRITE, $key);
RegSetValueEx($key, "DoReport", 0, REG_DWORD, "\0\0\0\0");
RegSetValueEx($key, "ShowUI", 0, REG_DWORD, "\0\0\0\0");
RegCloseKey($key );
