Newer
Older
#
# The Apache Software License, Version 1.1
#
PeiYong Zhang
committed
# Copyright (c) 1999-2004 The Apache Software Foundation. All rights
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# 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/>.
#
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_5_0");
print (" -o \$HOME/xerces-c2_5_0-linux -c gcc -x g++ -m inmem -n fileonly -t native\n\n");
print (" perl packageBinaries.pl -s \\xerces-c-src2_5_0");
print (" -o\\xerces-c2_5_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");
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();
PeiYong Zhang
committed
# windows specifics
psystem ("mkdir $targetdir/samples/Projects");
psystem ("mkdir $targetdir/samples/Projects/Win32");
PeiYong Zhang
committed
psystem ("mkdir $targetdir/samples/Projects/Win32/$VCBuildDir");
PeiYong Zhang
committed
#
# Preparation:: 'FileOnly' NetAccessor
# has been specified, then the project files have to be changed.
#
PeiYong Zhang
committed
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");
}
PeiYong Zhang
committed
#else: for now we do not build FO with ecl
PeiYong Zhang
committed
#
# Build Begin
#
# Build::ICU and/or Resource bundle library for ICUMsgLoader
#
PeiYong Zhang
committed
if (!(length($opt_j) > 0)) {
#Clean up all the dependency files, causes problems for nmake
print ("Building ICU from $ICUROOT ...\n");
pchdir ("$ICUROOT");
psystem ("del /s /f *.dep *.ncb *.plg *.opt");
# we ship both debug and release dlls
if ($DevStudioVer eq "6.0") {
pchdir ("$ICUROOT/source/allinone");
PeiYong Zhang
committed
if ($PlatformName eq "Win64")
{
PeiYong Zhang
committed
psystem("msdev allinone.dsw /MAKE \"all - $PlatformName Release\" /USEENV /REBUILD /OUT buildlog_release.txt");
psystem("msdev allinone.dsw /MAKE \"all - $PlatformName Debug\" /USEENV /REBUILD /OUT buildlog_debug.txt");
}
else
{
PeiYong Zhang
committed
psystem("msdev allinone.dsw /MAKE \"all - $PlatformName Release\" /REBUILD /OUT buildlog_release.txt");
psystem("msdev allinone.dsw /MAKE \"all - $PlatformName Debug\" /REBUILD /OUT buildlog_debug.txt");
}
PeiYong Zhang
committed
psystem("type buildlog_release.txt");
psystem("type buildlog_debug.txt");
} elsif ($DevStudioVer eq "7.0") {
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");
PeiYong Zhang
committed
} else { #"6.1"
pchdir ("$ICUROOT/source/allinone/all");
#ship release dlls only
psystem("nmake -f all_win64_release.mak \"CFG=all - $PlatformName Release\" CPP=$opt_x.exe >buildlog_release.txt 2>&1");
psystem("type buildlog_release.txt");
#debug is disabled
#psystem("nmake -f all_win64_debug.mak \"CFG=all - $PlatformName Debug\" CPP=$opt_x.exe >buildlog_debug.txt 2>&1");
#psystem("type buildlog_debug.txt");
}
PeiYong Zhang
committed
} #$opt_j
PeiYong Zhang
committed
#
# Build resource bundle library for ICUMsgLoader
# this can only be built when ICUIsPresent
if ($opt_m =~ m/icu/i) {
pchdir ("$ICUResourceDir");
# clean up intermediate files to make it rebuildable
psystem ("del /s /f *.DLL *.dll *.res *.DAT *.lib *.obj");
psystem( "nmake /f resources.mak > buildlog.txt 2>&1 ");
system("type buildlog.txt");
PeiYong Zhang
committed
#
# Adjust project file
#
if ($DevStudioVer eq "6.0") {
PeiYong Zhang
committed
change_windows_project_for_ICU("$XERCESCROOT/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp", $Transcoder , $MsgLoader);
} elsif ($DevStudioVer eq "7.0") {
PeiYong Zhang
committed
change_windows_project_for_ICU_VC7("$XERCESCROOT/Projects/Win32/VC7/xerces-all/XercesLib/XercesLib.vcproj", $Transcoder , $MsgLoader);
} else { # "6.1"
change_windows_makefile_for_ICU("$XERCESCROOT/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.mak", $Transcoder, $MsgLoader);
}
PeiYong Zhang
committed
} #$ICUIsPresent
#
# Build::Make Xerces-C libraries, samples and tests
#
# 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");
PeiYong Zhang
committed
#
# release debug
# ==========================================
# vc6 vc7 ecl vc6 vc7 ecl
# ==========================================
# xercesc yes yes yes yes yes no
# depdom yes yes yes yes yes no
# samples yes yes yes no no no
# tests yes yes yes no no no
#
pchdir ("$ProjectDir");
if ($DevStudioVer eq "6.0") {
PeiYong Zhang
committed
if ($PlatformName eq "Win64") { # /USEENV
psystem("msdev xerces-all.dsw /MAKE \"all - $PlatformName Release\" /USEENV /REBUILD /OUT buildlog_release.txt");
psystem("msdev xerces-all.dsw /MAKE \"XercesLib - $PlatformName Debug\" /USEENV /REBUILD /OUT buildlog_debug.txt");
psystem("msdev xerces-all.dsw /MAKE \"XercesDeprecatedDOMLib - $PlatformName Debug\" /USEENV /REBUILD /OUT buildlog_depdom_debug.txt");
}
PeiYong Zhang
committed
else {
psystem("msdev xerces-all.dsw /MAKE \"all - $PlatformName Release\" /REBUILD /OUT buildlog_release.txt");
psystem("msdev xerces-all.dsw /MAKE \"XercesLib - $PlatformName Debug\" /REBUILD /OUT buildlog_debug.txt");
psystem("msdev xerces-all.dsw /MAKE \"XercesDeprecatedDOMLib - $PlatformName Debug\" /REBUILD /OUT buildlog_depdom_debug.txt");
}
} elsif ($DevStudioVer eq "7.0") {
PeiYong Zhang
committed
psystem("devenv /rebuild Release /out buildlog_release.txt /project all xerces-all.sln");
psystem("devenv /rebuild debug /out buildlog_debug.txt /project XercesLib xerces-all.sln");
psystem("devenv /rebuild debug /out buildlog_depdom_debug.txt /project XercesDeprecatedDOMLib xerces-all.sln");
} else { # "6.1"
psystem( "nmake -f all.mak \"CFG=all - $PlatformName Release\" CPP=$opt_x.exe >buildlog_release.txt 2>&1");
PeiYong Zhang
committed
system("type buildlog_release.txt");
system("type buildlog_debug.txt");
system("type buildlog_depdom_debug.txt");
PeiYong Zhang
committed
#
# Population Begin
#
# Population::include
#
pchdir ($targetdir);
PeiYong Zhang
committed
print "\nBuild is being copied from \'" . $ReleaseBuildDir . "\'";
PeiYong Zhang
committed
populateInclude();
PeiYong Zhang
committed
#
# Population::ICU and/or ICUMsgLoader
#
PeiYong Zhang
committed
print ("\n\nCopying icu outputs ...\n");
psystem("cp -fv $ICUROOT/bin/icuuc30.dll $targetdir/bin");
psystem("cp -fv $ICUROOT/bin/icuuc30d.dll $targetdir/bin");
# but just case, try lower case .dll as well
psystem("cp -fv $ICUROOT/bin/icudt30*.DLL $targetdir/bin");
psystem("cp -fv $ICUROOT/bin/icudt30*.dll $targetdir/bin");
psystem("cp -fv $ICUROOT/lib/icudata.lib $targetdir/lib");
psystem("cp -fv $ICUROOT/lib/icuuc.lib $targetdir/lib");
psystem("cp -fv $ICUROOT/lib/icuucd.lib $targetdir/lib");
PeiYong Zhang
committed
psystem("cp -Rfv $ICUROOT/include/* $targetdir/include");
# Copy the Resouce Bundle for ICUMsgLoader
PeiYong Zhang
committed
if ( $opt_m =~ m/icu/i) {
pchdir ("$ICUResourceDir");
psystem("cp -fv XercesMessages*.DLL $ReleaseBuildDir");
psystem("cp -fv XercesMessages*.lib $ReleaseBuildDir");
psystem("cp -fv XercesMessages*.res $targetdir/msg");
psystem("cp -fv XercesMessages*.DLL $targetdir/bin");
psystem("cp -fv XercesMessages*.lib $targetdir/lib");
PeiYong Zhang
committed
} #ICUIsPresent
PeiYong Zhang
committed
#
# Population::Xerces-c
#
print ("\n\nCopying Xerces-c outputs ...\n");
psystem("cp -fv $ReleaseBuildDir/*.dll $targetdir/bin");
psystem("cp -fv $ReleaseBuildDir/*.exe $targetdir/bin");
psystem("cp -fv $ReleaseBuildDir/xerces-c_*.lib $targetdir/lib");
psystem("cp -fv $ReleaseBuildDir/xerces-depdom_*.lib $targetdir/lib");
psystem("cp -fv $DebugBuildDir/xerces-c_*D.lib $targetdir/lib");
psystem("cp -fv $DebugBuildDir/xerces-depdom_*D.lib $targetdir/lib");
psystem("cp -fv $DebugBuildDir/xerces-c*D.dll $targetdir/bin");
# 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");
PeiYong Zhang
committed
# Populate the samples directory
populateSamples();
# windows specifics: sample projects
psystem("cp -Rfv $XERCESCROOT/samples/Projects/Win32/$VCBuildDir/* $targetdir/samples/Projects/Win32/$VCBuildDir");
# Populate the scripts and docs directory
populateMisc();
# 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 Windows Builds.
#
# UNIX builds happen here ...
#
PeiYong Zhang
committed
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
# Tasks:
#
# Preparation
# Initialize Vars
# Make the target directory and its main subdirectories
#
# 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
#
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/))) {
#
# Preparation Begin
#
# Population::Initialize Vars
#
Tinny Ng
committed
# Echo the current PATH to see what compiler it picks up
psystem ("echo PATH=$ENV{'PATH'}");
# Set defaults for platform-specific options.
if ($platform =~ m/AIX/i) {
$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"';
$ENV{'LIBPATH'}="$ICUROOT/lib:$XERCESCROOT/lib:$ENV{'LIBPATH'}";
$ENV{'PATH'}="$ICUROOT/bin:$ENV{'PATH'}";
psystem ("echo LIBPATH=$ENV{'LIBPATH'}");
PeiYong Zhang
committed
# Mac OS X
if ($platform =~ m/Darwin/i) {
$platform = "macosx";
PeiYong Zhang
committed
# 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
PeiYong Zhang
committed
# Code for mac os specific tools
if ($TAR eq "") {
$TAR = 'gnutar';
}
if ($MAKE eq "") {
$MAKE = 'make';
}
} # Mac OS
if ($platform eq 'HP-UX') {
# 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"';
$ENV{'SHLIB_PATH'}="$ICUROOT/lib:$XERCESCROOT/lib:$ENV{'SHLIB_PATH'}";
$ENV{'PATH'}="$ICUROOT/bin:$ENV{'PATH'}";
psystem ("echo SHLIB_PATH=$ENV{'SHLIB_PATH'}");
PeiYong Zhang
committed
}# HP-UX
Tinny Ng
committed
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"';
Tinny Ng
committed
psystem ("echo LIBRARY_PATH=$ENV{'LIBRARY_PATH'}");
PeiYong Zhang
committed
}# BeOS
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"';
$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'}");
PeiYong Zhang
committed
} # Linux
if ($platform =~ m/SunOS/i) {
$platform = "solaris";
PeiYong Zhang
committed
if ($opXt_c eq "") {$opt_c = "cc";}
if ($opt_x eq "") {$opt_x = "CC";}
$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'}");
PeiYong Zhang
committed
} # SunOS
if ($platform =~ m/ptx/i) {
# Check if the patches have been applied or not
$platform = "ptx";
print ("Error: Could not locate PTX-specific XML4C directory.\n");
print (" The PTX-specific patches must be applied to both XML4C and ICU before a build can succeed.\n");
exit(-1);
# Generally speaking, ICU must be built, before XML4C can be built, for ptx.
# If this case causes problems, we can revisit it in the future. Right now,
# we fail only if ICUROOT is defined but mh-ptx is not present.
if (!(-e "$ICUROOT/source/config/mh-ptx")) {
print ("Error: Could not locate PTX-specific ICU files.\n");
print (" The PTX-specific patches must be applied to both XML4C and ICU before a build can succeed.\n");
exit(-1);
$icu_cxxflags = '"-w -0"';
$icu_cflags = '"-w -0"';
# XMLINSTALL is a ptx-port-specific variable used for manipulating where the files are installed.
if (!length($ENV{'XMLINSTALL'})) {
print ("XMLINSTALL has not been explicitly defined. Setting it to \'$targetdir\'.\n");
$ENV{'XMLINSTALL'} = $targetdir;
$XMLINSTALL = $ENV{'XMLINSTALL'};
PeiYong Zhang
committed
} #ptx
if(($platform =~ m/CYGWIN/) && ($opt_c =~ m/gcc/)) {
$MAKE = "make";
$platform = "CYGWIN";
}
# Set defaults for platform-independent options.
if ($opt_m eq "") {$opt_m = "inmem"; } # In memory message loader.
if ($opt_n eq "") {$opt_n = "socket"; } # Socket based net accessor.
if ($opt_t eq "") {$opt_t = "native"; } # Native transcoding service.
if ($opt_b eq "") {$opt_b = "32"; } # bitstobuild.
PeiYong Zhang
committed
# Set defaults for platform tools
if ($TAR eq "") {
$TAR = 'tar';
}
if ($MAKE eq "") {
$MAKE = 'gmake';
}
# Check if the target directories already exist or not
if (-e $targetdir.".tar") {
print ("Error: The target file \'$targetdir.tar\' already exists.\n");
print (" You must delete the file \'$targetdir.tar\' to package your product.\n");
exit(1);
}
if (-e $srctargetdir.".tar") {
print ("Error: The target file \'$srctargetdir.tar\' already exists.\n");
print (" You must delete the file \'$srctargetdir.tar\' to package your product.\n");
exit(1);
}
PeiYong Zhang
committed
#
# Preparation::Make the target directory and its main subdirectories
#
createCommonDir();
#
# Build Begin
#
# Build::ICU and/or Resource bundle library for ICUMsgLoader
#
if ($ICUIsPresent ) {
PeiYong Zhang
committed
# Make the icu dlls
if (!(length($opt_j) > 0)) {
print ("Building ICU from $ICUROOT ...\n");
# First make the ICU files executable
pchdir ("$ICUROOT/source");
psystem ("chmod +x configure config.*");
psystem ("chmod +x install-sh");
$ENV{'ICU_DATA'} = "$ICUROOT/data";
if ($platform =~ m/ptx/i) {
psystem ("chmod +x runConfigureICU");
PeiYong Zhang
committed
} else {
# set the 32 bit or 64 bit
if ($opt_b eq "32") {
psystem ("CC=$opt_c CXX=$opt_x CXXFLAGS=$icu_cxxflags CFLAGS=$icu_cflags sh ./configure --prefix=$ICUROOT --disable-64bit-libs");
PeiYong Zhang
committed
}
else {
psystem ("CC=$opt_c CXX=$opt_x CXXFLAGS=$icu_cxxflags CFLAGS=$icu_cflags sh ./configure --prefix=$ICUROOT");
PeiYong Zhang
committed
}
PeiYong Zhang
committed
psystem ("$MAKE clean"); # Clean up the build, may want to comment this line out!
psystem ("rm -f $ICUROOT/data/*.o"); # make clean is not enough
psystem ("rm -f $ICUROOT/data/*.c"); # same for .c files
psystem ("$MAKE"); # This will take a long time!
psystem ("$MAKE install"); # Make this separate since this breaks on Solaris
} #opt_j
#
# resource bundle library for ICUMsgLoader is built by Makefile
# clean up intermediate files to make it rebuildable
#
if ($opt_m =~ m/icu/i) {
pchdir ("$ICUResourceDir");
psystem ("rm -f *.o *.res *.c *.lst *dll.mak");
PeiYong Zhang
committed
} #$ICUIsPresent
# For ptx, ICUROOT must now be set to XMLINSTALL for further work.
if ($platform =~ m/ptx/i) {
$ENV{'ICUROOT'} = $ENV{'XMLINSTALL'};
}
PeiYong Zhang
committed
#
# Build::Make Xerces-C libraries, samples and tests
#
print("\n\nBuild the xerces-c library ...\n");
psystem ("chmod +x run* con* install-sh");
PeiYong Zhang
committed
psystem ("./runConfigure -p$platform -c$opt_c -x$opt_x -m$opt_m -n$opt_n -t$opt_t -r$opt_r -b$opt_b");
psystem ("./runConfigure -p$platform -c$opt_c -x$opt_x -m$opt_m -n$opt_n -t$opt_t -b$opt_b");
psystem ("$MAKE clean"); # May want to comment this line out to speed up
psystem ("$MAKE");
PeiYong Zhang
committed
#
# Move ICU libs into lib dir, so samples will link. This matches the structure of
# the eventual binary packaging, even though we are doing it in the build directory.
#
PeiYong Zhang
committed
copyICUOnUNIX("$XERCESCROOT/lib");
# src/xercesc/util/MsgLoader/ICU/resources/Makefile has built and
# copied the message library to $XERCESCROOT/lib, we need copy over here.
}# $ICUIsPresent
PeiYong Zhang
committed
# build the samples
print("\n\nBuild the samples ...\n");
pchdir ("$XERCESCROOT/samples");
psystem ("chmod +x run* con* install-sh");
psystem ("./runConfigure -p$platform -c$opt_c -x$opt_x -b$opt_b");
psystem ("$MAKE clean"); # May want to comment this line out to speed up
psystem ("$MAKE");
PeiYong Zhang
committed
# build the tests
print("\n\nBuild the tests ...\n");
pchdir ("$XERCESCROOT/tests");
psystem ("chmod +x run* con* install-sh");
psystem ("./runConfigure -p$platform -c$opt_c -x$opt_x -b$opt_b");
psystem ("$MAKE clean"); # May want to comment this line out to speed up
psystem ("$MAKE");
pchdir ($targetdir);
PeiYong Zhang
committed
#
# Population Begin
#
# Population::include
#
populateInclude();
print "\nICU files are being copied from \'$ICUROOT\'";
psystem("cp -Rf $ICUROOT/include/* $targetdir/include");
PeiYong Zhang
committed
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
#
# Population::ICU and/or ICUMsgLoader
#
#
# Create symbolic link for those ICU libraries
#
if ($ICUIsPresent) {
# ICU
copyICUOnUNIX("$targetdir/lib");
# Copy the Resouce Bundle for ICUMsgLoader
if ( $opt_m =~ m/icu/i) {
print ("\n\nCopying ICU message bundles ...\n");
psystem("cp -f $XERCESCROOT/msg/XercesMessages*.res $targetdir/msg");
psystem("cp -f $XERCESCROOT/lib/libXercesMessages25.0.so .");
psystem("find . -name 'libXercesMessages25.0.so' -exec ln -s {} libXercesMessages25.so \\;");
psystem("find . -name 'libXercesMessages25.so' -exec ln -s {} libXercesMessages.so \\;");
psystem("cp -f $XERCESCROOT/lib/libXercesMessages.so.25.0 .");
psystem("find . -name 'libXercesMessages.so.25.0' -exec ln -s {} libXercesMessages.so.25 \\;");
psystem("find . -name 'libXercesMessages.so.25' -exec ln -s {} libXercesMessages.so \\;");
psystem("cp -f $XERCESCROOT/lib/libXercesMessages.sl.25.0 .");
psystem("find . -name 'libXercesMessages.sl.25.0' -exec ln -s {} libXercesMessages.sl.25 \\;");
psystem("find . -name 'libXercesMessages.sl.25' -exec ln -s {} libXercesMessages.sl \\;");
psystem("cp -f $XERCESCROOT/lib/libXercesMessages25.0.a .");
psystem("find . -name 'libXercesMessages25.0.a' -exec ln -s {} libXercesMessages25.a \\;");
psystem("find . -name 'libXercesMessages25.a' -exec ln -s {} libXercesMessages.a \\;");
PeiYong Zhang
committed
}
}
#
# Population::Xerces-c
#
print ("\n\nCopying binary outputs ...\n");
psystem("cp -Rf $XERCESCROOT/bin/* $targetdir/bin");
Tinny Ng
committed
psystem("rm -rf $targetdir/bin/obj");
Tinny Ng
committed
# Populate the library output directory
print ("\n\nCopying library outputs ...\n");
if ((-e "$XERCESCROOT/lib/libxerces-c.so.25.0" )) {
psystem("cp -f $XERCESCROOT/lib/libxerces-c.so.25.0 .");
psystem("ln -s libxerces-c.so.25.0 libxerces-c.so.25 ");
psystem("ln -s libxerces-c.so.25 libxerces-c.so ");
}
if ((-e "$XERCESCROOT/lib/libxerces-depdom.so.25.0" )) {
psystem("cp -f $XERCESCROOT/lib/libxerces-depdom.so.25.0 .");
psystem("ln -s libxerces-depdom.so.25.0 libxerces-depdom.so.25 ");
psystem("ln -s libxerces-depdom.so.25 libxerces-depdom.so ");
if ((-e "$XERCESCROOT/lib/libxerces-c.sl.25.0" )) {
psystem("cp -f $XERCESCROOT/lib/libxerces-c.sl.25.0 .");
psystem("ln -s libxerces-c.sl.25.0 libxerces-c.sl.25 ");
psystem("ln -s libxerces-c.sl.25 libxerces-c.sl ");
if ((-e "$XERCESCROOT/lib/libxerces-depdom.sl.25.0" )) {
psystem("cp -f $XERCESCROOT/lib/libxerces-depdom.sl.25.0 .");
psystem("ln -s libxerces-depdom.sl.25.0 libxerces-depdom.sl.25 ");
psystem("ln -s libxerces-depdom.sl.25 libxerces-depdom.sl ");
}
if ((-e "$XERCESCROOT/lib/libxerces-c25.0.so" )) {
psystem("cp -f $XERCESCROOT/lib/libxerces-c25.0.so .");
psystem("ln -s libxerces-c25.0.so libxerces-c25.so ");
psystem("ln -s libxerces-c25.so libxerces-c.so ");
if ((-e "$XERCESCROOT/lib/libxerces-depdom25.0.so" )) {
psystem("cp -f $XERCESCROOT/lib/libxerces-depdom25.0.so .");
psystem("ln -s libxerces-depdom25.0.so libxerces-depdom25.so ");
psystem("ln -s libxerces-depdom25.so libxerces-depdom.so ");
}
if ((-e "$XERCESCROOT/lib/libxerces-c25.0.a" )) {
psystem("cp -f $XERCESCROOT/lib/libxerces-c25.0.a . ");
psystem("ln -s libxerces-c25.0.a libxerces-c25.a ");
psystem("ln -s libxerces-c25.a libxerces-c.a ");
if ((-e "$XERCESCROOT/lib/libxerces-depdom25.0.a" )) {
psystem("cp -f $XERCESCROOT/lib/libxerces-depdom25.0.a . ");
PeiYong Zhang
committed
psystem("ln -s libxerces-depdom25.0.a libxerces-depdom25.a ");
psystem("ln -s libxerces-depdom25.a libxerces-depdom.a ");
}
# Mac OS X
if ((-e "$XERCESCROOT/lib/libxerces-c.25.0.dylib" )) {
psystem("cp -f $XERCESCROOT/lib/libxerces-c.25.0.dylib .");
psystem("ln -s libxerces-c.25.0.dylib libxerces-c.25.dylib ");
psystem("ln -s libxerces-c.25.dylib libxerces-c.dylib ");
}
PeiYong Zhang
committed
# Populate the Message Catalog Files
if ( $opt_m =~ m/iconv/i ) {
print ("\n\nCopying Message Catalog Files ...\n");
pchdir ("$targetdir/msg");
psystem("rm -f XercesMessages* ");
psystem("cp -f $XERCESCROOT/msg/XercesMessages*.cat .");
Tinny Ng
committed
}
# Populate the etc output directory like config.status and the map file
print ("\n\nCopying misc output to etc ...\n");
psystem("cp -Rf $XERCESCROOT/src/xercesc/config.status $targetdir/etc");
psystem("cp -Rf $XERCESCROOT/obj/*.map $targetdir/etc");
# Populate the samples directory
PeiYong Zhang
committed
populateSamples();
# UNIX specifics
foreach $iii ('config.guess', 'config.h.in', 'config.sub', 'configure', 'configure.in',
'install-sh', 'runConfigure', 'Makefile.in', 'Makefile.incl', 'Makefile') {
psystem("cp -f $XERCESCROOT/samples/$iii $targetdir/samples");
PeiYong Zhang
committed
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Populate the scripts and docs directory
populateMisc();
# Change the directory permissions
psystem ("chmod 644 `find $targetdir -type f`");
psystem ("chmod 755 $targetdir/bin/* $targetdir/lib/*");
psystem ("chmod +x $targetdir/samples/runConfigure $targetdir/samples/configure $targetdir/samples/install-sh");
psystem ("chmod +x $targetdir/samples/config.sub $targetdir/samples/config.guess $targetdir/samples/config.status");
psystem ("chmod 755 `find $targetdir -type d`");
# Now package it all up using tar
print ("\n\nTARing up all files ...\n");
pchdir ("$targetdir/..");
$zipname = $targetdir . ".tar";
$platformzipname = $zipname;
psystem ("$TAR -cvf $platformzipname $zipfiles");
# Finally compress the files
print ("Compressing $platformzipname ...\n");
psystem ("gzip $platformzipname");
} # end of UNIX build
sub createCommonDir() {
print ("\n\nCreating directories ...\n");
psystem ("mkdir $targetdir");
psystem ("mkdir $targetdir/bin");
psystem ("mkdir $targetdir/lib");
psystem ("mkdir $targetdir/msg");
psystem ("mkdir $targetdir/etc");
psystem ("mkdir $targetdir/include");
psystem ("mkdir $targetdir/include/xercesc");
psystem ("mkdir $targetdir/samples");
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/samples/SCMPrint");
psystem ("mkdir $targetdir/scripts");
psystem ("mkdir $targetdir/doc");
psystem ("mkdir $targetdir/doc/html");
psystem ("mkdir $targetdir/doc/html/apiDocs");
}
sub populateInclude() {
print ("\n\nCopying headers files ...\n");
@headerDirectories =
qw'sax
sax2
framework
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/BeOS
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