ICU-5821 Port of runConfigureICU script and overflow fix in unpax-icu.sh script for i5OS

X-SVN-Rev: 22479
This commit is contained in:
Jason Spieth 2007-08-23 03:37:11 +00:00
parent 1920c48674
commit 9abe99787b
3 changed files with 217 additions and 72 deletions

View file

@ -1,5 +1,5 @@
#!/usr/bin/qsh
# Copyright (C) 2000-2006, International Business Machines
# Copyright (C) 2000-2007, International Business Machines
# Corporation and others. All Rights Reserved.
#
# Authors:
@ -7,6 +7,7 @@
# Barry Novinger
# Steven R. Loomis
# George Rhoten
# Jason Spieth
#
# Shell script to unpax ICU and convert the files to an EBCDIC codepage.
# After extracting to EBCDIC, binary files are re-extracted without the
@ -14,42 +15,64 @@
#
# Set the following variable to the list of binary file suffixes (extensions)
#****************************************************************************
#binary_suffixes='ico ICO bmp BMP jpg JPG gif GIF brk BRK'
#ICU specific binary files
#****************************************************************************
binary_suffixes='brk BRK bin BIN res RES cnv CNV dat DAT icu ICU spp SPP xml XML'
data_files='icu/source/data/brkitr/* icu/source/data/locales/* icu/source/data/coll/* icu/source/data/rbnf/* icu/source/data/mappings/* icu/source/data/misc/* icu/source/data/translit/* icu/source/data/unidata/* icu/source/test/testdata/*'
#****************************************************************************
# Function: usage
# Description: Prints out text that describes how to call this script
# Input: None
# Output: None
#****************************************************************************
usage()
{
echo "Enter archive filename as a parameter: $0 icu-archive.tar"
}
#****************************************************************************
# first make sure we at least one arg and it's a file we can read
#****************************************************************************
# check for no arguments
if [ $# -eq 0 ]; then
usage
exit
fi
# tar file is argument 1
tar_file=$1
# check that the file is valid
if [ ! -r $tar_file ]; then
echo "$tar_file does not exist or cannot be read."
usage
exit
fi
# set up a few variables
#****************************************************************************
# Determine which directories in the data_files list
# are included in the provided archive
#****************************************************************************
for data_dir in $data_files
do
if (pax -f $tar_file $data_dir >/dev/null 2>&1)
then
ebcdic_data="$ebcdic_data `echo $data_dir`";
fi
done
#****************************************************************************
# Extract files. We do this in two passes. One pass for 819 files and a
# second pass for 37 files
#****************************************************************************
echo ""
echo "Extracting from $tar_file ..."
echo ""
# determine which directories in the data_files list
# are included in the provided archive
for data_dir in $data_files
do
if (pax -f $tar_file $data_dir >/dev/null 2>&1)
then
ebcdic_data="$ebcdic_data `echo $data_dir`";
fi
done
# extract everything as iso-8859-1 except these directories
pax -C 819 -rcvf $tar_file $ebcdic_data
@ -59,10 +82,17 @@ echo "Extracting files which must be in ibm-37 ..."
echo ""
pax -C 37 -rvf $tar_file $ebcdic_data
#****************************************************************************
# For files we have restored as CCSID 37, check the BOM to see if they
# should be processed as 819. Also handle files with special paths. Files
# that match will be added to binary files lists. The lists will in turn
# be processed to restore files as 819.
#****************************************************************************
echo ""
echo "Determining binary files ..."
echo ""
# Process BOMs
for file in `find ./icu \( -name \*.txt -print \)`; do
bom8=`head -n 1 $file|\
od -t x1|\
@ -73,15 +103,27 @@ for file in `find ./icu \( -name \*.txt -print \)`; do
#Find a converted UTF-8 BOM
if [ "$bom8" = "057 08b 0ab" -o "$bom8" = "57 8b ab" ]
then
if [ `echo $binary_files1 | wc -w` -lt 250 ]
file="`echo $file | cut -d / -f2-`"
if [ `echo $binary_files1 | wc -w` -lt 200 ]
then
binary_files1="$binary_files1 `echo $file | cut -d / -f2-`";
binary_files1="$binary_files1 $file";
elif [ `echo $binary_files2 | wc -w` -lt 200 ]
then
binary_files2="$binary_files2 $file";
elif [ `echo $binary_files3 | wc -w` -lt 200 ]
then
binary_files3="$binary_files3 $file";
elif [ `echo $binary_files4 | wc -w` -lt 200 ]
then
binary_files4="$binary_files4 $file";
else
binary_files2="$binary_files2 `echo $file | cut -d / -f2-`";
binary_files5="$binary_files5 $file";
fi
fi
done
# Process special paths
for i in $(pax -f $tar_file 2>/dev/null)
do
case $i in
@ -95,7 +137,7 @@ do
suf=${i#*.*}
if [ "$suf" = "$j" ]
then
binary_files2="$binary_files2 $i"
binary_files6="$binary_files6 $i"
break
fi
done
@ -107,18 +149,86 @@ do
done
# now see if a re-extract of binary files is necessary
if [ ${#binary_files1} -eq 0 -a ${#binary_files2} -eq 0 ]; then
if [ ${#binary_files1} -eq 0 ] &&
[ ${#binary_files2} -eq 0 ] &&
[ ${#binary_files3} -eq 0 ] &&
[ ${#binary_files4} -eq 0 ] &&
[ ${#binary_files5} -eq 0 ] &&
[ ${#binary_files6} -eq 0 ]
then
echo ""
echo "There are no binary files to restore."
else
echo "Restoring binary files ..."
echo ""
rm $binary_files1
rm $binary_files2
pax -C 819 -rvf $tar_file $binary_files1
pax -C 819 -rvf $tar_file $binary_files2
if [ `echo $binary_files1 | wc -w` -gt 0 ]
then
rm $binary_files1
fi
if [ `echo $binary_files2 | wc -w` -gt 0 ]
then
rm $binary_files2
fi
if [ `echo $binary_files3 | wc -w` -gt 0 ]
then
rm $binary_files3
fi
if [ `echo $binary_files4 | wc -w` -gt 0 ]
then
rm $binary_files4
fi
if [ `echo $binary_files5 | wc -w` -gt 0 ]
then
rm $binary_files5
fi
if [ `echo $binary_files6 | wc -w` -gt 0 ]
then
rm $binary_files6
fi
if [ `echo $binary_files1 | wc -w` -gt 0 ]
then
pax -C 819 -rvf $tar_file $binary_files1
fi
if [ `echo $binary_files2 | wc -w` -gt 0 ]
then
pax -C 819 -rvf $tar_file $binary_files2
fi
if [ `echo $binary_files3 | wc -w` -gt 0 ]
then
pax -C 819 -rvf $tar_file $binary_files3
fi
if [ `echo $binary_files4 | wc -w` -gt 0 ]
then
pax -C 819 -rvf $tar_file $binary_files4
fi
if [ `echo $binary_files5 | wc -w` -gt 0 ]
then
pax -C 819 -rvf $tar_file $binary_files5
fi
if [ `echo $binary_files6 | wc -w` -gt 0 ]
then
pax -C 819 -rvf $tar_file $binary_files6
fi
fi
#****************************************************************************
# Generate and run the configure script
#****************************************************************************
echo ""
echo "Generating qsh compatible configure ..."
echo ""
@ -130,3 +240,4 @@ chmod 755 icu/source/configure
echo ""
echo "$0 has completed extracting ICU from $tar_file."

View file

@ -1254,20 +1254,9 @@ Data set name type : PDS</samp>
<li>
Create i5/OS target library. This library will be the target for the
resulting modules, programs and service programs. You will specify this
library on the OUTPUTDIR environment variable in step 2.
library on the OUTPUTDIR environment variable.
<pre>
<samp>CRTLIB LIB(<i>libraryname</i>)</samp>
</pre>
</li>
<li>
Set up the following environment variables in your build process (use the
<i>libraryname</i> from the previous step). The <i>libraryname</i>
identifies target i5/OS library for *module, *pgm and *srvpgm objects.
<pre>
<samp>ADDENVVAR ENVVAR(CC) VALUE('/usr/bin/icc')
ADDENVVAR ENVVAR(CXX) VALUE('/usr/bin/icc')
ADDENVVAR ENVVAR(MAKE) VALUE('/usr/bin/gmake')
<samp>CRTLIB LIB(<i>libraryname</i>)
ADDENVVAR ENVVAR(OUTPUTDIR) VALUE('<i>libraryname</i>')</samp>
</pre>
</li>
@ -1283,23 +1272,59 @@ ADDENVVAR ENVVAR(OUTPUTDIR) VALUE('<i>libraryname</i>')</samp>
<li>Change your current directory to icu/source.</li>
<li>Run <tt>'export CFLAGS=-O4 CXXFLAGS=-O4'</tt> to optimize your build of
ICU. If the build fails, rerun these build steps without this step before
asking the icu-support mailing list for help.</li>
<li>Run <tt>'./runConfigureICU i5OS'</tt> (See <a href="#HowToConfigureICUi5OS">configuration
note</a> below).</li></li>
<li>Run <tt>'./configure'</tt></li>
<li>Type <tt>"gmake"</tt> (or "make" if GNU make is the default make on
your platform) to compile the libraries and all the data files. The proper
name of the GNU make command is printed at the end of the configuration
run, as in "You must use gmake to compile ICU".
(See <a href="#HowToCompilei5OS">compilation note</a> below).</li>
<li>Run <tt>'gmake'</tt> to build ICU.</li>
<li>Optionally, type <tt>"gmake check"</tt> to run the test suite, which
checks for ICU's functionality integrity (See <a href=
"#HowToTesti5OS">testing note</a> below).</li>
<li>Run <tt>'gmake check'</tt> to build the tests.</li>
<li>The "utility/MultithreadTest" test in intltest may have failed during
<tt>'gmake check'</tt>. In order to make this test pass, please use
<tt>'gmake check QIBM_MULTI_THREADED=Y'</tt> after you built the tests with
<tt>'gmake check'</tt> from the previous step. You can look at the <a href=
"http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/apis/concept4.htm">
iSeries Information Center</a> for more details.</li>
<li>Type <tt>"gmake install"</tt> to install ICU. If you used the --prefix=
option on configure or runConfigureICU, ICU will be installed to the
directory you specified. (See <a href="#HowToInstallICUi5OS">installation
note</a> below).</li>
</ol>
<p><a name="HowToConfigureICUi5OS" id="HowToConfigureICUi5OS"><strong>Configuring ICU
NOTE:</strong></a> Type <tt>"./runConfigureICU --help"</tt> for help on how
to run it and a list of supported platforms. You may also want to type
<tt>"./configure --help"</tt> to print the available configure options that
you may want to give runConfigureICU. If you are not using the
runConfigureICU script, or your platform is not supported by the script, you
may need to set your CC, CXX, CFLAGS and CXXFLAGS environment variables, and
type <tt>"./configure"</tt>. Some of the more frequently used options to
configure are --disable-64bit-libs to create 32-bit libraries, and --srcdir
to do out of source builds (build the libraries in the current location).</p>
<p><a name="HowToCompilei5OS" id="HowToCompilei5OS"><strong>Setting the Make Command
NOTE:</strong></a> Depending on how the system is set up, the command listed
at the end of the configuration run may not work on all files. In those cases you may
need to export the path to the gmake utility. Please type <tt>"EXPORT MAKE=/usr/bin/gmake"</tt> or
you can <tt>ADDENVVAR ENVVAR(MAKE) VALUE('/usr/bin/gmake')</tt> from the i5/OS command line
. Then run the gmake command.
</p>
<p><a name="HowToTesti5OS" id="HowToTesti5OS"><strong>Running Multithreaded Tests
NOTE:</strong></a> The "utility/MultithreadTest" test in intltest may have failed during
<tt>'gmake check'</tt>. In order to make this test pass, please use
<tt>'gmake check QIBM_MULTI_THREADED=Y'</tt>. You can look at the <a href=
"http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/apis/concept4.htm">
iSeries Information Center</a> for more details.</p>
<p><a name="HowToInstallICUi5OS" id="HowToInstallICUi5OS"><strong>Installing ICU
NOTE:</strong></a> Some platforms use package management tools to control the
installation and uninstallation of files on the system, as well as the
integrity of the system configuration. You may want to check if ICU can be
packaged for your package management tools by looking into the "packaging"
directory. (Please note that if you are using a snapshot of ICU from CVS, it
is probable that the packaging scripts or related files are not up to date
with the contents of ICU at this time, so use them with caution).</p>
<!-- end build environment -->
<h2><a name="HowToPackage" href="#HowToPackage" id="HowToPackage">How To

View file

@ -31,12 +31,13 @@ The following names can be supplied as the argument for platform:
AIX Use the IBM Visual Age xlc_r/xlC_r compilers on AIX
AIX/GCC Use the GNU gcc/g++ compilers on AIX
BeOS Use the GNU gcc/g++ compilers on BeOS
Cygwin Use the GNU gcc/g++ compilers on Cygwin
Cygwin/MSVC Use the Microsoft Visual C++ compiler on Cygwin
Cygwin/MSVC2005 Use the Microsoft Visual C++ 2005 compiler on Cygwin
Cygwin/ICL Use the Intel C++ compiler on Cygwin
FreeBSD Use the GNU gcc/g++ compilers on Free BSD
HP-UX/ACC Use the HP ANSI C/Advanced C++ compilers on HP-UX 11
i5OS Use the i5/OS C++ compilers on i5/OS
Linux Use the GNU gcc/g++ compilers on Linux
Linux/ECC Use the Intel ECC compiler on Linux
Linux/ICC Use the Intel ICC compiler on Linux
@ -167,6 +168,14 @@ case $platform in
RELEASE_CFLAGS='+O2 +Ofltacc'
RELEASE_CXXFLAGS='+O2 +Ofltacc'
;;
i5OS)
THE_OS="i5/OS"
THE_COMP="the i5/OS C++"
CC=/usr/bin/icc; export CC
CXX=/usr/bin/icc; export CXX
RELEASE_CFLAGS='-O4'
RELEASE_CXXFLAGS='-O4'
;;
Linux/ECC)
THE_OS="Linux"
THE_COMP="Intel ECC 7.1"
@ -214,18 +223,6 @@ case $platform in
DEBUG_CXXFLAGS='/Zi'
DEBUG_LDFLAGS='/DEBUG'
;;
Cygwin/MSVC2005)
THE_OS="Windows with Cygwin"
THE_COMP="Microsoft Visual C++ 2005"
CC=cl; export CC
CXX=cl; export CXX
RELEASE_CFLAGS='/O2 /Ob2'
RELEASE_CXXFLAGS='/O2 /Ob2'
RELEASE_LDFLAGS='/OPT:NOWIN98'
DEBUG_CFLAGS='/Zi'
DEBUG_CXXFLAGS='/Zi'
DEBUG_LDFLAGS='/DEBUG'
;;
Cygwin/ICL)
THE_OS="Windows with Cygwin"
THE_COMP="Intel C++"
@ -262,13 +259,28 @@ case $platform in
CC=qcc; export CC
CXX=QCC; export CXX
;;
BeOS)
THE_OS="BeOS"
THE_COMP="the GNU C++"
OPTIMIZATIONS="-fdefault-inline -fdefer-pop -fforce-mem -fforce-addr \
-finline -finline-functions \
-fkeep-inline-functions -fkeep-static-consts -fbranch-count-reg \
-ffunction-cse -fstrength-reduce -fthread-jumps -fcse-follow-jumps \
-fcse-skip-blocks -frerun-cse-after-loop -frerun-loop-opt \
-fexpensive-optimizations -foptimize-register-move -fregmove \
-fschedule-insns -fschedule-insns2 -ffloat-store -funroll-loops \
-fmove-all-movables -freduce-all-givs -fpeephole \
-funroll-all-loops -ffunction-sections -fdata-sections"
RELEASE_CFLAGS="$OPTIMIZATIONS"
RELEASE_CXXFLAGS="$OPTIMIZATIONS"
;;
zOS)
THE_OS="z/OS (OS/390)"
THE_COMP="z/OS C/C++"
CC=cc; export CC
CXX=cxx; export CXX
RELEASE_CFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'"
RELEASE_CXXFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'"
export RELEASE_CFLAGS="-2 -Wc,'inline(auto,noreport,500,2500)'"
export RELEASE_CXXFLAGS="-2 -Wc,'inline(auto,noreport,300,2500)'"
;;
zOSV1R2)
THE_OS="z/OS 1.2"
@ -280,8 +292,8 @@ case $platform in
export LDFLAGS="-Wl,'compat=pm3'"
export CFLAGS="-Wc,'target(zOSV1R2)'"
export CXXFLAGS="-Wc,'target(zOSV1R2)'"
export RELEASE_CFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'"
export RELEASE_CXXFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'"
export RELEASE_CFLAGS="-2 -Wc,'inline(auto,noreport,500,2500)'"
export RELEASE_CXXFLAGS="-2 -Wc,'inline(auto,noreport,300,2500)'"
;;
*)
>&2 echo "$me: unrecognized platform \"$platform\" (use --help for help)"
@ -305,6 +317,7 @@ then
then
CFLAGS="$CFLAGS $RELEASE_CFLAGS"
fi
export CFLAGS
if test "$RELEASE_CXXFLAGS" = ""
then
case $CXX in
@ -317,10 +330,7 @@ then
then
CXXFLAGS="$CXXFLAGS $RELEASE_CXXFLAGS"
fi
if test "$RELEASE_LDFLAGS" != ""
then
LDFLAGS="$LDFLAGS $RELEASE_LDFLAGS"
fi
export CXXFLAGS
fi
if test $debug -eq 1
@ -329,20 +339,19 @@ then
then
CFLAGS="$CFLAGS $DEBUG_CFLAGS"
fi
export CFLAGS
if test "$DEBUG_CXXFLAGS" != ""
then
CXXFLAGS="$CXXFLAGS $DEBUG_CXXFLAGS"
fi
export CXXFLAGS
if test "$DEBUG_LDFLAGS" != ""
then
LDFLAGS="$LDFLAGS $DEBUG_LDFLAGS"
fi
export LDFLAGS
fi
export CFLAGS
export CXXFLAGS
export LDFLAGS
# Run configure
echo "Running ./configure $OPTS $@ for $THE_OS using $THE_COMP compiler"