Skip to content
Snippets Groups Projects
packageBinaries.pl 75.3 KiB
Newer Older
Ted Leung's avatar
Ted Leung committed
#!/usr/local/bin/perl5
#
# The Apache Software License, Version 1.1
#
# Copyright (c) 1999-2002 The Apache Software Foundation.  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. The end-user documentation included with the redistribution,
#    if any, must include the following acknowledgment:
#       "This product includes software developed by the
#        Apache Software Foundation (http://www.apache.org/)."
#    Alternately, this acknowledgment may appear in the software itself,
#    if and wherever such third-party acknowledgments normally appear.
#
# 4. The names "Xerces" and "Apache Software Foundation" must
#    not be used to endorse or promote products derived from this
#    software without prior written permission. For written
#    permission, please contact apache\@apache.org.
#
# 5. Products derived from this software may not be called "Apache",
#    nor may "Apache" appear in their name, without prior written
#    permission of the Apache Software Foundation.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 THE APACHE SOFTWARE FOUNDATION 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.
# ====================================================================
#
# This software consists of voluntary contributions made by many
# individuals on behalf of the Apache Software Foundation, and was
# originally based on software copyright (c) 1999, International
# Business Machines, Inc., http://www.ibm.com .  For more information
# on the Apache Software Foundation, please see
# <http://www.apache.org/>.
#
Ted Leung's avatar
Ted Leung committed

push(@INC, "/home/xml4c/bin", "/home/xml4c/bin/perl/perl-RUN/opt/perl5/lib", "/Development2/cupert/bin/perl/perl-RUN/opt/perl5/lib", "/Development/cupert/usr/local/perl/perl-RUN/opt/perl5/lib");
Ted Leung's avatar
Ted Leung committed

require "getopt.pl";
Ted Leung's avatar
Ted Leung committed

$|=1;   # Force a flush after every print


# Extract the source and target directories
Rahul Jain's avatar
Rahul Jain committed
$XERCESCROOT = $opt_s;
Ted Leung's avatar
Ted Leung committed
$targetdir = $opt_o;

# Check for the environment variables and exit if error
Rahul Jain's avatar
Rahul Jain committed
if (!length($XERCESCROOT) || !length($targetdir) || (length($opt_h) > 0) ) {
    print ("Usage is: packageBinaries <options>\n");
Rahul Jain's avatar
Rahul Jain committed
    print ("  where options are:\n");
    print ("    -s <source_directory>\n");
    print ("    -o <target_directory>\n");
    print ("    -c <C compiler name> (e.g. gcc, cc or xlc_r)\n");
    print ("    -x <C++ compiler name> (e.g. g++, CC, aCC, c++, xlC_r, cl, ecl or ecc)\n");
Rahul Jain's avatar
Rahul Jain committed
    print ("    -m <message loader> can be 'inmem' \(default\), 'icu' or 'iconv'\n");
    print ("    -n <net accessor> can be 'fileonly' or 'socket' \(default\)\n");
    print ("    -t <transcoder> can be 'icu' or 'native' \(default\)\n");
    print ("    -r <thread option> can be 'pthread' \(default\)or 'dce' (only used on HP-11)\n");
    print ("    -b <bitsToBuild> (accepts '64', '32')\n");
    print ("    -j suppress building of ICU (speeds up builds when debugging)\n");
Rahul Jain's avatar
Rahul Jain committed
    print ("    -h to get help on these commands\n\n");
    print ("Example: Under unix's\n");
    print ("    perl packageBinaries.pl -s \$HOME/xerces-c-src2_4_0");
    print (" -o \$HOME/xerces-c2_4_0-linux -c gcc -x g++ -m inmem -n fileonly -t native\n\n");
Rahul Jain's avatar
Rahul Jain committed
    print ("Example: Under Windows\n");
    print ("    perl packageBinaries.pl -s \\xerces-c-src2_4_0");
    print (" -o\\xerces-c2_4_0-win32 [-n fileonly] [-t icu]\n\n");
    print ("Note:\n");
    print ("    Under Windows, by default the XercesLib project files is\n");
    print ("    configured to use Win32 resource file based message loader,\n");
    print ("    WinSocket based net accessor and native Win32 based transcoder.\n");
    print ("    The two options mentioned in the example above are the only\n");
    print ("    options relevant under Windows on the command line for this script.\n");
Ted Leung's avatar
Ted Leung committed
}

# Set up the environment variables for ICU
Rahul Jain's avatar
Rahul Jain committed
# As of Version 3, ICU is not a required component of XERCES-C
Ted Leung's avatar
Ted Leung committed
$ICUROOT = $ENV{'ICUROOT'};
Tinny Ng's avatar
Tinny Ng committed
$ICU_DATA = $ENV{'ICU_DATA'};
if (($opt_t =~ m/icu/i || $opt_m =~ m/icu/i) && (length($ICUROOT) == 0)) {
    print "You have specified an ICU build but you have not defined your ICU install directory.\n";
    print "To build with ICU, you must set an environment variable called ICUROOT\n";
    print "Cannot proceed any further.\n";
    exit(-1);
Ted Leung's avatar
Ted Leung committed
}
$ICUIsPresent = (($opt_t =~ m/icu/i || $opt_m =~ m/icu/i) && length($ICUROOT) > 0);
Ted Leung's avatar
Ted Leung committed
# Check if the source directory exists or not
Rahul Jain's avatar
Rahul Jain committed
if (!(-e $XERCESCROOT)) {
    print ("The directory $XERCESCROOT does not exist. Cannot proceed any further.\n");
    exit(-1);
Ted Leung's avatar
Ted Leung committed
}

# Check if the target directory exists, exit if it does
if (-e $targetdir) {
    print ("Error: The target directory \'$targetdir\' already exists.\n");
    print ("       You must start with a clean directory to package your product.\n");
    exit(1);
Ted Leung's avatar
Ted Leung committed
}

Tinny Ng's avatar
Tinny Ng committed
# Find out the platform from 'uname -s'
open(PLATFORM, "uname -s|");
$platform = <PLATFORM>;
chomp($platform);
close (PLATFORM);
Ted Leung's avatar
Ted Leung committed

Tinny Ng's avatar
Tinny Ng committed
#
#set platform variable if on windows 64bit
my $return_code = system( "ls" );
if ($return_code != 0)
{  $platform = "win64bit";
}

#Fix the backslashes on the Windows platform
if ($platform ne "win64bit")
{
    $XERCESCROOT =~ s/\\/\//g;
    $ICUROOT =~ s/\\/\//g;
    $targetdir =~ s/\\/\//g;
}

print "Packaging binaries for \`" . $platform . "\` in " . $targetdir . " ...\n";   # "
Ted Leung's avatar
Ted Leung committed

#Construct the name of the zip file by extracting the last directory name
$zipfiles =~ s/.*(\/|\\)([\w-\.]*)$/$2/g;
$zipfiles = $zipfiles . "/*";
Ted Leung's avatar
Ted Leung committed

Rahul Jain's avatar
Rahul Jain committed
$buildmode = "Release";         # Universally, why do you want to package Debug builds anyway?
Ted Leung's avatar
Ted Leung committed

Tinny Ng's avatar
Tinny Ng committed
#   Architecture: Itanium
#   OS:           Windows XP
#   Compiler:     Intel's cl and/or ecl
#   cygwin:       Not Available
if ($platform eq "win64bit" )
{
    if ($opt_x ne "" && $opt_x ne "cl" && $opt_x ne "ecl")
    {
        print("Compiler on Itanium/WindowsXP must be \'cl\' or \'ecl\'\n");
Tinny Ng's avatar
Tinny Ng committed

    if ($opt_x eq "")
    {
    	$opt_x = 'cl';
    }

    $platformname = 'Win64';    # Needed this way by nmake

    if (-e "$targetdir.zip") {
        print ("Deleting old target file \'$targetdir.zip\' \n");
        unlink("$targetdir.zip");
    }

    # Make the target directory and its main subdirectories
    psystem ("mkdir $targetdir");
    psystem ("mkdir $targetdir\\bin");
    psystem ("mkdir $targetdir\\lib");
    if ( $opt_m =~ m/icu/i ) {
        psystem ("mkdir $targetdir\\msg");
Tinny Ng's avatar
Tinny Ng committed
    }
    psystem ("mkdir $targetdir\\etc");
    psystem ("mkdir $targetdir\\include");
    psystem ("mkdir $targetdir\\include\\xercesc");
    psystem ("mkdir $targetdir\\samples");
    psystem ("mkdir $targetdir\\samples\\Projects");
    psystem ("mkdir $targetdir\\samples\\Projects\\Win32");
    psystem ("mkdir $targetdir\\samples\\Projects\\Win32\\VC6");
    psystem ("mkdir $targetdir\\samples\\data");
    psystem ("mkdir $targetdir\\samples\\SAXCount");
    psystem ("mkdir $targetdir\\samples\\SAX2Count");
    psystem ("mkdir $targetdir\\samples\\SAXPrint");
    psystem ("mkdir $targetdir\\samples\\SAX2Print");
    psystem ("mkdir $targetdir\\samples\\DOMCount");
    psystem ("mkdir $targetdir\\samples\\DOMPrint");
    psystem ("mkdir $targetdir\\samples\\Redirect");
    psystem ("mkdir $targetdir\\samples\\MemParse");
    psystem ("mkdir $targetdir\\samples\\PParse");
    psystem ("mkdir $targetdir\\samples\\StdInParse");
    psystem ("mkdir $targetdir\\samples\\EnumVal");
    psystem ("mkdir $targetdir\\samples\\SEnumVal");
    psystem ("mkdir $targetdir\\samples\\CreateDOMDocument");
    psystem ("mkdir $targetdir\\samples\\PSVIWriter");
    psystem ("mkdir $targetdir\\scripts");
    psystem ("mkdir $targetdir\\doc");
    psystem ("mkdir $targetdir\\doc\\html");
    psystem ("mkdir $targetdir\\doc\\html\\apiDocs");

    # If 'FileOnly' NetAccessor has been specified, then the project files have to be
    # changed.
    #REVISIT: we are make from makefile, not from *.dsp
    #         need to look at it later
    if ($opt_n =~ m/fileonly/i) {
        changeWindowsProjectForFileOnlyNA("$XERCESCROOT/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp");
    }

    #
    #	ICU Build happens here, if one is required.
    #
    #REVISIT: icu
    #
    if ($ICUIsPresent) {
        print ("Building ICU from $ICUROOT ...\n");

        #Clean up all the dependency files, causes problems for nmake
        pchdir ("$ICUROOT");
        psystem ("del /s /f *.dep *.ncb *.plg *.opt");

        # Make the icu dlls
        pchdir ("$ICUROOT\\source\\allinone\\all");
        if (!(length($opt_j) > 0)) {   # Optionally suppress ICU build, to speed up overlong builds while debugging.
 	        #For XP 64 bit, we only ship release dlls
Tinny Ng's avatar
Tinny Ng committed
            psystem("nmake -f all_win64_release.mak \"CFG=all - $platformname Release\" CPP=$opt_x.exe >buildlog.txt 2>&1");	    	
	        psystem("type buildlog.txt");
            #psystem("nmake -f all_win64_debug.mak \"CFG=all - $platformname Debug\" CPP=$opt_x.exe >buildlog.txt 2>&1");	    	
	        #psystem("type buildlog.txt");
        $transcoder = 0;
        if ($opt_t =~ m/icu/i )
        {
            $transcoder = 1;
        }
Tinny Ng's avatar
Tinny Ng committed

        $msgloader = 0;
        if ($opt_m =~ m/icu/i)
        change_windows_makefile_for_ICU("$XERCESCROOT\\Projects\\Win32\\VC6\\xerces-all/XercesLib/XercesLib.mak", $transcoder, $msgloader);
    # Build resource bundle library for ICUMsgLoader
    if ($opt_m =~ m/icu/i) {
        pchdir ("$XERCESCROOT\\src\\xercesc\\util\\MsgLoaders\\ICU\\resources");    	
        psystem( "nmake /f resources.mak > buildlog.txt 2>&1 ");
        system("type buildlog.txt");       
    # Clean up all the dependency files, causes problems for nmake
    # Also clean up all MSVC-generated project files that just cache the IDE state
    pchdir ("$XERCESCROOT");
    psystem ("del /s /f *.dep *.ncb *.plg *.opt");
    # Make all files in the Xerces-C system including libraries, samples and tests
    pchdir ("$XERCESCROOT\\Projects\\Win32\\VC6\\xerces-all\\all");
    psystem( "nmake -f all.mak \"CFG=all - $platformname Release\" CPP=$opt_x.exe >buildlog.txt 2>&1");
    system("type buildlog.txt");

    #For XP 64 bit, we only ship release dlls
    #pchdir ("$XERCESCROOT\\Projects\\Win32\\VC6\\xerces-all\\XercesLib");
    #psystem("nmake -f XercesLib.mak \"CFG=XercesLib - $platformname Debug\" CPP=$opt_x.exe > buildlog.txt 2>&1 ");
    #system("type buildlog.txt");
Tinny Ng's avatar
Tinny Ng committed

    # Decide where you want the build copied from
    pchdir ($targetdir);
    $BUILDDIR = $XERCESCROOT . "\\Build\\Win64\\VC6\\" . $buildmode;
    print "\nBuild is being copied from \'" . $BUILDDIR . "\'";

    if ($opt_m =~ m/icu/i) {
        pchdir ("$XERCESCROOT\\src\\xercesc\\util\\MsgLoaders\\ICU\\resources");    	
        psystem("copy XercesMessages*.DLL $BUILDDIR");
    # Populate the include output directory
    print ("\n\nCopying headers files ...\n");
    @headerDirectories =
     qw'sax
		sax2
        framework
PeiYong Zhang's avatar
PeiYong Zhang committed
        framework\\psvi        
        dom
        dom\\deprecated
        internal
        parsers
        util
        util\\Compilers
        util\\MsgLoaders
        util\\MsgLoaders\\ICU
        util\\MsgLoaders\\InMemory
        util\\MsgLoaders\\MsgCatalog
        util\\MsgLoaders\\Win32
        util\\Platforms
        util\\Platforms\\AIX
        util\\Platforms\\HPUX
        util\\Platforms\\Linux
        util\\Platforms\\MacOS
        util\\Platforms\\OS2
        util\\Platforms\\OS390
        util\\Platforms\\PTX
        util\\Platforms\\Solaris
        util\\Platforms\\Tandem
        util\\Platforms\\Win32
        util\\regx
        util\\Transcoders
        util\\Transcoders\\ICU
        util\\Transcoders\\Iconv
        util\\Transcoders\\Win32
        validators
        validators\\common
        validators\\datatype
        validators\\DTD
        validators\\schema
        validators\\schema\\identity';

    foreach $dir (@headerDirectories) {
        $inclDir = "include\\xercesc\\$dir";
        if (! (-e $inclDir)) {
            psystem("mkdir $inclDir");
        }
        $srcDir = "$XERCESCROOT\\src\\xercesc\\$dir";

        # Weed out directories that have no files to copy, to avoid a bunch of
        # warnings from the cp command in the build output.
        opendir(dir, $srcDir);
        @allfiles = readdir(dir);
        closedir(dir);
        foreach $fileKind ("hpp", "c") {
Tinny Ng's avatar
Tinny Ng committed
            $matches = grep(/\.$fileKind$/, @allfiles);
            if ($matches > 0) {
                psystem("copy /y $srcDir\\*.$fileKind  $inclDir\\ ");
            }
        }
    }


    #
    #  Remove internal implementation headers from the DOM include directory.
    #
    psystem("del /s /f $targetdir\\include\\xercesc\\dom\\impl");
    psystem("del  $targetdir\\include\\xercesc\\dom\\deprecated\\*Impl.hpp");
    psystem("del  $targetdir\\include\\xercesc\\dom\\deprecated\\DS*.hpp");

    if ($ICUIsPresent) {
        psystem("xcopy /s /y $ICUROOT\\include\\* $targetdir\\include");
    }

    #
    # Populate the binary output directory
    #
    print ("\n \nCopying binary outputs ...\n");
    psystem("copy /y $BUILDDIR\\*.dll $targetdir\\bin");
    psystem("copy /y $BUILDDIR\\*.exe $targetdir\\bin");
Tinny Ng's avatar
Tinny Ng committed

    if ($ICUIsPresent) {
        # Copy the ICU dlls and libs
        psystem("copy /y $ICUROOT\\bin\\icuuc26.dll $targetdir\\bin");
        psystem("copy /y $ICUROOT\\bin\\icuuc26d.dll $targetdir\\bin");
        # it seems icudt26*.DLL is generated (upper case dll)
        # but just case, try lower case .dll as well
        psystem("copy /y $ICUROOT\\bin\\icudt26*.DLL $targetdir\\bin");
        psystem("copy /y $ICUROOT\\bin\\icudt26*.dll $targetdir\\bin");

        psystem("copy /y $ICUROOT\\lib\\icudata.lib $targetdir\\lib");

        psystem("copy /y $ICUROOT\\lib\\icuuc.lib $targetdir\\lib");
        psystem("copy /y $ICUROOT\\lib\\icuucd.lib $targetdir\\lib");

        # Copy the Resouce Bundle for ICUMsgLoader
        if ( $opt_m =~ m/icu/i) {
            psystem("copy /y $XERCESCROOT\\src\\xercesc\\util\\MsgLoaders\\ICU\\resources\\XercesMessage*.res $targetdir\\msg");
            psystem("copy /y $XERCESCROOT\\src\\xercesc\\util\\MsgLoaders\\ICU\\resources\\XercesMessages*.DLL $targetdir\\bin");
            psystem("copy /y $XERCESCROOT\\src\\xercesc\\util\\MsgLoaders\\ICU\\resources\\XercesMessages*.lib $targetdir\\lib");
    }

    psystem("copy /y $BUILDDIR\\xerces-c_*.lib $targetdir\\lib");

    if ($buildmode ne "Debug") {
Tinny Ng's avatar
Tinny Ng committed
        $DEBUGBUILDDIR = "$XERCESCROOT\\Build\\Win64\\VC6\\Debug";
        psystem("copy /y $DEBUGBUILDDIR\\xerces-c_*D.lib $targetdir\\lib");
        psystem("copy /y $DEBUGBUILDDIR\\xerces*D.dll $targetdir\\bin");
    }
Tinny Ng's avatar
Tinny Ng committed

    # Populate the etc output directory like config.status and the map file
    print ("\n \nCopying misc output to etc ...\n");
Tinny Ng's avatar
Tinny Ng committed
    psystem("copy /y $XERCESCROOT\\Build\\Win64\\VC6\\Release\\obj\\*.map $targetdir\\etc");


    # Populate the samples directory
    print ("\n \nCopying sample files ...\n");
    psystem("copy $XERCESCROOT\\version.incl $targetdir");
    psystem("xcopy /s /y $XERCESCROOT\\samples\\Projects\\Win32\\VC6\\* $targetdir\\samples\\Projects\\Win32\\VC6");

    psystem("copy /y $XERCESCROOT\\samples\\SAXCount\\* $targetdir\\samples\\SAXCount");
    psystem("del /f $targetdir\\samples\\SAXCount\\Makefile.in");
    psystem("copy /y $XERCESCROOT\\samples\\SAX2Count\\* $targetdir\\samples\\SAX2Count");
    psystem("del /f $targetdir\\samples\\SAX2Count\\Makefile.in");
    psystem("copy /y $XERCESCROOT\\samples\\SAXPrint\\* $targetdir\\samples\\SAXPrint");
    psystem("del /f $targetdir\\samples\\SAXPrint\\Makefile.in");
    psystem("copy /y $XERCESCROOT\\samples\\SAX2Print\\* $targetdir\\samples\\SAX2Print");
    psystem("del /f $targetdir\\samples\\SAX2Print\\Makefile.in");
    psystem("copy /y $XERCESCROOT\\samples\\DOMCount\\* $targetdir\\samples\\DOMCount");
    psystem("del /f $targetdir\\samples\\DOMCount\\Makefile.in");
    psystem("copy /y $XERCESCROOT\\samples\\DOMPrint\\* $targetdir\\samples\\DOMPrint");
    psystem("del /f $targetdir\\samples\\DOMPrint\\Makefile.in");
    psystem("copy /y $XERCESCROOT\\samples\\Redirect\\* $targetdir\\samples\\Redirect");
    psystem("del /f $targetdir\\samples\\Redirect\\Makefile.in");
    psystem("copy /y $XERCESCROOT\\samples\\MemParse\\* $targetdir\\samples\\MemParse");
    psystem("del /f $targetdir\\samples\\MemParse\\Makefile.in");
    psystem("copy /y $XERCESCROOT\\samples\\PParse\\* $targetdir\\samples\\PParse");
    psystem("del /f $targetdir\\samples\\PParse\\Makefile.in");
    psystem("copy /y $XERCESCROOT\\samples\\StdInParse\\* $targetdir\\samples\\StdInParse");
    psystem("del /f $targetdir\\samples\\StdInParse\\Makefile.in");
    psystem("copy /y $XERCESCROOT\\samples\\EnumVal\\* $targetdir\\samples\\EnumVal");
    psystem("del /f $targetdir\\samples\\EnumVal\\Makefile.in");
    psystem("copy /y $XERCESCROOT\\samples\\SEnumVal\\* $targetdir\\samples\\SEnumVal");
    psystem("del /f $targetdir\\samples\\SEnumVal\\Makefile.in");
    psystem("copy /y $XERCESCROOT\\samples\\CreateDOMDocument\\* $targetdir\\samples\\CreateDOMDocument");
    psystem("del /f $targetdir\\samples\\CreateDOMDocument\\Makefile.in");
    psystem("copy /y $XERCESCROOT\\samples\\PSVIWriter\\* $targetdir\\samples\\PSVIWriter");
    psystem("del /f $targetdir\\samples\\PSVIWriter\\Makefile.in");
    
    psystem("copy /y $XERCESCROOT\\samples\\data\\* $targetdir\\samples\\data");
    # Populate the scripts directory
    print ("\n \nCopying script files ...\n");
    psystem("copy $XERCESCROOT\\scripts\\sanityTest* $targetdir\\scripts");

    # Populate the docs directory
    print ("\n \nCopying documentation ...\n");
    psystem("xcopy /s /y $XERCESCROOT\\doc\\* $targetdir\\doc");
    psystem("copy $XERCESCROOT\\Readme.html $targetdir");
    psystem("copy $XERCESCROOT\\credits.txt $targetdir");
    psystem("copy $XERCESCROOT\\LICENSE.txt $targetdir");

    if ($ICUIsPresent) {
        psystem("copy $XERCESCROOT\\license.html $targetdir");
        psystem("copy $XERCESCROOT\\XLicense.html $targetdir");
    }
    psystem("del /f  $targetdir\\doc\\Doxyfile");
    psystem("del /s /f $targetdir\\doc\\dtd");
    psystem("del /f  $targetdir\\doc\\*.xml");
    psystem("del /f  $targetdir\\doc\\*.ent");
    psystem("del /f  $targetdir\\doc\\*.gif");

    # Now package it all up using ZIP
    pchdir ("$targetdir\\..");
    print ("\n \nZIPping up all files ...\n");
    $zipname = $targetdir . ".zip";
    psystem ("zip -r $zipname $zipfiles");
}
#
#     End of Itanium Builds.
#   WINDOWS builds happen here, as long as they
#     aren't using gcc...
if ($platform =~ m/Windows/  || ($platform =~ m/CYGWIN/ && !($opt_c =~ m/gcc/))) {
    if ($opt_b eq "64")
    {
        $platformname = 'Win64';
    }
    if (-e "$targetdir.zip") {
        print ("Deleting old target file \'$targetdir.zip\' \n");
        unlink("$targetdir.zip");
    #
    # AUTODETECT VISUAL STUDIO VERSION
    #

    $msc_response= `cl 2>&1`;

    print "$ENV{PATH}\n";

    chomp($msc_response);
    print "-----------------------\n";
    print "Detected: $msc_response\n";

    $msc_response =~ /Version *([0-9.]+)/;
    $msc_full_version = $1;
    $msc_response =~ /Version *([0-9]+)\./;
    $msc_major_version = $1;
    $msc_response =~ /Version *[0-9]+\.([0-9]+)\./;
    $msc_minor_version = $1;

    print "-----------------------\n";
    print "msc_full_version  =$msc_full_version\n";
    print "msc_major_version =$msc_major_version\n";
    print "msc_minor_version =$msc_minor_version\n";
    print "-----------------------\n";

    $DevStudioVer = "6.0"; #default
    $VCBuildDir = "VC6"; #default
    if ($msc_major_version eq "12") {
        print "Configuring environment for Visual Studio 6.0\n";
        $DevStudioVer = "6.0";
    } elsif ($msc_major_version eq "13") {
        print "Configuring environment for Visual Studio .NET\n";
        $DevStudioVer = "7.0";
        $VCBuildDir = "VC7"; #default
    }
    print "DevStudioVer =$DevStudioVer\n";
    print "VCBuildDir   =$VCBuildDir\n";

    # Make the target directory and its main subdirectories
    psystem ("mkdir $targetdir");
    psystem ("mkdir $targetdir/bin");
    psystem ("mkdir $targetdir/lib");
    if ( $opt_m =~ m/icu/i ) {
        psystem ("mkdir $targetdir/msg");
Tinny Ng's avatar
Tinny Ng committed
    }
    psystem ("mkdir $targetdir/etc");
    psystem ("mkdir $targetdir/include");
PeiYong Zhang's avatar
PeiYong Zhang committed
    psystem ("mkdir $targetdir/include/xercesc");
    psystem ("mkdir $targetdir/samples");
    psystem ("mkdir $targetdir/samples/Projects");
    psystem ("mkdir $targetdir/samples/Projects/Win32");
    psystem ("mkdir $targetdir/samples/Projects/Win32/VC6");
    } elsif ($DevStudioVer eq "7.0") {
        psystem ("mkdir $targetdir/samples/Projects/Win32/VC7");
    }
    psystem ("mkdir $targetdir/samples/data");
    psystem ("mkdir $targetdir/samples/SAXCount");
    psystem ("mkdir $targetdir/samples/SAX2Count");
    psystem ("mkdir $targetdir/samples/SAXPrint");
    psystem ("mkdir $targetdir/samples/SAX2Print");
    psystem ("mkdir $targetdir/samples/DOMCount");
    psystem ("mkdir $targetdir/samples/DOMPrint");
    psystem ("mkdir $targetdir/samples/Redirect");
    psystem ("mkdir $targetdir/samples/MemParse");
    psystem ("mkdir $targetdir/samples/PParse");
    psystem ("mkdir $targetdir/samples/StdInParse");
    psystem ("mkdir $targetdir/samples/EnumVal");
PeiYong Zhang's avatar
PeiYong Zhang committed
    psystem ("mkdir $targetdir/samples/SEnumVal");
    psystem ("mkdir $targetdir/samples/CreateDOMDocument");
    psystem ("mkdir $targetdir/samples/PSVIWriter");    
    psystem ("mkdir $targetdir/scripts");
    psystem ("mkdir $targetdir/doc");
    psystem ("mkdir $targetdir/doc/html");
    psystem ("mkdir $targetdir/doc/html/apiDocs");
    # If 'FileOnly' NetAccessor has been specified, then the project files have to be
    # changed.
Rahul Jain's avatar
Rahul Jain committed
    if ($opt_n =~ m/fileonly/i) {
        if ($DevStudioVer eq "6.0") {
            changeWindowsProjectForFileOnlyNA("$XERCESCROOT/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp");
        } elsif ($DevStudioVer eq "7.0") {
            changeWindowsProjectForFileOnlyNA_VC7("$XERCESCROOT/Projects/Win32/VC7/xerces-all/XercesLib/XercesLib.vcproj");
        }

    #
    #	ICU Build happens here, if one is required.
    #
    if ($ICUIsPresent) {
Rahul Jain's avatar
Rahul Jain committed
        print ("Building ICU from $ICUROOT ...\n");
Rahul Jain's avatar
Rahul Jain committed
        #Clean up all the dependency files, causes problems for nmake
        pchdir ("$ICUROOT");
        psystem ("del /s /f *.dep *.ncb *.plg *.opt");
Rahul Jain's avatar
Rahul Jain committed
        # Make the icu dlls
        if (!(length($opt_j) > 0)) {   # Optionally suppress ICU build, to speed up overlong builds while debugging.
            #we ship both debug and release dlls
            if ($DevStudioVer eq "6.0") {
                pchdir ("$ICUROOT/source/allinone");
                if ($platformname eq "Win64")
                {
                    psystem("msdev allinone.dsw /MAKE \"all - $platformname Release\" /USEENV /REBUILD /OUT buildlog.txt");
                }
                else
                {
                    psystem("msdev allinone.dsw /MAKE \"all - $platformname Release\" /REBUILD /OUT buildlog.txt");            	
                }
                psystem("type buildlog.txt");
                if ($platformname eq "Win64")
                {
                    psystem("msdev allinone.dsw /MAKE \"all - $platformname Debug\" /USEENV /REBUILD /OUT buildlog.txt");
                }
                else
                {
                    psystem("msdev allinone.dsw /MAKE \"all - $platformname Debug\" /REBUILD /OUT buildlog.txt");            	
                }	
                psystem("type buildlog.txt");
                pchdir ("$ICUROOT/source/allinone");
                psystem("devenv /rebuild Release /out buildlog_release.txt /project all allinone.sln");
                psystem("type buildlog_release.txt");
                psystem("devenv /rebuild debug /out buildlog_debug.txt /project all allinone.sln");
                psystem("type buildlog_debug.txt");                            	
        $transcoder = 0;
        if ($opt_t =~ m/icu/i )
        {
            $transcoder = 1;
        }
Tinny Ng's avatar
Tinny Ng committed

        $msgloader = 0;
        if ($opt_m =~ m/icu/i)
        if ($DevStudioVer eq "6.0") {
            change_windows_project_for_ICU("$XERCESCROOT/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp", $transcoder , $msgloader);
        } elsif ($DevStudioVer eq "7.0") {
            change_windows_project_for_ICU_VC7("$XERCESCROOT/Projects/Win32/VC7/xerces-all/XercesLib/XercesLib.vcproj", $transcoder , $msgloader);
        }
    # Build resource bundle library for ICUMsgLoader, before XercesLib
    if ($opt_m =~ m/icu/i) {
        pchdir ("$XERCESCROOT/src/xercesc/util/MsgLoaders/ICU/resources");    	
        psystem( "nmake /f resources.mak > buildlog.txt 2>&1 ");
        system("type buildlog.txt");              
    # Clean up all the dependency files, causes problems for nmake
Rahul Jain's avatar
Rahul Jain committed
    # Also clean up all MSVC-generated project files that just cache the IDE state
    pchdir ("$XERCESCROOT");
    psystem ("del /s /f *.dep *.ncb *.plg *.opt");
    # Make all files in the Xerces-C system including libraries, samples and tests
    pchdir ("$XERCESCROOT/Projects/Win32/$VCBuildDir/xerces-all");
    if ($DevStudioVer eq "6.0") {
        if ($platformname eq "Win64")
        {
            psystem( "msdev xerces-all.dsw /MAKE \"all - $platformname $buildmode\" /USEENV /REBUILD /OUT buildlog.txt");
        }
        else
        {
            psystem( "msdev xerces-all.dsw /MAKE \"all - $platformname $buildmode\" /REBUILD /OUT buildlog.txt");
        }	
    } elsif ($DevStudioVer eq "7.0") {
        psystem( "devenv /rebuild Release /out buildlog.txt /project all xerces-all.sln");
    system("type buildlog.txt");
    # Build the debug xerces dll.  Both debug and release DLLs
    #   are in the standard binary distribution of Xerces.
    if ($buildmode ne "Debug") {
        if ($DevStudioVer eq "6.0") {
            if ($platformname eq "Win64")
            {
                psystem("msdev xerces-all.dsw /MAKE \"XercesLib - $platformname Debug\" /USEENV /REBUILD /OUT buildlog.txt");
            }
            else
            {
                psystem("msdev xerces-all.dsw /MAKE \"XercesLib - $platformname Debug\" /REBUILD /OUT buildlog.txt");        	
            }
        } elsif ($DevStudioVer eq "7.0") {
            psystem( "devenv /rebuild debug /out buildlog.txt /project XercesLib xerces-all.sln");
        system("type buildlog.txt");
    # Decide where you want the build copied from
    $BUILDDIR = $XERCESCROOT . "/Build/Win32/$VCBuildDir/" . $buildmode;
    print "\nBuild is being copied from \'" . $BUILDDIR . "\'";
    if ($opt_m =~ m/icu/i) {
        pchdir ("$XERCESCROOT/src/xercesc/util/MsgLoaders/ICU/resources");    	
        psystem("cp -fv XercesMessages*.DLL $BUILDDIR");
        psystem("cp -fv XercesMessages*.lib $BUILDDIR");
    # Populate the include output directory
    print ("\n\nCopying headers files ...\n");
Rahul Jain's avatar
Rahul Jain committed
    @headerDirectories =
     qw'sax
Unknown (aruna1)'s avatar
Unknown (aruna1) committed
		sax2
Rahul Jain's avatar
Rahul Jain committed
        framework
PeiYong Zhang's avatar
PeiYong Zhang committed
        framework/psvi        
Rahul Jain's avatar
Rahul Jain committed
        dom
Rahul Jain's avatar
Rahul Jain committed
        internal
        parsers
        util
Rahul Jain's avatar
Rahul Jain committed
        util/MsgLoaders
        util/MsgLoaders/ICU
        util/MsgLoaders/InMemory
        util/MsgLoaders/MsgCatalog
        util/MsgLoaders/Win32
        util/Platforms
        util/Platforms/AIX
        util/Platforms/HPUX
Rahul Jain's avatar
Rahul Jain committed
        util/Platforms/Linux
        util/Platforms/MacOS
        util/Platforms/OS2
        util/Platforms/OS390
        util/Platforms/PTX
        util/Platforms/Solaris
        util/Platforms/Tandem
        util/Platforms/Win32
Tinny Ng's avatar
Tinny Ng committed
        util/regx
Rahul Jain's avatar
Rahul Jain committed
        util/Transcoders
        util/Transcoders/ICU
        util/Transcoders/Iconv
        util/Transcoders/Win32
        validators
        validators/schema
        validators/schema/identity';
Rahul Jain's avatar
Rahul Jain committed
    foreach $dir (@headerDirectories) {
PeiYong Zhang's avatar
PeiYong Zhang committed
        $inclDir = "include/xercesc/$dir";
Rahul Jain's avatar
Rahul Jain committed
        if (! (-e $inclDir)) {
Rahul Jain's avatar
Rahul Jain committed
        }
PeiYong Zhang's avatar
PeiYong Zhang committed
        $srcDir = "$XERCESCROOT/src/xercesc/$dir";
Rahul Jain's avatar
Rahul Jain committed
        # Weed out directories that have no files to copy, to avoid a bunch of
        # warnings from the cp command in the build output.
        opendir(dir, $srcDir);
        @allfiles = readdir(dir);
        closedir(dir);
        foreach $fileKind ("hpp", "c") {
            $matches = grep(/\.$fileKind$/, @allfiles);
            if ($matches > 0) {
                psystem("cp -f $srcDir/*.$fileKind  $inclDir/");
    #
    #  Remove internal implementation headers from the DOM include directory.
    #
    psystem ("rm -rf $targetdir/include/xercesc/dom/impl");
    psystem ("rm  $targetdir/include/xercesc/dom/deprecated/*Impl.hpp");
    psystem ("rm  $targetdir/include/xercesc/dom/deprecated/DS*.hpp");
    if ($ICUIsPresent) {
        psystem("cp -Rfv $ICUROOT/include/* $targetdir/include");
Rahul Jain's avatar
Rahul Jain committed
    }
Rahul Jain's avatar
Rahul Jain committed
    #
    # Populate the binary output directory
Rahul Jain's avatar
Rahul Jain committed
    #
    print ("\n\nCopying binary outputs ...\n");
    psystem("cp -fv $BUILDDIR/*.dll $targetdir/bin");
    psystem("cp -fv $BUILDDIR/*.exe $targetdir/bin");
    if ($ICUIsPresent) {    	
Tinny Ng's avatar
Tinny Ng committed
        # Copy the ICU dlls and libs
        psystem("cp -fv $ICUROOT/bin/icuuc26.dll $targetdir/bin");
        psystem("cp -fv $ICUROOT/bin/icuuc26d.dll $targetdir/bin");
Tinny Ng's avatar
Tinny Ng committed

        # it seems icudt26*.DLL is generated (upper case dll)
        # but just case, try lower case .dll as well
        psystem("cp -fv $ICUROOT/bin/icudt26*.DLL $targetdir/bin");
        psystem("cp -fv $ICUROOT/bin/icudt26*.dll $targetdir/bin");
Tinny Ng's avatar
Tinny Ng committed

        psystem("cp -fv $ICUROOT/lib/icudata.lib $targetdir/lib");
Tinny Ng's avatar
Tinny Ng committed
        psystem("cp -fv $ICUROOT/lib/icuuc.lib $targetdir/lib");
        psystem("cp -fv $ICUROOT/lib/icuucd.lib $targetdir/lib");
        # Copy the Resouce Bundle for ICUMsgLoader
        if ( $opt_m =~ m/icu/i) {
            psystem("cp -fv $XERCESCROOT/src/xercesc/util/MsgLoaders/ICU/resources/XercesMessages*.res $targetdir/msg");
            psystem("cp -fv $XERCESCROOT/src/xercesc/util/MsgLoaders/ICU/resources/XercesMessages*.DLL $targetdir/bin");
            psystem("cp -fv $XERCESCROOT/src/xercesc/util/MsgLoaders/ICU/resources/XercesMessages*.lib $targetdir/lib");
Rahul Jain's avatar
Rahul Jain committed
    }
    psystem("cp -fv $BUILDDIR/xerces-c_*.lib $targetdir/lib");
        $DEBUGBUILDDIR = "$XERCESCROOT/Build/Win32/$VCBuildDir/Debug";
        psystem("cp -fv $DEBUGBUILDDIR/xerces-c_*D.lib $targetdir/lib");
Tinny Ng's avatar
Tinny Ng committed
        psystem("cp -fv $DEBUGBUILDDIR/xerces-c*D.dll $targetdir/bin");
Rahul Jain's avatar
Rahul Jain committed
    }
    # Populate the etc output directory like config.status and the map file
    print ("\n\nCopying misc output to etc ...\n");
    psystem("cp -fv $XERCESCROOT/Build/Win32/$VCBuildDir/Release/obj/*.map $targetdir/etc");
    # Populate the samples directory
    print ("\n\nCopying sample files ...\n");
    psystem("cp $XERCESCROOT/version.incl $targetdir");
    psystem("cp -Rfv $XERCESCROOT/samples/Projects/Win32/$VCBuildDir/* $targetdir/samples/Projects/Win32/$VCBuildDir");
    psystem("cp -Rfv $XERCESCROOT/samples/SAXCount/* $targetdir/samples/SAXCount");
    psystem("rm -f $targetdir/samples/SAXCount/Makefile");
    psystem("cp -Rfv $XERCESCROOT/samples/SAX2Count/* $targetdir/samples/SAX2Count");
    psystem("rm -f $targetdir/samples/SAX2Count/Makefile");
    psystem("cp -Rfv $XERCESCROOT/samples/SAXPrint/* $targetdir/samples/SAXPrint");
    psystem("rm -f $targetdir/samples/SAXPrint/Makefile");
    psystem("cp -Rfv $XERCESCROOT/samples/SAX2Print/* $targetdir/samples/SAX2Print");
    psystem("rm -f $targetdir/samples/SAX2Print/Makefile");
    psystem("cp -Rfv $XERCESCROOT/samples/DOMCount/* $targetdir/samples/DOMCount");
    psystem("rm -f $targetdir/samples/DOMCount/Makefile");
    psystem("cp -Rfv $XERCESCROOT/samples/DOMPrint/* $targetdir/samples/DOMPrint");
    psystem("rm -f $targetdir/samples/DOMPrint/Makefile");
    psystem("cp -Rfv $XERCESCROOT/samples/Redirect/* $targetdir/samples/Redirect");
    psystem("rm -f $targetdir/samples/Redirect/Makefile");
    psystem("cp -Rfv $XERCESCROOT/samples/MemParse/* $targetdir/samples/MemParse");
    psystem("rm -f $targetdir/samples/MemParse/Makefile");
    psystem("cp -Rfv $XERCESCROOT/samples/PParse/* $targetdir/samples/PParse");
    psystem("rm -f $targetdir/samples/PParse/Makefile");
    psystem("cp -Rfv $XERCESCROOT/samples/StdInParse/* $targetdir/samples/StdInParse");
    psystem("rm -f $targetdir/samples/StdInParse/Makefile");
    psystem("cp -Rfv $XERCESCROOT/samples/EnumVal/* $targetdir/samples/EnumVal");
    psystem("rm -f $targetdir/samples/EnumVal/Makefile");
PeiYong Zhang's avatar
PeiYong Zhang committed
    psystem("cp -Rfv $XERCESCROOT/samples/SEnumVal/* $targetdir/samples/SEnumVal");
    psystem("rm -f $targetdir/samples/SEnumVal/Makefile");
    psystem("cp -Rfv $XERCESCROOT/samples/CreateDOMDocument/* $targetdir/samples/CreateDOMDocument");
    psystem("rm -f $targetdir/samples/CreateDOMDocument/Makefile");
    psystem("cp -Rfv $XERCESCROOT/samples/PSVIWriter/* $targetdir/samples/PSVIWriter");
    psystem("rm -f $targetdir/samples/PSVIWriter/Makefile");
    
    psystem("cp -Rfv $XERCESCROOT/samples/data/* $targetdir/samples/data");
    # Populate the scripts directory
    print ("\n\nCopying script files ...\n");
    psystem("cp $XERCESCROOT/scripts/sanityTest* $targetdir/scripts");

    # Populate the docs directory
    print ("\n\nCopying documentation ...\n");
    psystem("cp -Rfv $XERCESCROOT/doc/* $targetdir/doc");
    psystem("cp $XERCESCROOT/Readme.html $targetdir");
    psystem("cp $XERCESCROOT/credits.txt $targetdir");
    psystem("cp $XERCESCROOT/LICENSE.txt $targetdir");
    if ($ICUIsPresent) {
        psystem("cp $XERCESCROOT/license.html $targetdir");
Tinny Ng's avatar
Tinny Ng committed
        psystem("cp $XERCESCROOT/XLicense.html $targetdir");
Rahul Jain's avatar
Rahul Jain committed
    }
    psystem("rm -f $targetdir/doc/Doxyfile");
    psystem("rm -rf $targetdir/doc/style");
    psystem("rm -f $targetdir/doc/*.xml");
    psystem("rm -f $targetdir/doc/*.ent");
    psystem("rm -f $targetdir/doc/*.gif");
    # Now package it all up using ZIP
    print ("\n\nZIPping up all files ...\n");
    $zipname = $targetdir . ".zip";
    psystem ("zip -r $zipname $zipfiles");
Ted Leung's avatar
Ted Leung committed
}
#
#     End of Windows Builds.
#
#  UNIX builds happen here ...
#
if ( ($platform =~ m/AIX/i)   || ($platform =~ m/HP-UX/i) || ($platform =~ m/BeOS/i) ||
     ($platform =~ m/SunOS/i) || ($platform =~ m/Linux/i) || ($platform =~ m/ptx/i) ||
	 ($platform =~ m/Darwin/i)  || ($platform =~ m/CYGWIN/ && ($opt_c =~ m/gcc/))) {
Ted Leung's avatar
Ted Leung committed

    # Echo the current PATH to see what compiler it picks up
    psystem ("echo PATH=$ENV{'PATH'}");

    # Set defaults for platform-specific options.
        $platform = "aix";
        if ($opt_c eq "") {$opt_c = "xlc_r"; }
        if ($opt_x eq "") {$opt_x = "xlC_r"; }
        $icu_cxxflags = '"-w -O2 -qmaxmem=-1"';
        $icu_cflags = '"-w -O2 -qmaxmem=-1"';
Tinny Ng's avatar
Tinny Ng committed

        if ($opt_m =~ m/icu/i) {
        	$ENV{'LIBPATH'}="$ICUROOT/lib:$XERCESCROOT/lib:$ENV{'LIBPATH'}";
        	$ENV{'PATH'}="$ICUROOT/bin:$ENV{'PATH'}";        	
        psystem ("echo LIBPATH=$ENV{'LIBPATH'}");
    }
	#	Mac OS X
    if ($platform =~ m/Darwin/i) {
        $platform = "macosx";
		
		# Set option defaults
        if ($opt_c eq "")	{$opt_c = 'cc'; }
        if ($opt_x eq "")	{$opt_x = 'g++'; }
        if ($opt_n eq "") 	{$opt_n = 'native'; }		# native net accessor
        if ($opt_t eq "")	{$opt_t = 'native'; }		# native transcoder
		
		# Code for mac os specific tools
		if ($TAR eq "")		{ $TAR = 'gnutar'; }
		if ($MAKE eq "")	{ $MAKE = 'make'; }
Rahul Jain's avatar
Rahul Jain committed
        # Find out the operating system version from 'uname -r'
        open(OSVERSION, "uname -r|");
        $osversion = <OSVERSION>;
        chomp($osversion);
        close (OSVERSION);
        $platform = 'hp-11' if ($osversion =~ m/11\./);
        $platform = 'hp-10' if ($osversion =~ m/10\./);
        if ($opt_c eq "") {$opt_c = "cc"; }
        if ($opt_x eq "") {
            $opt_x = "CC";
            if ($platform eq "hp-11") {
                $opt_x = "aCC";
            }
        }
        if ($opt_m eq "") {
            $opt_m = "inmem";
        }
        $icu_cxxflags = '"-w +O2 +Ofltacc"';
        $icu_cflags = '"-w +O2 +Ofltacc"';
        if ($opt_m =~ m/icu/i) {
        	$ENV{'SHLIB_PATH'}="$ICUROOT/lib:$XERCESCROOT/lib:$ENV{'SHLIB_PATH'}";
        	$ENV{'PATH'}="$ICUROOT/bin:$ENV{'PATH'}";        	        	
        psystem ("echo SHLIB_PATH=$ENV{'SHLIB_PATH'}");
    if ($platform =~ m/BeOS/i) {
        $platform = "beos";
        if ($opt_c eq "") {$opt_c = "gcc";}
        if ($opt_x eq "") {$opt_x = "g++";}
        $icu_cxxflags = '"-w -O"';
        $icu_cflags = '"-w -O"';
        psystem ("echo LIBRARY_PATH=$ENV{'LIBRARY_PATH'}");
Tinny Ng's avatar
Tinny Ng committed
    }
    if ($platform =~ m/Linux/i) {
        $platform = "linux";
        if ($opt_c eq "") {$opt_c = "gcc";}
        if ($opt_x eq "") {$opt_x = "g++";}
        $icu_cxxflags = '"-w -O"';
        $icu_cflags = '"-w -O"';
        if ($opt_m =~ m/icu/i) {
        	$ENV{'LD_LIBRARY_PATH'}="$ICUROOT/lib:$XERCESCROOT/lib:$ENV{'LD_LIBRARY_PATH'}";
        	$ENV{'PATH'}="$ICUROOT/bin:$ENV{'PATH'}";        	        	
        psystem ("echo LD_LIBRARY_PATH=$ENV{'LD_LIBRARY_PATH'}");
    if ($platform =~ m/SunOS/i) {
        $platform = "solaris";
        if ($opt_c eq "") {$opt_c = "cc";}
        if ($opt_x eq "") {$opt_x = "CC";}
        if ($opt_m =~ m/icu/i) {
        	$ENV{'LD_LIBRARY_PATH'}="$ICUROOT/lib:$XERCESCROOT/lib:$ENV{'LD_LIBRARY_PATH'}";
        	$ENV{'PATH'}="$ICUROOT/bin:$ENV{'PATH'}";        	        	
        $icu_cxxflags = '"-w -O3"';
        $icu_cflags = '"-w -xO3"'; 
        psystem ("echo LD_LIBRARY_PATH=$ENV{'LD_LIBRARY_PATH'}");