]> granicus.if.org Git - icu/commitdiff
ICU-10711 Fix pds dataset data builds on zos
authorMichael Ow <mow@svn.icu-project.org>
Tue, 18 Feb 2014 06:21:37 +0000 (06:21 +0000)
committerMichael Ow <mow@svn.icu-project.org>
Tue, 18 Feb 2014 06:21:37 +0000 (06:21 +0000)
X-SVN-Rev: 35152

icu4c/source/data/Makefile.in
icu4c/source/tools/pkgdata/pkgdata.cpp

index bbb59383b9614162dbc87c382433a197f0462f85..d0f4698da488bdf9aeee7d4a7b9ba32c9ffee307 100644 (file)
@@ -1,5 +1,5 @@
 ## Makefile.in for ICU data
-## Copyright (c) 1999-2013, International Business Machines Corporation and
+## Copyright (c) 1999-2014, International Business Machines Corporation and
 ## others. All Rights Reserved.
 
 ## Source directory information
@@ -180,9 +180,10 @@ ifeq ($(PKGDATA_MODE),dll)
 endif
 endif
 ifneq ($(ICUDATA_SOURCE_IS_NATIVE_TARGET),YES)
-       $(PKGDATA_INVOKE) $(PKGDATA) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -p $(ICUDATA_NAME) -m $(PKGDATA_MODE) $(PKGDATA_VERSIONING) $(PKGDATA_LIBNAME) $(PKGDATA_LIST)
 ifeq ($(OS390BATCH),1)
-       $(PKGDATA_INVOKE) $(PKGDATA) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -p $(ICUDATA_NAME) -m $(PKGDATA_MODE) $(PKGDATA_VERSIONING) $(OS390_PDS_NAME) $(PKGDATA_LIST)
+       $(PKGDATA_INVOKE) $(PKGDATA) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -p $(ICUDATA_NAME) -m $(PKGDATA_MODE) $(PKGDATA_VERSIONING) $(PKGDATA_LIBNAME) -z $(PKGDATA_LIST)
+else
+       $(PKGDATA_INVOKE) $(PKGDATA) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -p $(ICUDATA_NAME) -m $(PKGDATA_MODE) $(PKGDATA_VERSIONING) $(PKGDATA_LIBNAME) $(PKGDATA_LIST)
 endif
 else
        $(INSTALL_DATA) $(ICUDATA_SOURCE_ARCHIVE) $(OUTDIR)
@@ -439,7 +440,7 @@ endif
 # General data build rules
 
 ## Files to remove for 'make clean'
-CLEANFILES = *~ icupkg.inc
+CLEANFILES = *~ icupkg.inc *.x
 
 ifeq ($(ICUDATA_SOURCE_ARCHIVE),)
 build-local: build-dir $(SO_VERSION_DATA) $(ALL_FILES) $(PKGDATA_LIST) $(OS390LIST)
index d3c1eac5dea675da563d1049a2b728b8622f10d0..9a3675366b773354105e3eaf8ecac76fa1a96bd3 100644 (file)
@@ -73,7 +73,7 @@ static int32_t pkg_createWithoutAssemblyCode(UPKGOptions *o, const char *targetD
 #endif
 
 static int32_t pkg_createWithAssemblyCode(const char *targetDir, const char mode, const char *gencFilePath);
-static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, const char *objectFile, char *command = NULL);
+static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, const char *objectFile, char *command = NULL, UBool specialHandling=FALSE);
 static int32_t pkg_archiveLibrary(const char *targetDir, const char *version, UBool reverseExt);
 static void createFileNames(UPKGOptions *o, const char mode, const char *version_major, const char *version, const char *libName, const UBool reverseExt, UBool noVersion);
 static int32_t initializePkgDataFlags(UPKGOptions *o);
@@ -203,6 +203,9 @@ enum {
     LIB_FILE_CYGWIN_VERSION,
 #elif U_PLATFORM == U_PF_MINGW
     LIB_FILE_MINGW,
+#elif U_PLATFORM == U_PF_OS390
+    LIB_FILE_OS390BATCH_MAJOR,
+    LIB_FILE_OS390BATCH_VERSION,
 #endif
     LIB_FILENAMES_SIZE
 };
@@ -233,7 +236,8 @@ const char options_help[][320]={
     "Add package to all file names if not present",
     "Library name to build (if different than package name)",
     "Quite mode. (e.g. Do not output a readme file for static libraries)",
-    "Build the data without assembly code"
+    "Build the data without assembly code",
+    "Build PDS dataset (zOS build only)"
 };
 
 const char  *progname = "PKGDATA";
@@ -753,9 +757,7 @@ static int32_t pkg_executeOptions(UPKGOptions *o) {
                 if (!noVersion) {
                     /* Create symbolic links for the final library file. */
 #if U_PLATFORM == U_PF_OS390
-                    if (!o->pdsbuild) {
-                        result = pkg_createSymLinks(targetDir, noVersion);
-                    }
+                    result = pkg_createSymLinks(targetDir, o->pdsbuild);
 #else
                     result = pkg_createSymLinks(targetDir, noVersion);
 #endif
@@ -892,19 +894,19 @@ static void createFileNames(UPKGOptions *o, const char mode, const char *version
         sprintf(libFileNames[LIB_FILE_VERSION_TMP], "%s.%s",
                 libFileNames[LIB_FILE],
                 pkgDataFlags[SOBJ_EXT]);
-#elif U_PLATFROM == U_PF_OS390
-            if (o->pdsbuild) {
-                sprintf(libFileNames[LIB_FILE], "%s",
-                    libName);
-                sprintf(libFileNames[LIB_FILE_VERSION_TMP], "\"%s\"",
-                        libFileNames[LIB_FILE]);
-            } else {
-                sprintf(libFileNames[LIB_FILE_VERSION_TMP], "%s%s%s.%s",
-                        libFileNames[LIB_FILE],
-                        pkgDataFlags[LIB_EXT_ORDER][0] == '.' ? "." : "",
-                        reverseExt ? version : pkgDataFlags[SOBJ_EXT],
-                        reverseExt ? pkgDataFlags[SOBJ_EXT] : version);
-            }
+#elif U_PLATFORM == U_PF_OS390
+        sprintf(libFileNames[LIB_FILE_VERSION_TMP], "%s%s%s.%s",
+                    libFileNames[LIB_FILE],
+                    pkgDataFlags[LIB_EXT_ORDER][0] == '.' ? "." : "",
+                    reverseExt ? version : pkgDataFlags[SOBJ_EXT],
+                    reverseExt ? pkgDataFlags[SOBJ_EXT] : version);
+
+        sprintf(libFileNames[LIB_FILE_OS390BATCH_VERSION], "%s%s.x",
+                    libFileNames[LIB_FILE],
+                    version);
+        sprintf(libFileNames[LIB_FILE_OS390BATCH_MAJOR], "%s%s.x",
+                    libFileNames[LIB_FILE],
+                    version_major);
 #else
         if (noVersion && !reverseExt) {
             sprintf(libFileNames[LIB_FILE_VERSION_TMP], "%s%s%s",
@@ -993,6 +995,41 @@ static int32_t pkg_createSymLinks(const char *targetDir, UBool specialHandling)
 #if U_PLATFORM == U_PF_CYGWIN
         sprintf(name1, "%s", libFileNames[LIB_FILE_CYGWIN]);
         sprintf(name2, "%s", libFileNames[LIB_FILE_CYGWIN_VERSION]);
+#elif U_PLATFORM == U_PF_OS390
+        /* Create the symbolic links for the import data */
+        /* Use the cmd buffer to store path to import data file to check its existence */
+        sprintf(cmd, "%s/%s", targetDir, libFileNames[LIB_FILE_OS390BATCH_VERSION]);
+        if (T_FileStream_file_exists(cmd)) {
+            sprintf(cmd, "cd %s && %s %s && %s %s %s",
+                    targetDir,
+                    RM_CMD,
+                    libFileNames[LIB_FILE_OS390BATCH_MAJOR],
+                    LN_CMD,
+                    libFileNames[LIB_FILE_OS390BATCH_VERSION],
+                    libFileNames[LIB_FILE_OS390BATCH_MAJOR]);
+            result = runCommand(cmd);
+            if (result != 0) {
+                fprintf(stderr, "Error creating symbolic links. Failed command: %s\n", cmd);
+                return result;
+            }
+
+            sprintf(cmd, "cd %s && %s %s.x && %s %s %s.x",
+                    targetDir,
+                    RM_CMD,
+                    libFileNames[LIB_FILE],
+                    LN_CMD,
+                    libFileNames[LIB_FILE_OS390BATCH_VERSION],
+                    libFileNames[LIB_FILE]);
+            result = runCommand(cmd);
+            if (result != 0) {
+                fprintf(stderr, "Error creating symbolic links. Failed command: %s\n", cmd);
+                return result;
+            }
+        }
+
+        /* Needs to be set here because special handling skips it */
+        sprintf(name1, "%s.%s", libFileNames[LIB_FILE], pkgDataFlags[SO_EXT]);
+        sprintf(name2, "%s", libFileNames[LIB_FILE_VERSION]);
 #else
         goto normal_symlink_mode;
 #endif
@@ -1061,6 +1098,21 @@ static int32_t pkg_installLibrary(const char *installDir, const char *targetDir,
         fprintf(stderr, "Error installing library. Failed command: %s\n", cmd);
         return result;
     }
+
+#elif U_PLATFORM == U_PF_OS390
+    if (T_FileStream_file_exists(libFileNames[LIB_FILE_OS390BATCH_VERSION])) {
+        sprintf(cmd, "%s %s %s",
+                pkgDataFlags[INSTALL_CMD],
+                libFileNames[LIB_FILE_OS390BATCH_VERSION],
+                installDir
+                );
+        result = runCommand(cmd);
+
+        if (result != 0) {
+            fprintf(stderr, "Error installing library. Failed command: %s\n", cmd);
+            return result;
+        }
+    }
 #endif
 
     if (noVersion) {
@@ -1228,7 +1280,7 @@ static int32_t pkg_archiveLibrary(const char *targetDir, const char *version, UB
  * Using the compiler information from the configuration file set by -O option, generate the library file.
  * command may be given to allow for a larger buffer for cmd.
  */
-static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, const char *objectFile, char *command) {
+static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, const char *objectFile, char *command, UBool specialHandling) {
     int32_t result = 0;
     char *cmd = NULL;
     UBool freeCmd = FALSE;
@@ -1327,18 +1379,22 @@ static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, c
         /* Generate the library file. */
         result = runCommand(cmd);
 
-#if U_PLATFORM == U_PF_OS390 && defined(OS390BATCH)
+#if U_PLATFORM == U_PF_OS390
         char PDS_LibName[512];
-        if (uprv_strcmp(libFileNames[LIB_FILE],"libicudata") == 0) {
+        PDS_LibName[0] = 0;
+        if (specialHandling && uprv_strcmp(libFileNames[LIB_FILE],"libicudata") == 0) {
             sprintf(PDS_LibName,"%s%s%s",
                     "\"//'",
                     getenv("LOADMOD"),
                     "(IXMI" U_ICU_VERSION_SHORT "DA)'\"");
-        } else if (uprv_strcmp(libFileNames[LIB_FILE],"libicudata_stub") == 0) {
+        } else if (!specialHandling && uprv_strcmp(libFileNames[LIB_FILE],"libicudata_stub") == 0) {
            sprintf(PDS_LibName,"%s%s%s",
                    "\"//'",
                    getenv("LOADMOD"),
                    "(IXMI" U_ICU_VERSION_SHORT "D1)'\"");
+        }
+
+        if (PDS_LibName[0]) {
            sprintf(cmd, "%s %s -o %s %s %s%s %s %s",
                    pkgDataFlags[GENLIB],
                    pkgDataFlags[LDICUDTFLAGS],
@@ -1348,8 +1404,9 @@ static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, c
                    pkgDataFlags[LD_SONAME][0] == 0 ? "" : libFileNames[LIB_FILE_VERSION_MAJOR],
                    pkgDataFlags[RPATH_FLAGS],
                    pkgDataFlags[BIR_FLAGS]);
+
+            result = runCommand(cmd);
         }
-        result = runCommand(cmd);
 #endif
     }
 
@@ -1600,11 +1657,7 @@ static int32_t pkg_createWithoutAssemblyCode(UPKGOptions *o, const char *targetD
     if (result == 0) {
         /* Generate the library file. */
 #if U_PLATFORM == U_PF_OS390
-        if (o->pdsbuild && IN_DLL_MODE(mode)) {
-            result = pkg_generateLibraryFile("",mode, buffer, cmd);
-        } else {
-            result = pkg_generateLibraryFile(targetDir,mode, buffer, cmd);
-        }
+        result = pkg_generateLibraryFile(targetDir, mode, buffer, cmd, (o->pdsbuild && IN_DLL_MODE(mode)));
 #else
         result = pkg_generateLibraryFile(targetDir,mode, buffer, cmd);
 #endif