Skip to content
Snippets Groups Projects
packageBinaries.pl 53.7 KiB
Newer Older
        util/MsgLoaders
        util/MsgLoaders/ICU
        util/MsgLoaders/InMemory
        util/MsgLoaders/MsgCatalog
        util/MsgLoaders/Win32
        util/FileManagers
        util/MutexManagers
        util/NetAccessors
        util/NetAccessors/Curl
        util/NetAccessors/libWWW
        util/NetAccessors/MacOSURLAccess
        util/NetAccessors/MacOSURLAccessCF
        util/NetAccessors/Socket
        util/NetAccessors/WinSock
        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") {
            $matches = grep(/\.$fileKind$/, @allfiles);
            if ($matches > 0) {
                psystem("cp -f $srcDir/*.$fileKind  $inclDir/");
            }
        }
    }

    psystem("cp -Rf $XERCESCROOT/version.incl $targetdir");
    
    #
    #  Remove internal implementation headers from the DOM include directory.
    #
    psystem ("rm -rf $targetdir/include/xercesc/dom/impl");    
}
    	
sub populateSamples() {

    print ("\n\nCopying sample files ...\n");    
    
    psystem("cp $XERCESCROOT/samples/.libs/* $targetdir/bin");
    psystem("cp $XERCESCROOT/tests/.libs/* $targetdir/bin");

    foreach $iii ('SAXCount', 'SAX2Count', 'SAXPrint', 'SAX2Print', 'DOMCount',
                  'DOMPrint', 'Redirect', 'MemParse', 'PParse', 'StdInParse', 
                  'EnumVal', 'SEnumVal', 'CreateDOMDocument', 'PSVIWriter', 'SCMPrint') 
    {
        psystem("cp -Rf $XERCESCROOT/samples/src/$iii/* $targetdir/samples/$iii");
        psystem("rm -f $targetdir/samples/$iii/*.o");
    }

PeiYong Zhang's avatar
PeiYong Zhang committed
    psystem("cp -Rf $XERCESCROOT/samples/data/* $targetdir/samples/data");	
    # Populate the scripts directory
    print ("\n\nCopying script files ...\n");
    psystem("cp $XERCESCROOT/scripts/sanityTest* $targetdir/scripts");

Rahul Jain's avatar
Rahul Jain committed
    # Populate the docs directory
    print ("\n\nCopying documentation ...\n");
PeiYong Zhang's avatar
PeiYong Zhang committed
    psystem("cp -Rf $XERCESCROOT/doc/* $targetdir/doc");
    psystem("cp $XERCESCROOT/Readme.html $targetdir");
    psystem("cp $XERCESCROOT/credits.txt $targetdir");
    psystem("cp $XERCESCROOT/LICENSE     $targetdir");
    psystem("cp $XERCESCROOT/NOTICE      $targetdir");
       
    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");
Ted Leung's avatar
Ted Leung committed
}
# copy ICU file to the directory specified
#	
sub copyICUOnUNIX() {
	
        pchdir ("$_[0]");
PeiYong Zhang's avatar
PeiYong Zhang committed
        # on AIX,              it is called libicudata32.0.a
        # on Solaris/Linux,    it is called libicudata.so.32.0
        # on HP,               it is called libicudata.sl.32.0
PeiYong Zhang's avatar
PeiYong Zhang committed
        psystem("cp -f $ICUROOT/lib/libicudata32.0.so .");
        psystem("cp -f $ICUROOT/lib/libicudata32.0.a .");        
        psystem("cp -f $ICUROOT/lib/libicudata.so.32.0 .");
        psystem("cp -f $ICUROOT/lib/libicudata.sl.32.0 .");
PeiYong Zhang's avatar
PeiYong Zhang committed
        psystem("find . -name 'libicudata32.0.so' -exec ln -s {} libicudata.so \\;");
        psystem("find . -name 'libicudata32.0.so' -exec ln -s {} libicudata32.so \\;");
PeiYong Zhang's avatar
PeiYong Zhang committed
        psystem("find . -name 'libicudata32.0.a'  -exec ln -s {} libicudata.a \\;");
        psystem("find . -name 'libicudata32.0.a'  -exec ln -s {} libicudata32.a \\;");
PeiYong Zhang's avatar
PeiYong Zhang committed
        
PeiYong Zhang's avatar
PeiYong Zhang committed
        psystem("find . -name 'libicudata.so.32.0' -exec ln -s {} libicudata.so \\;");
        psystem("find . -name 'libicudata.so.32.0' -exec ln -s {} libicudata.so.32 \\;");
PeiYong Zhang's avatar
PeiYong Zhang committed
        psystem("find . -name 'libicudata.sl.32.0' -exec ln -s {} libicudata.sl \\;");
        psystem("find . -name 'libicudata.sl.32.0' -exec ln -s {} libicudata.sl.32 \\;");
PeiYong Zhang's avatar
PeiYong Zhang committed
        # on AIX,              it is called libicuuc32.0.a
        # on Solaris/Linux,    it is called libicuuc.so.32.0
        # on HP,               it is called libicuuc.sl.32.0
PeiYong Zhang's avatar
PeiYong Zhang committed
        psystem("cp -f $ICUROOT/lib/libicuuc32.0.so .");
        psystem("cp -f $ICUROOT/lib/libicuuc32.0.a  .");        
        psystem("cp -f $ICUROOT/lib/libicuuc.so.32.0  .");
        psystem("cp -f $ICUROOT/lib/libicuuc.sl.32.0  .");
PeiYong Zhang's avatar
PeiYong Zhang committed
        psystem("find . -name 'libicuuc32.0.so' -exec ln -s {} libicuuc.so \\;");
        psystem("find . -name 'libicuuc32.0.so' -exec ln -s {} libicuuc32.so \\;");
PeiYong Zhang's avatar
PeiYong Zhang committed
        psystem("find . -name 'libicuuc32.0.a'  -exec ln -s {} libicuuc.a \\;");
        psystem("find . -name 'libicuuc32.0.a'  -exec ln -s {} libicuuc32.a \\;");
PeiYong Zhang's avatar
PeiYong Zhang committed
                
PeiYong Zhang's avatar
PeiYong Zhang committed
        psystem("find . -name 'libicuuc.so.32.0' -exec ln -s {} libicuuc.so \\;");
        psystem("find . -name 'libicuuc.so.32.0' -exec ln -s {} libicuuc.so.32 \\;");
PeiYong Zhang's avatar
PeiYong Zhang committed
        psystem("find . -name 'libicuuc.sl.32.0' -exec ln -s {} libicuuc.sl \\;");
        psystem("find . -name 'libicuuc.sl.32.0' -exec ln -s {} libicuuc.sl.32 \\;");
PeiYong Zhang's avatar
PeiYong Zhang committed
               
Rahul Jain's avatar
Rahul Jain committed
sub change_windows_project_for_ICU() {
    my ($thefile, $Transcoder, $MsgLoader) = @_;
    print "\nConverting Windows Xerces library project ($thefile) for ICU usage...";
    my $thefiledotbak = $thefile . ".bak";
    rename ($thefile, $thefiledotbak);
    open (FIZZLE, $thefiledotbak);
    open (FIZZLEOUT, ">$thefile");
    while ($line = <FIZZLE>) {
        if ($line =~ /Win32 Debug/) {
            $icuuc = "icuucd";
            }
        if ($line =~ /Win32 Release/) {
            $icuuc = "icuuc";
            }

        $line =~ s[/D "XERCES_BUILDING_LIBRARY"][/I "$ICUROOT\\include" /D "XERCES_BUILDING_LIBRARY"];
        $line =~ s[Debug/xerces-c_3D.lib"][Debug/xerces-c_3D.lib" /libpath:"$ICUROOT\\lib" /libpath:"$ICUROOT\\source\\data" /libpath:"$XERCESCROOT\\src\\xercesc\\util\\MsgLoaders\\ICU\\resources"];
        $line =~ s[Release/xerces-c_3.lib"][Release/xerces-c_3.lib" /libpath:"$ICUROOT\\lib" /libpath:"$ICUROOT\\source\\data" /libpath:"$XERCESCROOT\\src\\xercesc\\util\\MsgLoaders\\ICU\\resources"];       
            $line =~ s/user32.lib/user32.lib $icuuc.lib XercesMessages3_0.lib/g;
            $line =~ s/user32.lib/user32.lib $icuuc.lib/g;
            $line =~ s/XERCES_USE_TRANSCODER_WINDOWS/XERCES_USE_TRANSCODER_ICU/g;
            $line =~ s/Transcoders\\Win32\\Win32TransService.cpp/Transcoders\\ICU\\ICUTransService.cpp/g;
Tinny Ng's avatar
Tinny Ng committed
            $line =~ s/Transcoders\\Win32\\Win32TransService.hpp/Transcoders\\ICU\\ICUTransService.hpp/g;
            $line =~ s/XERCES_USE_WIN32_MSGLOADER/XERCES_USE_MSGLOADER_ICU/g;
            $line =~ s/MsgLoaders\\Win32\\Win32MsgLoader.cpp/MsgLoaders\\ICU\\ICUMsgLoader.cpp/g;
Tinny Ng's avatar
Tinny Ng committed
            $line =~ s/MsgLoaders\\Win32\\Win32MsgLoader.hpp/MsgLoaders\\ICU\\ICUMsgLoader.hpp/g;
        print FIZZLEOUT $line;
    }
    close (FIZZLEOUT);
    close (FIZZLE);
    unlink ($thefiledotbak);
sub change_windows_makefile_for_ICU() {
    my ($thefile, $Transcoder, $MsgLoader) = @_;
    print "\nConverting Windows Xerces library makefile ($thefile) for ICU usage...";
    my $thefiledotbak = $thefile . ".bak";
    rename ($thefile, $thefiledotbak);

    open (FIZZLE, $thefiledotbak);
    open (FIZZLEOUT, ">$thefile");
    while ($line = <FIZZLE>) {
        if ($line =~ /Win64 Debug/ ){
            $icuuc = "icuucd";
            }
        if ($line =~ /Win64 Release/ ) {
            $icuuc = "icuuc";
        }

        $line =~ s[/D "XERCES_BUILDING_LIBRARY"][/I "$ICUROOT\\include" /D "XERCES_BUILDING_LIBRARY"];
        $line =~ s[/machine:IA64][/libpath:"$ICUROOT\\lib" /libpath:"$ICUROOT\\source\\data" /libpath:"$XERCESCROOT\\src\\xercesc\\util\\MsgLoaders\\ICU\\resources" /machine:IA64];
            $line =~ s/user32.lib/user32.lib $icuuc.lib XercesMessages3_0.lib/g;
            $line =~ s/user32.lib/user32.lib $icuuc.lib/g;
            $line =~ s/XERCES_USE_TRANSCODER_WINDOWS/XERCES_USE_TRANSCODER_ICU/g;
            $line =~ s/Transcoders\\Win32\\Win32TransService/Transcoders\\ICU\\ICUTransService/g;
            $line =~ s/Win32TransService/ICUTransService/g;
        }
            $line =~ s/XERCES_USE_WIN32_MSGLOADER/XERCES_USE_MSGLOADER_ICU/g;
            $line =~ s/MsgLoaders\\Win32\\Win32MsgLoader/MsgLoaders\\ICU\\ICUMsgLoader/g;
Tinny Ng's avatar
Tinny Ng committed
            $line =~ s/Win32MsgLoader/ICUMsgLoader/g;
        print FIZZLEOUT $line;
    }
    close (FIZZLEOUT);
    close (FIZZLE);
    unlink ($thefiledotbak);
}
sub change_windows_project_for_ICU_VC7_or_VC8() {
    my ($thefile, $Transcoder, $MsgLoader) = @_;
    print "\nConverting Windows Xerces library project ($thefile) for ICU usage...";
    my $thefiledotbak = $thefile . ".bak";
    rename ($thefile, $thefiledotbak);

    open (FIZZLE, $thefiledotbak);
    open (FIZZLEOUT, ">$thefile");
    while ($line = <FIZZLE>) {
        if ($line =~ /Release\|Win32/) {
            $icuuc = "icuuc";
            $icuuc = "icuucd";
            }
        $line =~ s/AdditionalIncludeDirectories=\"([^"]*)/AdditionalIncludeDirectories=\"$ICUROOT\\include;$1/;
        $line =~ s/AdditionalLibraryDirectories=\"([^"]*)/AdditionalLibraryDirectories=\"$ICUROOT\\lib;$ICUROOT\\source\\data;$XERCESCROOT\\src\\xercesc\\util\\MsgLoaders\\ICU\\resources;$1/;
            $line =~ s/AdditionalDependencies=\"([^"]*)/AdditionalDependencies=\"$icuuc.lib XercesMessages3_0.lib $1/;
            $line =~ s/AdditionalDependencies=\"([^"]*)/AdditionalDependencies=\"$icuuc.lib $1/;
            $line =~ s/XERCES_USE_TRANSCODER_WINDOWS/XERCES_USE_TRANSCODER_ICU/g;
            $line =~ s/Transcoders\\Win32\\Win32TransService.cpp/Transcoders\\ICU\\ICUTransService.cpp/g;
            $line =~ s/Transcoders\\Win32\\Win32TransService.hpp/Transcoders\\ICU\\ICUTransService.hpp/g;
        }

            $line =~ s/XERCES_USE_WIN32_MSGLOADER/XERCES_USE_MSGLOADER_ICU/g;
            $line =~ s/MsgLoaders\\Win32\\Win32MsgLoader/MsgLoaders\\ICU\\ICUMsgLoader/g;
            $line =~ s/Win32MsgLoader/ICUMsgLoader/g;
        }

        print FIZZLEOUT $line;
    }
    close (FIZZLEOUT);
    close (FIZZLE);
    unlink ($thefiledotbak);
}

#
# This subroutine is used to munge the XercesLib project file to remove all
# traces of WinSock based NetAccessor. Once no NetAccessor is specified, the
# project file is configured for using the 'FileOnly' NetAccessor.
#
# For this function to work the assumption is that project file in CMVC is
# preconfigured to already use the WinSock based NetAccessor. So, the changes
# that need to be done are:
#   - to remove references to any #defines
#   - to remove references to wsock32.lib
#   - to remove references to the source files for the WinSock based NetAccessor.
#

Rahul Jain's avatar
Rahul Jain committed
sub changeWindowsProjectForFileOnlyNA() {
    my ($thefile) = @_;
    print "\nConfiguring Xerces library project ($thefile) for FileOnly NetAccessor...";
    my $thefiledotbak = $thefile . ".bak";
    rename ($thefile, $thefiledotbak);
    open (PROJFILEIN, $thefiledotbak);
    open (PROJFILEOUT, ">$thefile");
    while ($aline = <PROJFILEIN>) {
        # By skipping over lines between the NetAccessors group
        # we can references to the WinSock based NetAccessor files.
        if ($aline =~ m/^# Begin Group \"NetAccessors\"/g) {
            # ...found it. Write out the line as a place holder. Also...
            print PROJFILEOUT $aline;
            # ...preserve the next two lines.
            $aline = <PROJFILEIN>;
            print PROJFILEOUT $aline;
            $aline = <PROJFILEIN>;
            print PROJFILEOUT $aline;
            # Skip over the lines till you hit the WinSock NetAccessor 'End Group'.
            while ($aline = <PROJFILEIN>) { # read the next line
                last if ($aline =~ m/^# End Group/g);
            }
            # We need to preserve the 'End Group' line. The last statement of the
            # enclosing while loop prints it out.
        }
        # From the remaining lines, remove any references to the #defines and
        # the WinSock library.
        $aline =~ s/\/D \"XERCES_USE_NETACCESSOR_WINSOCK\" //g;  # "
        if ($aline =~ /( )+ws2_32.lib( )*\"/) { # end of line
          $aline =~ s/( )+ws2_32.lib( )*\"/\"/g;
        } else { # beginning or middle of line
          $aline =~ s/ws2_32.lib( )*//g;
        }

        print PROJFILEOUT $aline;
    }
    close (PROJFILEOUT);
    close (PROJFILEIN);
    unlink ($thefiledotbak);
}

sub changeWindowsProjectForFileOnlyNA_VC7_or_VC8() {
    my ($thefile) = @_;
    print "\nConfiguring Xerces library project ($thefile) for FileOnly NetAccessor...\n";
    my $thefiledotbak = $thefile . ".bak";
    rename ($thefile, $thefiledotbak);

    open (PROJFILEIN, $thefiledotbak);
    open (PROJFILEOUT, ">$thefile");

    while ($aline = <PROJFILEIN>) {
        # By skipping over lines between the NetAccessors group
        # we can references to the WinSock based NetAccessor files.
        if ($aline =~ m/^# Begin Group \"NetAccessors\"/g) {
            # ...found it. Write out the line as a place holder. Also...
            print PROJFILEOUT $aline;
            # ...preserve the next two lines.
            $aline = <PROJFILEIN>;
            print PROJFILEOUT $aline;
            $aline = <PROJFILEIN>;
            print PROJFILEOUT $aline;
            # Skip over the lines till you hit the WinSock NetAccessor 'End Group'.
            while ($aline = <PROJFILEIN>) { # read the next line
                last if ($aline =~ m/^# End Group/g);
            }
            # We need to preserve the 'End Group' line. The last statement of the
            # enclosing while loop prints it out.
        }

        # From the remaining lines, remove any references to the #defines and
        # the WinSock library.
        if ($aline =~ /\;XERCES_USE_NETACCESSOR_WINSOCK/) { # end or middle of line
          $aline =~ s/\;XERCES_USE_NETACCESSOR_WINSOCK//g;
          $aline =~ s/\XERCES_USE_NETACCESSOR_WINSOCK\;*//g;
        }

        if ($aline =~ /\s+ws2_32\.lib\s*\"/) { # end of line
          $aline =~ s/\s+ws2_32\.lib\s*\"/\"/g;
        } else { # beginning or middle of line
          $aline =~ s/ws2_32\.lib\s*//g;
        }
        print PROJFILEOUT $aline;
    }
    close (PROJFILEOUT);
    close (PROJFILEIN);
    unlink ($thefiledotbak);
}

#
#  psystem subroutine both prints and executes a system command.
#
sub psystem() {
    print("$_[0]\n");
    system($_[0]);
    }

#
#  chdir subroutine both prints and executes a chdir
#
sub pchdir() {
    print("chdir $_[0]\n");
    chdir $_[0];