]> granicus.if.org Git - icu/commitdiff
ICU-8784 more fixes for i
authorSteven R. Loomis <srl@icu-project.org>
Thu, 15 Sep 2011 23:31:15 +0000 (23:31 +0000)
committerSteven R. Loomis <srl@icu-project.org>
Thu, 15 Sep 2011 23:31:15 +0000 (23:31 +0000)
X-SVN-Rev: 30671

.gitattributes
icu4c/as_is/bomlist.py [new file with mode: 0644]
icu4c/as_is/os400/bldiculd.sh [new file with mode: 0755]
icu4c/as_is/os400/convertConfigure.sed
icu4c/as_is/os400/fixup-icu.sh [new file with mode: 0755]
icu4c/as_is/os400/iculd.c [new file with mode: 0644]
icu4c/as_is/os400/unpax-icu.sh
icu4c/readme.html
icu4c/source/config/dist.mk

index 84b3e770060f073a9a557b0f3640d61e5fee830a..47420404061cdc962c194a76c1444156434c6adb 100644 (file)
@@ -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 (file)
index 0000000..22bf38b
--- /dev/null
@@ -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 (executable)
index 0000000..5b7f0e5
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+#  /* Copyright (C) 2011 IBM Corporation and Others. All Rights Reserved */
+icc -o iculd iculd.c
index 62319589586f3f813b016d64e4e65135e5a21000..731aa1d33893ada1744f6c64afc8dd5306380b35 100644 (file)
@@ -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 (executable)
index 0000000..092c748
--- /dev/null
@@ -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 (file)
index 0000000..5ff30b5
--- /dev/null
@@ -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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#ifndef TEST_MODE
+#define TEST_MODE 0
+#endif
+
+
+#if !TEST_MODE
+#include <qp0z1170.h>
+#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<argc;i++) {
+    printf("%s ", argv[i]);
+  }
+  printf("\n");
+
+  buf[0]=0;
+  opt[0]=0;
+  objs[0]=0;
+  libs[0]=0;
+  bnddirs[0]=0;
+
+  for(i=1;i<argc;i++) {
+    if(argv[i][0]=='-') {
+      switch(argv[i][1]) {
+      case 'O':
+        printf(".. ignoring optimization: %s\n", argv[i]);
+        break;
+      case 'g':
+        printf(".. ignoring debugging: %s\n", argv[i]);
+        break;
+      case 'l':
+        printf(".. ignoring lib: %s\n", argv[i]);
+        break;
+      case 'v':
+        printf(".. already verbose\n");
+        break;
+      case 'o':
+        i++;
+        prog=argv[i];
+        progshort=strrchr(prog,'/');
+        if(!progshort) {
+          progshort=prog;
+        } else {
+          progshort++; /*  / */
+        }
+        break;
+      case 'q':
+        if(!strncmp(argv[i]+2,"OPTION=",7)) {
+          strcat(opt,argv[i]+9);
+        } else {
+          printf("Unknown -q option: %s\n", argv[i]);
+          return 1;
+        }
+        break;
+      default:
+        printf("Unknown option: %s\n", argv[i]);
+        return 1;
+      }
+    } else {
+      int n = strlen(argv[i]);
+      if(argv[i][n-1]=='o' &&
+         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.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;
+}
+
+
+
+
+
+
+
+
index b58308f72e2c99d12f427190c1df5fe29b973a3d..16e1cbab1ddc1dcfdac7d42778095cf63a16e077 100755 (executable)
@@ -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
index 982cea9722a54f265c3c008722fe49df036400dd..39e63e1c461771ff44289d50be1ff51d393c28fa 100644 (file)
@@ -18,7 +18,7 @@
     <h1>International Components for Unicode<br />
      <abbr title="International Components for Unicode">ICU</abbr> 49 ReadMe</h1>
 
-    <p>Last updated: 2011-June-24<br />
+    <p>Last updated: 2011-Sep-15<br />
      Copyright &copy; 1997-2011 International Business Machines Corporation and
     others. All Rights Reserved.</p>
     <!-- Remember that there is a copyright at the end too -->
@@ -1234,23 +1234,29 @@ ADDENVVAR ENVVAR(OUTPUTDIR) VALUE('<i>libraryname</i>') REPLACE(*YES)   </samp>
       <li>
       Set up the following environment variables and job characteristics in your build process
 <pre>
-<samp>ADDENVVAR ENVVAR(MAKE) VALUE('/usr/bin/gmake') REPLACE(*YES)
+<samp>ADDENVVAR ENVVAR(MAKE) VALUE('gmake') REPLACE(*YES)
 CHGJOB CCSID(37)</samp>
 </pre></li>
 
       <li>Run <tt>'QSH'</tt></li>
+      
+      <li>Run: <br><tt>export PATH=/QIBM/ProdData/DeveloperTools/qsh/bin:$PATH:/QOpenSys/usr/bin</tt>
+      </li>
 
-      <li>Run gunzip on the ICU source code compressed tar archive
+      <li>Run <b><tt>gzip -d</tt></b> on the ICU source code compressed tar archive
       (icu-<i>X</i>.<i>Y</i>.tgz).</li>
 
       <li>Run <a href='as_is/os400/unpax-icu.sh'>unpax-icu.sh</a> on the tar file generated from the previous step.</li>
 
+      <li>Change your current directory to icu/as_is/os400.</li>
+      <li>Run <tt>qsh bldiculd.sh</tt> to build the program ICULD which ICU will use for linkage.</li>
+
       <li>Change your current directory to icu/source.</li>
 
       <li>Run <tt>'./runConfigureICU IBMi'</tt>  (See <a href="#HowToConfigureICU">configuration
       note</a> for details).</li>
 
-      <li>Run <tt>'gmake'</tt> to build ICU.</li>
+      <li>Run <tt>'gmake'</tt> to build ICU. (Do not use the -j option)</li>
 
       <li>Run <tt>'gmake check QIBM_MULTI_THREADED=Y'</tt> to build and run the tests.
       You can look at the <a href=
index 72a663cf2135bf2876f843ce8ac6340aaca46050..17fa937358f830f1499cbc473083f6b084781c04 100644 (file)
@@ -1,6 +1,6 @@
 #******************************************************************************
 #
-#   Copyright (C) 2010, International Business Machines Corporation and others.  All Rights Reserved.
+#   Copyright (C) 2010-2011, International Business Machines Corporation and others.  All Rights Reserved.
 #
 #******************************************************************************
 # This is to be called from ../Makefile.in
@@ -64,6 +64,7 @@ $(DISTY_FILE_TGZ) $(DISTY_FILE_ZIP): $(SVNDOT) $(DISTY_DAT) $(DISTY_TMP)
        $(RMV) $(DISTY_RMDIR)
        $(MKINSTALLDIRS) $(DISTY_IN)
        cp $(DISTY_DAT) $(DISTY_IN)
+       ( cd $(DISTY_TMP)/icu ; python as_is/bomlist.py > 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)