<commit_before>#!/usr/local/bin/perl5

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");

require "getopt.pl";
require 5.0;

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


# Extract the source and target directories
&Getopt('sopcxmntr');
$XERCESCROOT = $opt_s;
$targetdir = $opt_o;

# Check for the environment variables and exit if error
if (!length($XERCESCROOT) || !length($targetdir) || (length($opt_h) > 0) ) {
    print ("Usage is: packageBinaries <options>\n");
	print ("          options are:  -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++ or xlC_r)\n");
    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 ("                        -h to get help on these commands\n");
    print ("Example: perl packageBinaries.pl -s\$HOME/xerces-c_1_0_0d01 -o\$HOME/xerces-c_1_0_0d01bin -cgcc -xg++ -minmem -nfileonly -tnative\n");
    exit(-1);
}

# Set up the environment variables for ICU
# As of Version 3, ICU is not a required component of XERCES-C
$ICUROOT = $ENV{'ICUROOT'};
if (!length($ICUROOT)) {
    print "You have not defined your ICU install directory.\n";
    print "To build with ICU, you must set an environment variable called ICUROOT\n";
    print "Proceeding to build XERCES-C without ICU...\n";
}

# Check if the source directory exists or not
if (!(-e $XERCESCROOT)) {
    print ("The directory $XERCESCROOT does not exist. Cannot proceed any further.\n");
    exit(-1);
}

# 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);
}

#Fix the backslashes on the Windows platform
$XERCESCROOT =~ s/\\/\//g;
$ICUROOT =~ s/\\/\//g;
$targetdir =~ s/\\/\//g;

# Find out the platform from 'uname -a'
open(PLATFORM, "uname -s|");
$platform = <PLATFORM>;
chomp($platform);
close (PLATFORM);

print "Packaging binaries for \`" . $platform . "\` in " . $targetdir . " ...\n";

#Construct the name of the zip file by extracting the last directory name
$zipfiles = $targetdir;
$zipfiles =~ s/.*\/([\w|-]*)$/$1/g;
$zipfiles = $zipfiles . "/*";

$buildmode = "Release";    # Universally, why do you want to package Debug builds anyway?

if ($platform =~ m/Windows/) {

    $platformname = 'Win32';    # Needed this way by nmake
    if (-e $targetdir.".zip") {
        print ("Error: The target file \'$targetdir.zip\' already exists.\n");
        print ("       You must delete the file \'$targetdir.zip\' to package your product.\n");
        exit(1);
    }
    
    # Make the target directory and its main subdirectories
    mkdir ($targetdir, "0644");
    mkdir ($targetdir . "/bin", "0644");
    mkdir ($targetdir . "/lib", "0644");
    mkdir ($targetdir . "/include", "0644");
    mkdir ($targetdir . "/include/sax", "0644");
    mkdir ($targetdir . "/include/framework", "0644");
    mkdir ($targetdir . "/include/internal", "0644");
    mkdir ($targetdir . "/include/parsers", "0644");
    mkdir ($targetdir . "/include/util", "0644");
    mkdir ($targetdir . "/include/dom", "0644");
    mkdir ($targetdir . "/include/unicode", "0644");
    mkdir ($targetdir . "/include/validators", "0644");
    mkdir ($targetdir . "/samples", "0644");
    mkdir ($targetdir . "/samples/Projects", "0644");
    mkdir ($targetdir . "/samples/Projects/Win32", "0644");
    mkdir ($targetdir . "/samples/data", "0644");
    mkdir ($targetdir . "/samples/SAXCount", "0644");
    mkdir ($targetdir . "/samples/SAXPrint", "0644");
    mkdir ($targetdir . "/samples/DOMCount", "0644");
    mkdir ($targetdir . "/samples/DOMPrint", "0644");
    mkdir ($targetdir . "/samples/Redirect", "0644");
    mkdir ($targetdir . "/samples/MemParse", "0644");
    mkdir ($targetdir . "/samples/PParse", "0644");
    mkdir ($targetdir . "/samples/StdInParse", "0644");
    mkdir ($targetdir . "/samples/EnumVal", "0644");
    mkdir ($targetdir . "/samples/CreateDOMDocument", "0644");
    mkdir ($targetdir . "/doc", "0644");
    mkdir ($targetdir . "/doc/html", "0644");
    mkdir ($targetdir . "/doc/html/apiDocs", "0644");
    
    # If 'FileOnly' NetAccessor has been specified, then the project files have to be
    # changed.
    if ($opt_n =~ m/fileonly/i)
    {
        changeWindowsProjectForFileOnlyNA("$XERCESCROOT/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp");
    }

	if (length($ICUROOT) > 0) {
	    print ("Building ICU from $ICUROOT ...\n");
        
	    #Clean up all the dependency files, causes problems for nmake
	    chdir ("$ICUROOT");
	    system ("del /s /f *.dep *.ncb *.plg *.opt");
        
	    # Make the icu dlls
	    chdir ("$ICUROOT/source/allinone");
	    print "Executing: msdev allinone.dsw /MAKE \"all - $platformname $buildmode\" /REBUILD inside $ICUROOT/source/allinone";
	    system("msdev allinone.dsw /MAKE \"all - $platformname $buildmode\" /REBUILD");
        
	    change_windows_project_for_ICU("$XERCESCROOT/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp");
    }

    # Clean up all the dependency files, causes problems for nmake
	# Also clean up all MSVC-generated project files that just cache the IDE state
    chdir ("$XERCESCROOT");
    system ("del /s /f *.dep *.ncb *.plg *.opt");

    # Make all files in the Xerces-C system including libraries, samples and tests
    chdir ("$XERCESCROOT/Projects/Win32/VC6/xerces-all");
    print "Executing: msdev xerces-all.dsp /MAKE \"all - $platformname $buildmode\" /REBUILD";
    system("msdev xerces-all.dsw /MAKE \"all - $platformname $buildmode\" /REBUILD");
    
    # Decide where you want the build copied from
    chdir ($targetdir);
    $BUILDDIR = $XERCESCROOT . "/Build/Win32/VC6/" . $buildmode;
    print "\nBuild is being copied from \'" . $BUILDDIR . "\'";
    
    # Populate the include output directory
    print ("\n\nCopying headers files ...\n");
    $xcopycommand = "xcopy $XERCESCROOT\\src\\D*.hpp $targetdir\\include";
	system ("del  $targetdir\\include\\dom\\*Impl.hpp");
	system ("del  $targetdir\\include\\dom\\DS*.hpp");
    $xcopycommand =~ s/\//\\/g;
    system ("$xcopycommand /S /C /I /R");
    $xcopycommand = "xcopy $XERCESCROOT\\src\\*.c $targetdir\\include";
    $xcopycommand =~ s/\//\\/g;
    system ("$xcopycommand /S /C /I /R");<commit_msg>Changes made to retrive proper include files in target directory.under windows platform<commit_after>#!/usr/local/bin/perl5

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");

require "getopt.pl";
require 5.0;

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


# Extract the source and target directories
&Getopt('sopcxmntr');
$XERCESCROOT = $opt_s;
$targetdir = $opt_o;

# Check for the environment variables and exit if error
if (!length($XERCESCROOT) || !length($targetdir) || (length($opt_h) > 0) ) {
    print ("Usage is: packageBinaries <options>\n");
    print ("          options are:  -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++ or xlC_r)\n");
    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 ("                        -h to get help on these commands\n");
    print ("Example: perl packageBinaries.pl -s\$HOME/xerces-c_1_0_0d01 -o\$HOME/xerces-c_1_0_0d01bin -cgcc -xg++ -minmem -nfileonly -tnative\n");
    exit(-1);
}

# Set up the environment variables for ICU
# As of Version 3, ICU is not a required component of XERCES-C
$ICUROOT = $ENV{'ICUROOT'};
if (!length($ICUROOT)) {
    print "You have not defined your ICU install directory.\n";
    print "To build with ICU, you must set an environment variable called ICUROOT\n";
    print "Proceeding to build XERCES-C without ICU...\n";
}

# Check if the source directory exists or not
if (!(-e $XERCESCROOT)) {
    print ("The directory $XERCESCROOT does not exist. Cannot proceed any further.\n");
    exit(-1);
}

# 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);
}

#Fix the backslashes on the Windows platform
$XERCESCROOT =~ s/\\/\//g;
$ICUROOT =~ s/\\/\//g;
$targetdir =~ s/\\/\//g;

# Find out the platform from 'uname -a'
open(PLATFORM, "uname -s|");
$platform = <PLATFORM>;
chomp($platform);
close (PLATFORM);

print "Packaging binaries for \`" . $platform . "\` in " . $targetdir . " ...\n";

#Construct the name of the zip file by extracting the last directory name
$zipfiles = $targetdir;
$zipfiles =~ s/.*\/([\w|-]*)$/$1/g;
$zipfiles = $zipfiles . "/*";

$buildmode = "Release";    # Universally, why do you want to package Debug builds anyway?

if ($platform =~ m/Windows/) {

    $platformname = 'Win32';    # Needed this way by nmake
    if (-e $targetdir.".zip") {
        print ("Error: The target file \'$targetdir.zip\' already exists.\n");
        print ("       You must delete the file \'$targetdir.zip\' to package your product.\n");
        exit(1);
    }
    
    # Make the target directory and its main subdirectories
    mkdir ($targetdir, "0644");
    mkdir ($targetdir . "/bin", "0644");
    mkdir ($targetdir . "/lib", "0644");
    mkdir ($targetdir . "/include", "0644");
    mkdir ($targetdir . "/include/sax", "0644");
    mkdir ($targetdir . "/include/framework", "0644");
    mkdir ($targetdir . "/include/internal", "0644");
    mkdir ($targetdir . "/include/parsers", "0644");
    mkdir ($targetdir . "/include/util", "0644");
    mkdir ($targetdir . "/include/dom", "0644");
    mkdir ($targetdir . "/include/unicode", "0644");
    mkdir ($targetdir . "/include/validators", "0644");
    mkdir ($targetdir . "/samples", "0644");
    mkdir ($targetdir . "/samples/Projects", "0644");
    mkdir ($targetdir . "/samples/Projects/Win32", "0644");
    mkdir ($targetdir . "/samples/data", "0644");
    mkdir ($targetdir . "/samples/SAXCount", "0644");
    mkdir ($targetdir . "/samples/SAXPrint", "0644");
    mkdir ($targetdir . "/samples/DOMCount", "0644");
    mkdir ($targetdir . "/samples/DOMPrint", "0644");
    mkdir ($targetdir . "/samples/Redirect", "0644");
    mkdir ($targetdir . "/samples/MemParse", "0644");
    mkdir ($targetdir . "/samples/PParse", "0644");
    mkdir ($targetdir . "/samples/StdInParse", "0644");
    mkdir ($targetdir . "/samples/EnumVal", "0644");
    mkdir ($targetdir . "/samples/CreateDOMDocument", "0644");
    mkdir ($targetdir . "/doc", "0644");
    mkdir ($targetdir . "/doc/html", "0644");
    mkdir ($targetdir . "/doc/html/apiDocs", "0644");
    
    # If 'FileOnly' NetAccessor has been specified, then the project files have to be
    # changed.
    if ($opt_n =~ m/fileonly/i)
    {
        changeWindowsProjectForFileOnlyNA("$XERCESCROOT/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp");
    }

	if (length($ICUROOT) > 0) {
	    print ("Building ICU from $ICUROOT ...\n");
        
	    #Clean up all the dependency files, causes problems for nmake
	    chdir ("$ICUROOT");
	    system ("del /s /f *.dep *.ncb *.plg *.opt");
        
	    # Make the icu dlls
	    chdir ("$ICUROOT/source/allinone");
	    print "Executing: msdev allinone.dsw /MAKE \"all - $platformname $buildmode\" /REBUILD inside $ICUROOT/source/allinone";
	    system("msdev allinone.dsw /MAKE \"all - $platformname $buildmode\" /REBUILD");
        
	    change_windows_project_for_ICU("$XERCESCROOT/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp");
    }

    # Clean up all the dependency files, causes problems for nmake
	# Also clean up all MSVC-generated project files that just cache the IDE state
    chdir ("$XERCESCROOT");
    system ("del /s /f *.dep *.ncb *.plg *.opt");

    # Make all files in the Xerces-C system including libraries, samples and tests
    chdir ("$XERCESCROOT/Projects/Win32/VC6/xerces-all");
    print "Executing: msdev xerces-all.dsp /MAKE \"all - $platformname $buildmode\" /REBUILD";
    system("msdev xerces-all.dsw /MAKE \"all - $platformname $buildmode\" /REBUILD");
    
    # Decide where you want the build copied from
    chdir ($targetdir);
    $BUILDDIR = $XERCESCROOT . "/Build/Win32/VC6/" . $buildmode;
    print "\nBuild is being copied from \'" . $BUILDDIR . "\'";
    
    # Populate the include output directory
    print ("\n\nCopying headers files ...\n");
    $xcopycommand = "xcopy $XERCESCROOT\\src\\*.hpp $targetdir\\include";
    $xcopycommand =~ s/\//\\/g;
    system ("$xcopycommand /S /C /I /R");
    $xcopycommand = "xcopy $XERCESCROOT\\src\\*.c $targetdir\\include";
    $xcopycommand =~ s/\//\\/g;
    system ("$xcopycommand /S /C /I /R");

    system ("rm  $targetdir/include/dom/*Impl.hpp");
    system ("rm  $targetdir/include/dom/DS*.hpp");    
{'fraction_non_alphanumeric': 0.17386670456160297, 'fraction_numerical': 0.023021173795651557, 'mean_word_length': 2.8061114115738235, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '633925', 'n_tokens_mistral': 5057, 'n_tokens_neox': 4699, 'n_words': 1348}