Newer
Older
# Copyright 1999-2004 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
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");
PeiYong Zhang
committed
#
# Setup global variables
#
&Getopt('sopcxmntrb');
PeiYong Zhang
committed
my $XERCESCROOT = $opt_s;
my $targetdir = $opt_o;
my $ICUROOT = $ENV{'ICUROOT'};
my $ICUIsPresent = (($opt_t =~ m/icu/i || $opt_m =~ m/icu/i) && length($ICUROOT) > 0);
my $ICUResourceDir = "$XERCESCROOT/src/xercesc/util/MsgLoaders/ICU/resources";
if (!length($XERCESCROOT) || !length($targetdir) || (length($opt_h) > 0) ) {
print ("Usage is: packageBinaries <options>\n");
print (" where options are:\n");
print (" -s <source_directory>\n");
print (" -o <target_directory>\n");
PeiYong Zhang
committed
print (" -c <C compiler name> (e.g. gcc, cc, xlc_r, VC6, VC7, ecl or icl)\n");
print (" -x <C++ compiler name> (e.g. g++, CC, aCC, c++, xlC_r, cl, ecl, ecc, icl, VC6 or VC7)\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 (" -b <bitsToBuild> (accepts '64', '32')\n");
print (" -j suppress building of ICU (speeds up builds when debugging)\n");
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_6");
print (" -o \$HOME/xerces-c2_6-linux -c gcc -x g++ -m inmem -n fileonly -t native\n\n");
print (" perl packageBinaries.pl -s \\xerces-c-src2_6");
print (" -o\\xerces-c2_5-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");
exit(-1);
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);
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);
PeiYong Zhang
committed
#
PeiYong Zhang
committed
#
open(PLATFORM, "uname -s|");
$platform = <PLATFORM>;
chomp($platform);
close (PLATFORM);
#Fix the backslashes on the Windows platform
PeiYong Zhang
committed
$XERCESCROOT =~ s/\\/\//g;
$ICUROOT =~ s/\\/\//g;
$targetdir =~ s/\\/\//g;
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-\.]*)$/$2/g;
$zipfiles = $zipfiles . "/*";
PeiYong Zhang
committed
# WINDOWS builds happen here, as long as they
# aren't using gcc...
#
# Tasks:
#
# Preparation
# Initialize Vars
# Make the target directory and its main subdirectories
# 'FileOnly' NetAccessor
#
# Build
# ICU and/or Resource bundle library for ICUMsgLoader
# Xerces-C libraries, samples and tests
#
# Population
# include
# ICU and/or ICUMsgLoader
# Xerces-C libraries, samples and tests
# Documentation
PeiYong Zhang
committed
if ($platform =~ m/Windows/ || ($platform =~ m/CYGWIN/ && !($opt_c =~ m/gcc/))) {
#
# Preparation Begin
#
# Preparation::Initialize Vars
#
my $PlatformName = 'Win32';
my $DevStudioVer = "6.0";
my $VCBuildDir = "VC6";
my $Transcoder = 0;
my $MsgLoader = 0;
my $ReleaseBuildDir = undef;
my $DebugBuildDir = undef;
my $ProjectDir = undef;
if ($opt_b eq "64") {
$PlatformName = 'Win64';
}
if ($opt_x eq "" || $opt_x =~ m/VC6/i )
PeiYong Zhang
committed
$DevStudioVer = "6.0";
$VCBuildDir = "VC6";
$ProjectDir = "$XERCESCROOT/Projects/Win32/$VCBuildDir/xerces-all";
elsif ($opt_x =~ m/VC7/i )
PeiYong Zhang
committed
$DevStudioVer = "7.0";
$VCBuildDir = "VC7";
$ProjectDir = "$XERCESCROOT/Projects/Win32/$VCBuildDir/xerces-all";
elsif ($opt_x =~ m/ecl/i || $opt_x =~ m/icl/i )
PeiYong Zhang
committed
{
$DevStudioVer = "6.1";
$VCBuildDir = "VC6";
$PlatformName = "Win64";
$ProjectDir = "$XERCESCROOT/Projects/Win32/$VCBuildDir/xerces-all/all";
PeiYong Zhang
committed
else
{
print ("Error: Invalid compilers used \n");
print ("-x <C++ compiler name> VC6, VC7, ecl and icl \n");
PeiYong Zhang
committed
exit(1);
PeiYong Zhang
committed
$ReleaseBuildDir = "$XERCESCROOT/Build/$PlatformName/$VCBuildDir/Release";
$DebugBuildDir = "$XERCESCROOT/Build/$PlatformName/$VCBuildDir/Debug";
if ($opt_t =~ m/icu/i ) {
$Transcoder = 1;
if ($opt_m =~ m/icu/i) {
PeiYong Zhang
committed
$MsgLoader = 1;
PeiYong Zhang
committed
print "PlatformName =$PlatformName\n";
print "DevStudioVer =$DevStudioVer\n";
print "VCBuildDir =$VCBuildDir\n";
print "ReleaseBuildDir =$ReleaseBuildDir\n";
print "DebugBuildDir =$DebugBuildDir\n";
print "ProjectDir =$ProjectDir\n";
print "Transcoder =$Transcoder\n";
print "MsgLoader =$MsgLoader\n";
if (-e "$targetdir.zip") {
print ("Deleting old target file \'$targetdir.zip\' \n");
unlink("$targetdir.zip");
PeiYong Zhang
committed
#
PeiYong Zhang
committed
# Preparation::Make the target directory and its main subdirectories
#
PeiYong Zhang
committed
createCommonDir();
Loading
Loading full blame...