From be1a29532e01f92225baf11600f9c70ca98ef722 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Thu, 15 Sep 2011 23:31:15 +0000 Subject: [PATCH] ICU-8784 more fixes for i X-SVN-Rev: 30671 --- .gitattributes | 1 + icu4c/as_is/bomlist.py | 38 ++++ icu4c/as_is/os400/bldiculd.sh | 3 + icu4c/as_is/os400/convertConfigure.sed | 3 +- icu4c/as_is/os400/fixup-icu.sh | 65 +++++++ icu4c/as_is/os400/iculd.c | 249 +++++++++++++++++++++++++ icu4c/as_is/os400/unpax-icu.sh | 81 +++----- icu4c/readme.html | 14 +- icu4c/source/config/dist.mk | 3 +- 9 files changed, 393 insertions(+), 64 deletions(-) create mode 100644 icu4c/as_is/bomlist.py create mode 100755 icu4c/as_is/os400/bldiculd.sh create mode 100755 icu4c/as_is/os400/fixup-icu.sh create mode 100644 icu4c/as_is/os400/iculd.c diff --git a/.gitattributes b/.gitattributes index 84b3e770060..47420404061 100644 --- a/.gitattributes +++ b/.gitattributes @@ -48,6 +48,7 @@ README text !eol *.spp -text *.tri2 -text +icu4c/as_is/bomlist.py -text icu4c/icu4c.css -text icu4c/source/allinone/icucheck.bat -text icu4c/source/common/common.vcxproj -text diff --git a/icu4c/as_is/bomlist.py b/icu4c/as_is/bomlist.py new file mode 100644 index 00000000000..22bf38bbeed --- /dev/null +++ b/icu4c/as_is/bomlist.py @@ -0,0 +1,38 @@ +#!/usr/bin/python + +# Copyright (C) 2011 IBM Corporation and Others. All Rights Reserved. +# +# run in icu/ +# will create file icu/as_is/bomlist.txt +# +# Usage: +# ( python as_is/bomlist.py > as_is/bomlist.txt ) || rm -f as_is/bomlist.txt + +import os +import codecs + +tree = os.walk(".") + +nots=0 +notutf8=0 +noprops=0 +utf8=0 +fixed=0 +tfiles=0 +bom=codecs.BOM_UTF8 + + +for ent in tree: + (path,dirs,files) = ent + if(path.find("/.svn") != -1): + continue + for file in files: + tfiles=tfiles+1 + fp = (path + "/" + file) + if not os.path.isfile(fp): + continue + f = open(fp, 'rb') + bytes=f.read(3) + if bytes and (bytes == bom): + print 'icu/'+fp[2::] + f.close() diff --git a/icu4c/as_is/os400/bldiculd.sh b/icu4c/as_is/os400/bldiculd.sh new file mode 100755 index 00000000000..5b7f0e5bae6 --- /dev/null +++ b/icu4c/as_is/os400/bldiculd.sh @@ -0,0 +1,3 @@ +#!/bin/sh +# /* Copyright (C) 2011 IBM Corporation and Others. All Rights Reserved */ +icc -o iculd iculd.c diff --git a/icu4c/as_is/os400/convertConfigure.sed b/icu4c/as_is/os400/convertConfigure.sed index 62319589586..731aa1d3389 100644 --- a/icu4c/as_is/os400/convertConfigure.sed +++ b/icu4c/as_is/os400/convertConfigure.sed @@ -1,4 +1,4 @@ -# Copyright (C) 2006-2009, International Business Machines Corporation +# Copyright (C) 2006-2011, International Business Machines Corporation # and others. All Rights Reserved. # # Use "test -x" instead of "test -f" most of the time. @@ -23,6 +23,7 @@ s/ diff / cmp -s /g ## srl # trouble w/ redirects. s% >&$3%%g +s% >&$4% >$4%g s%^ac_cr=%# AWK reads ASCII, not EBCDIC\ touch -C 819 $tmp/defines.awk $tmp/subs.awk $tmp/subs1.awk conf$$subs.awk\ \ diff --git a/icu4c/as_is/os400/fixup-icu.sh b/icu4c/as_is/os400/fixup-icu.sh new file mode 100755 index 00000000000..092c748a511 --- /dev/null +++ b/icu4c/as_is/os400/fixup-icu.sh @@ -0,0 +1,65 @@ +#!/usr/bin/qsh +# Copyright (C) 2000-2011, International Business Machines +# Corporation and others. All Rights Reserved. +# +# Authors: +# Ami Fixler +# Barry Novinger +# Steven R. Loomis +# George Rhoten +# Jason Spieth +# +# +# This script detects if any UTF-8 files were incorrectly converted to EBCDIC, and +# converts them back. + +if [ -z "$QSH_VERSION" ]; +then + QSH=0 + echo "QSH not detected (QSH_VERSION not set) - just testing." +else + QSH=1 + #echo "QSH version $QSH_VERSION" +fi +export QSH + +tar_file=$1 +echo "" +echo "Determining binary files by BOM ..." +echo "" +bin_count=0 +binary_files="" +# Process BOMs + for file in `find ./icu/source/data/unidata \( -name \*.txt -print \)`; do + bom8=`od -t x1 -N 3 $file|\ + head -n 1|\ + cut -c10-18`; + #Find a converted UTF-8 BOM + echo "file $file bom /${bom8}/" + if [ "$bom8" = "57 8b ab" ] + then + file="`echo $file | cut -d / -f2-`" + echo "converting ${file}" + if [ `echo $binary_files | wc -w` -lt 200 ] + then + bin_count=`expr $bin_count + 1` + binary_files="$binary_files $file"; + else + echo "Restoring binary files by BOM ($bin_count)..." + rm $binary_files; + pax -C 819 -rvf $tar_file $binary_files; + echo "Determining binary files by BOM ($bin_count)..." + binary_files="$file"; + bin_count=`expr $bin_count + 1` + fi + fi + done + if [ `echo $binary_files | wc -w` -gt 0 ] + then + echo restoring + rm $binary_files + pax -C 819 -rvf $tar_file $binary_files + fi + + + diff --git a/icu4c/as_is/os400/iculd.c b/icu4c/as_is/os400/iculd.c new file mode 100644 index 00000000000..5ff30b5d734 --- /dev/null +++ b/icu4c/as_is/os400/iculd.c @@ -0,0 +1,249 @@ +/* Copyright (C) 2011 IBM Corporation and Others. All Rights Reserved */ + +/** + Input: + -o makeconv makeconv.o ucnvstat.o ../../lib/libicuuc48.so -qOPTION='*DUPPROC *DUPVAR*' + +CRTPGM PGM(SRLICU/MAKECONV) MODULE(SRLICU/MAKECONV SRLICU/UCNVSTAT SRLICU/GENMBCS SRLICU/GENCNVEX) BNDSRVPGM(SRLICU/LIBICUUC48 SRLICU/LIBICUTU48 SRLICU/LIBICUIN48) OPTION(*DUPPROC *DUPVAR) REPLACE(*YES) + +Handles .o ( modules ), .so ( srvpgm ), .a ( bnddir ). + +TODO: + + - cleanup + - much better error handling + - factor common code + - instead of caring about .o vs .so vs .a, just read the link - if it ends in .srvpgm then treat it as a service program, etc. + +*/ + +#include +#include +#include +#include + +#ifndef TEST_MODE +#define TEST_MODE 0 +#endif + + +#if !TEST_MODE +#include +#else +static int Qp0zSystem(const char *cmd) { + printf("CL: %s\n", cmd); + return 0; +} +#endif + +static int runcmd(const char *cmd) { + int rc; + printf("%s\n", cmd); + rc = Qp0zSystem(cmd); + if(rc==0) { + printf("..ok\n"); + return 0; + } else if(rc<0){ + printf("..Qp0zSystem failed.\n"); + return 1; + } else { + printf("..System call failed.\n"); + return 1; + } +} + +int main(int argc, const char *argv[]) { + int i; + + char buf[8048]; + char opt[4100]; + char objs[4024]; + char libs[4024]; + char bnddirs[4024]; + const char *prog=""; + const char *progshort=prog; + const char *outputdir=getenv("OUTPUTDIR"); + + printf("# OUTPUTDIR=%s ",outputdir); + for(i=0;i= 10) { + nlen = 10; + } + + if(readlink(b,linkbuf,200)>0) { + /* printf("linkbuf %s for %s\n", linkbuf, b); */ + /* /qsys.lib/srlicu.lib/currtest.module */ + char *mend = strrchr(linkbuf,'.'); + if(mend) { + *mend=0; + mend = strrchr(linkbuf,'/'); + if(mend) { + mend++; + strcpy(outbuf,mend); + b=outbuf; + nlen=strlen(b); + } + } + } else { + /* perror("readlink"); + puts(b); */ + } + + strcat(objs,outputdir); + strcat(objs,"/"); + strncat(objs,b,nlen); + strcat(objs, " "); + } else if(argv[i][n-1]=='a' && + argv[i][n-2]=='.') { + const char *b = argv[i]; + char linkbuf[200]; + char outbuf[100]; + int nlen = n-2; + + if(nlen >= 10) { + nlen = 10; + } + + if(readlink(b,linkbuf,200)>0) { + /* printf("linkbuf %s for %s\n", linkbuf, b); */ + /* /qsys.lib/srlicu.lib/currtest.srvpgm */ + char *mend = strrchr(linkbuf,'.'); + if(mend) { + *mend=0; + mend = strrchr(linkbuf,'/'); + if(mend) { + mend++; + strcpy(outbuf,mend); + b=outbuf; + nlen=strlen(b); + } + } + } else { + /* perror("readlink"); + puts(b); */ + } + + strcat(bnddirs,outputdir); + strcat(bnddirs,"/"); + strncat(bnddirs,b,nlen); + strcat(bnddirs, " "); + } else if(argv[i][n-1]=='o' && + argv[i][n-2]=='s' && + argv[i][n-3]=='.') { + const char *p = strrchr(argv[i],'/'); + if(!p) { + printf("Can't find trailing slash in %s\n", argv[i]); + return 1; + } + strcat(libs,outputdir); + strcat(libs,"/"); + strncat(libs,p+1,strlen(p)-4); + strcat(libs," "); + } else { + printf("Unknown input file: %s\n", argv[i]); + return 1; + } + } + } + + if(prog[0]==0) { + printf("no program (-o) option specified.\n"); + return 1; + } + + sprintf(buf,"CRTPGM PGM(%s/%s) MODULE(%s) BNDSRVPGM(%s) BNDDIR(%s) OPTION(%s) REPLACE(*YES)", + outputdir,progshort, + + objs, + + libs, + + bnddirs, + + opt); + + + if(runcmd(buf)) { + return 1; + } + + /* -- OK */ + { + char path1[1000]; + sprintf(path1,"/qsys.lib/%s.lib/%s.pgm", + outputdir, + progshort); + printf("# ln -s %s %s\n", path1, prog); + if((!TEST_MODE) && symlink(path1,prog)) { + perror("symlink"); + if(errno!=EEXIST) { /* ignored */ + return 1; + } + } + } + return 0; +} + + + + + + + + diff --git a/icu4c/as_is/os400/unpax-icu.sh b/icu4c/as_is/os400/unpax-icu.sh index b58308f72e2..16e1cbab1dd 100755 --- a/icu4c/as_is/os400/unpax-icu.sh +++ b/icu4c/as_is/os400/unpax-icu.sh @@ -1,5 +1,5 @@ #!/usr/bin/qsh -# Copyright (C) 2000-2010, International Business Machines +# Copyright (C) 2000-2011, International Business Machines # Corporation and others. All Rights Reserved. # # Authors: @@ -64,18 +64,8 @@ if [ ! -r $tar_file ]; then exit fi -#**************************************************************************** -# Determine which directories in the data_files list -# are included in the provided archive -#**************************************************************************** -echo "Finding data_files ..." -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 +# treat all data files as ebcdic +ebcdic_data=$data_files #**************************************************************************** # Extract files. We do this in two passes. One pass for 819 files and a @@ -105,7 +95,12 @@ echo "Determining binary files by BOM ..." echo "" bin_count=0 # Process BOMs -for file in `find ./icu \( -name \*.txt -print \)`; do +if [ -f icu/as_is/bomlist.txt ]; +then + echo "Using icu/as_is/bomlist.txt" + pax -C 819 -rvf $tar_file `cat icu/as_is/bomlist.txt` +else + for file in `find ./icu \( -name \*.txt -print \)`; do bom8=`head -n 1 $file|\ od -t x1|\ head -n 1|\ @@ -130,52 +125,22 @@ for file in `find ./icu \( -name \*.txt -print \)`; do bin_count=`expr $bin_count + 1` fi fi -done + done + # now see if a re-extract of binary files is necessary + if [ `echo $binary_files | wc -w` -gt 0 ] + then + echo "Restoring binary files ($bin_count) ..." + rm $binary_files + pax -C 819 -rvf $tar_file $binary_files + fi +fi +echo "# Processing special paths." # Process special paths -for i in $(pax -f $tar_file 2>/dev/null) -do - case $i in - */) -# then this entry is a directory - ;; - *.*) -# then this entry has a dot in the filename - for j in $binary_suffixes - do - suf=${i#*.*} - if [ "$suf" = "$j" ] - then - - if [ `echo $binary_files | wc -w` -lt 200 ] - then - binary_files="$binary_files $i"; - bin_count=`expr $bin_count + 1` - else - echo "Restoring binary files by special paths ($bin_count) ..." - rm $binary_files; - pax -C 819 -rvf $tar_file $binary_files; - echo "Determining binary files by special paths ($bin_count) ..." - binary_files="$i"; - bin_count=`expr $bin_count + 1` - fi - break - fi - done - ;; - *) -# then this entry does not have a dot in it - ;; - esac -done - -# now see if a re-extract of binary files is necessary -if [ `echo $binary_files | wc -w` -gt 0 ] -then - echo "Restoring binary files ($bin_count) ..." - rm $binary_files - pax -C 819 -rvf $tar_file $binary_files -fi +more_bin_files=$(find icu -type f \( -name '*.zzz' `echo $binary_suffixes | sed -e 's%[a-zA-Z]*%-o -name \*.&%g'` \) -print) +echo "Restoring binary files by special paths ($bin_count) ..." +rm $more_bin_files +pax -C 819 -rvf $tar_file $more_bin_files #**************************************************************************** # Generate and run the configure script diff --git a/icu4c/readme.html b/icu4c/readme.html index 982cea9722a..39e63e1c461 100644 --- a/icu4c/readme.html +++ b/icu4c/readme.html @@ -18,7 +18,7 @@

International Components for Unicode
ICU 49 ReadMe

-

Last updated: 2011-June-24
+

Last updated: 2011-Sep-15
Copyright © 1997-2011 International Business Machines Corporation and others. All Rights Reserved.

@@ -1234,23 +1234,29 @@ ADDENVVAR ENVVAR(OUTPUTDIR) VALUE('libraryname') REPLACE(*YES)
  • Set up the following environment variables and job characteristics in your build process
    -ADDENVVAR ENVVAR(MAKE) VALUE('/usr/bin/gmake') REPLACE(*YES)
    +ADDENVVAR ENVVAR(MAKE) VALUE('gmake') REPLACE(*YES)
     CHGJOB CCSID(37)
     
  • Run 'QSH'
  • + +
  • Run:
    export PATH=/QIBM/ProdData/DeveloperTools/qsh/bin:$PATH:/QOpenSys/usr/bin +
  • -
  • Run gunzip on the ICU source code compressed tar archive +
  • Run gzip -d on the ICU source code compressed tar archive (icu-X.Y.tgz).
  • Run unpax-icu.sh on the tar file generated from the previous step.
  • +
  • Change your current directory to icu/as_is/os400.
  • +
  • Run qsh bldiculd.sh to build the program ICULD which ICU will use for linkage.
  • +
  • Change your current directory to icu/source.
  • Run './runConfigureICU IBMi' (See configuration note for details).
  • -
  • Run 'gmake' to build ICU.
  • +
  • Run 'gmake' to build ICU. (Do not use the -j option)
  • Run 'gmake check QIBM_MULTI_THREADED=Y' to build and run the tests. You can look at the as_is/bomlist.txt || rm -f as_is/bomlist.txt ) ( cd $(DISTY_TMP) ; tar cfpz $(DISTY_FILE_TGZ) icu ) ( cd $(DISTY_TMP) ; zip -rlq $(DISTY_FILE_ZIP) icu ) ls -l $(DISTY_FILE) -- 2.40.0