OLD | NEW |
1 /****************************************************************************** | 1 /****************************************************************************** |
2 * Copyright (C) 2000-2013, International Business Machines | 2 * Copyright (C) 2000-2014, International Business Machines |
3 * Corporation and others. All Rights Reserved. | 3 * Corporation and others. All Rights Reserved. |
4 ******************************************************************************* | 4 ******************************************************************************* |
5 * file name: pkgdata.cpp | 5 * file name: pkgdata.cpp |
6 * encoding: ANSI X3.4 (1968) | 6 * encoding: ANSI X3.4 (1968) |
7 * tab size: 8 (not used) | 7 * tab size: 8 (not used) |
8 * indentation:4 | 8 * indentation:4 |
9 * | 9 * |
10 * created on: 2000may15 | 10 * created on: 2000may15 |
11 * created by: Steven \u24C7 Loomis | 11 * created by: Steven \u24C7 Loomis |
12 * | 12 * |
(...skipping 23 matching lines...) Expand all Loading... |
36 #include "toolutil.h" | 36 #include "toolutil.h" |
37 #include "unicode/uclean.h" | 37 #include "unicode/uclean.h" |
38 #include "unewdata.h" | 38 #include "unewdata.h" |
39 #include "uoptions.h" | 39 #include "uoptions.h" |
40 #include "package.h" | 40 #include "package.h" |
41 #include "pkg_icu.h" | 41 #include "pkg_icu.h" |
42 #include "pkg_genc.h" | 42 #include "pkg_genc.h" |
43 #include "pkg_gencmn.h" | 43 #include "pkg_gencmn.h" |
44 #include "flagparser.h" | 44 #include "flagparser.h" |
45 #include "filetools.h" | 45 #include "filetools.h" |
| 46 #include "charstr.h" |
46 | 47 |
47 #if U_HAVE_POPEN | 48 #if U_HAVE_POPEN |
48 # include <unistd.h> | 49 # include <unistd.h> |
49 #endif | 50 #endif |
50 | 51 |
51 #include <stdio.h> | 52 #include <stdio.h> |
52 #include <stdlib.h> | 53 #include <stdlib.h> |
53 | 54 |
54 U_CDECL_BEGIN | 55 U_CDECL_BEGIN |
55 #include "pkgtypes.h" | 56 #include "pkgtypes.h" |
(...skipping 10 matching lines...) Expand all Loading... |
66 static int32_t pkg_createSymLinks(const char *targetDir, UBool specialHandling=F
ALSE); | 67 static int32_t pkg_createSymLinks(const char *targetDir, UBool specialHandling=F
ALSE); |
67 static int32_t pkg_installLibrary(const char *installDir, const char *dir, UBool
noVersion); | 68 static int32_t pkg_installLibrary(const char *installDir, const char *dir, UBool
noVersion); |
68 static int32_t pkg_installFileMode(const char *installDir, const char *srcDir, c
onst char *fileListName); | 69 static int32_t pkg_installFileMode(const char *installDir, const char *srcDir, c
onst char *fileListName); |
69 static int32_t pkg_installCommonMode(const char *installDir, const char *fileNam
e); | 70 static int32_t pkg_installCommonMode(const char *installDir, const char *fileNam
e); |
70 | 71 |
71 #ifdef BUILD_DATA_WITHOUT_ASSEMBLY | 72 #ifdef BUILD_DATA_WITHOUT_ASSEMBLY |
72 static int32_t pkg_createWithoutAssemblyCode(UPKGOptions *o, const char *targetD
ir, const char mode); | 73 static int32_t pkg_createWithoutAssemblyCode(UPKGOptions *o, const char *targetD
ir, const char mode); |
73 #endif | 74 #endif |
74 | 75 |
75 static int32_t pkg_createWithAssemblyCode(const char *targetDir, const char mode
, const char *gencFilePath); | 76 static int32_t pkg_createWithAssemblyCode(const char *targetDir, const char mode
, const char *gencFilePath); |
76 static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, c
onst char *objectFile, char *command = NULL); | 77 static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, c
onst char *objectFile, char *command = NULL, UBool specialHandling=FALSE); |
77 static int32_t pkg_archiveLibrary(const char *targetDir, const char *version, UB
ool reverseExt); | 78 static int32_t pkg_archiveLibrary(const char *targetDir, const char *version, UB
ool reverseExt); |
78 static void createFileNames(UPKGOptions *o, const char mode, const char *version
_major, const char *version, const char *libName, const UBool reverseExt, UBool
noVersion); | 79 static void createFileNames(UPKGOptions *o, const char mode, const char *version
_major, const char *version, const char *libName, const UBool reverseExt, UBool
noVersion); |
79 static int32_t initializePkgDataFlags(UPKGOptions *o); | 80 static int32_t initializePkgDataFlags(UPKGOptions *o); |
80 | 81 |
81 static int32_t pkg_getOptionsFromICUConfig(UBool verbose, UOption *option); | 82 static int32_t pkg_getOptionsFromICUConfig(UBool verbose, UOption *option); |
82 static int runCommand(const char* command, UBool specialHandling=FALSE); | 83 static int runCommand(const char* command, UBool specialHandling=FALSE); |
83 | 84 |
84 #define IN_COMMON_MODE(mode) (mode == 'a' || mode == 'c') | 85 #define IN_COMMON_MODE(mode) (mode == 'a' || mode == 'c') |
85 #define IN_DLL_MODE(mode) (mode == 'd' || mode == 'l') | 86 #define IN_DLL_MODE(mode) (mode == 'd' || mode == 'l') |
86 #define IN_STATIC_MODE(mode) (mode == 's') | 87 #define IN_STATIC_MODE(mode) (mode == 's') |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 enum { | 197 enum { |
197 LIB_FILE, | 198 LIB_FILE, |
198 LIB_FILE_VERSION_MAJOR, | 199 LIB_FILE_VERSION_MAJOR, |
199 LIB_FILE_VERSION, | 200 LIB_FILE_VERSION, |
200 LIB_FILE_VERSION_TMP, | 201 LIB_FILE_VERSION_TMP, |
201 #if U_PLATFORM == U_PF_CYGWIN | 202 #if U_PLATFORM == U_PF_CYGWIN |
202 LIB_FILE_CYGWIN, | 203 LIB_FILE_CYGWIN, |
203 LIB_FILE_CYGWIN_VERSION, | 204 LIB_FILE_CYGWIN_VERSION, |
204 #elif U_PLATFORM == U_PF_MINGW | 205 #elif U_PLATFORM == U_PF_MINGW |
205 LIB_FILE_MINGW, | 206 LIB_FILE_MINGW, |
| 207 #elif U_PLATFORM == U_PF_OS390 |
| 208 LIB_FILE_OS390BATCH_MAJOR, |
| 209 LIB_FILE_OS390BATCH_VERSION, |
206 #endif | 210 #endif |
207 LIB_FILENAMES_SIZE | 211 LIB_FILENAMES_SIZE |
208 }; | 212 }; |
209 static char libFileNames[LIB_FILENAMES_SIZE][256]; | 213 static char libFileNames[LIB_FILENAMES_SIZE][256]; |
210 | 214 |
211 static UPKGOptions *pkg_checkFlag(UPKGOptions *o); | 215 static UPKGOptions *pkg_checkFlag(UPKGOptions *o); |
212 | 216 |
213 const char options_help[][320]={ | 217 const char options_help[][320]={ |
214 "Set the data name", | 218 "Set the data name", |
215 #ifdef U_MAKE_IS_NMAKE | 219 #ifdef U_MAKE_IS_NMAKE |
(...skipping 10 matching lines...) Expand all Loading... |
226 "Specify the destination directory for files", | 230 "Specify the destination directory for files", |
227 "Force rebuilding of all data", | 231 "Force rebuilding of all data", |
228 "Specify temporary dir (default: output dir)", | 232 "Specify temporary dir (default: output dir)", |
229 "Install the data (specify target)", | 233 "Install the data (specify target)", |
230 "Specify a custom source directory", | 234 "Specify a custom source directory", |
231 "Specify a custom entrypoint name (default: short name)", | 235 "Specify a custom entrypoint name (default: short name)", |
232 "Specify a version when packaging in dll or static mode", | 236 "Specify a version when packaging in dll or static mode", |
233 "Add package to all file names if not present", | 237 "Add package to all file names if not present", |
234 "Library name to build (if different than package name)", | 238 "Library name to build (if different than package name)", |
235 "Quite mode. (e.g. Do not output a readme file for static libraries)", | 239 "Quite mode. (e.g. Do not output a readme file for static libraries)", |
236 "Build the data without assembly code" | 240 "Build the data without assembly code", |
| 241 "Build PDS dataset (zOS build only)" |
237 }; | 242 }; |
238 | 243 |
239 const char *progname = "PKGDATA"; | 244 const char *progname = "PKGDATA"; |
240 | 245 |
241 int | 246 int |
242 main(int argc, char* argv[]) { | 247 main(int argc, char* argv[]) { |
243 int result = 0; | 248 int result = 0; |
244 /* FileStream *out; */ | 249 /* FileStream *out; */ |
245 UPKGOptions o; | 250 UPKGOptions o; |
246 CharList *tail; | 251 CharList *tail; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 o.libName = o.shortName; | 372 o.libName = o.shortName; |
368 } | 373 } |
369 | 374 |
370 if(options[QUIET].doesOccur) { | 375 if(options[QUIET].doesOccur) { |
371 o.quiet = TRUE; | 376 o.quiet = TRUE; |
372 } else { | 377 } else { |
373 o.quiet = FALSE; | 378 o.quiet = FALSE; |
374 } | 379 } |
375 | 380 |
376 if(options[PDS_BUILD].doesOccur) { | 381 if(options[PDS_BUILD].doesOccur) { |
| 382 #if U_PLATFORM == U_PF_OS390 |
377 o.pdsbuild = TRUE; | 383 o.pdsbuild = TRUE; |
| 384 #else |
| 385 o.pdsbuild = FALSE; |
| 386 fprintf(stdout, "Warning: You are using the -z option which only works on
z/OS.\n"); |
| 387 |
| 388 #endif |
378 } else { | 389 } else { |
379 o.pdsbuild = FALSE; | 390 o.pdsbuild = FALSE; |
380 } | 391 } |
381 | 392 |
382 o.verbose = options[VERBOSE].doesOccur; | 393 o.verbose = options[VERBOSE].doesOccur; |
383 | 394 |
384 | 395 |
385 #if !defined(WINDOWS_WITH_MSVC) || defined(USING_CYGWIN) /* on UNIX, we'll just
include the file... */ | 396 #if !defined(WINDOWS_WITH_MSVC) || defined(USING_CYGWIN) /* on UNIX, we'll just
include the file... */ |
386 if (options[BLDOPT].doesOccur) { | 397 if (options[BLDOPT].doesOccur) { |
387 o.options = options[BLDOPT].value; | 398 o.options = options[BLDOPT].value; |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 /* Certain platforms have different library extension ordering. (e.g
. libicudata.##.so vs libicudata.so.##) | 650 /* Certain platforms have different library extension ordering. (e.g
. libicudata.##.so vs libicudata.so.##) |
640 * reverseExt is FALSE if the suffix should be the version number. | 651 * reverseExt is FALSE if the suffix should be the version number. |
641 */ | 652 */ |
642 if (pkgDataFlags[LIB_EXT_ORDER][uprv_strlen(pkgDataFlags[LIB_EXT_ORD
ER])-1] == pkgDataFlags[SO_EXT][uprv_strlen(pkgDataFlags[SO_EXT])-1]) { | 653 if (pkgDataFlags[LIB_EXT_ORDER][uprv_strlen(pkgDataFlags[LIB_EXT_ORD
ER])-1] == pkgDataFlags[SO_EXT][uprv_strlen(pkgDataFlags[SO_EXT])-1]) { |
643 reverseExt = TRUE; | 654 reverseExt = TRUE; |
644 } | 655 } |
645 #endif | 656 #endif |
646 /* Using the base libName and version number, generate the library f
ile names. */ | 657 /* Using the base libName and version number, generate the library f
ile names. */ |
647 createFileNames(o, mode, version_major, o->version == NULL ? "" : o-
>version, o->libName, reverseExt, noVersion); | 658 createFileNames(o, mode, version_major, o->version == NULL ? "" : o-
>version, o->libName, reverseExt, noVersion); |
648 | 659 |
649 if ((o->version!=NULL || IN_STATIC_MODE(mode)) && o->rebuild == FALS
E) { | 660 if ((o->version!=NULL || IN_STATIC_MODE(mode)) && o->rebuild == FALS
E && o->pdsbuild == FALSE) { |
650 /* Check to see if a previous built data library file exists and
check if it is the latest. */ | 661 /* Check to see if a previous built data library file exists and
check if it is the latest. */ |
651 sprintf(checkLibFile, "%s%s", targetDir, libFileNames[LIB_FILE_V
ERSION]); | 662 sprintf(checkLibFile, "%s%s", targetDir, libFileNames[LIB_FILE_V
ERSION]); |
652 if (T_FileStream_file_exists(checkLibFile)) { | 663 if (T_FileStream_file_exists(checkLibFile)) { |
653 if (isFileModTimeLater(checkLibFile, o->srcDir, TRUE) && isF
ileModTimeLater(checkLibFile, o->options)) { | 664 if (isFileModTimeLater(checkLibFile, o->srcDir, TRUE) && isF
ileModTimeLater(checkLibFile, o->options)) { |
654 if (o->install != NULL) { | 665 if (o->install != NULL) { |
655 if(o->verbose) { | 666 if(o->verbose) { |
656 fprintf(stdout, "# Installing already-built library
into %s\n", o->install); | 667 fprintf(stdout, "# Installing already-built library
into %s\n", o->install); |
657 } | 668 } |
658 result = pkg_installLibrary(o->install, targetDir, noV
ersion); | 669 result = pkg_installLibrary(o->install, targetDir, noV
ersion); |
659 } else { | 670 } else { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 } | 757 } |
747 result = pkg_archiveLibrary(targetDir, o->version, reverseExt); | 758 result = pkg_archiveLibrary(targetDir, o->version, reverseExt); |
748 if (result != 0) { | 759 if (result != 0) { |
749 fprintf(stderr, "Error creating data archive library file.\n
"); | 760 fprintf(stderr, "Error creating data archive library file.\n
"); |
750 return result; | 761 return result; |
751 } | 762 } |
752 #if U_PLATFORM != U_PF_OS400 | 763 #if U_PLATFORM != U_PF_OS400 |
753 if (!noVersion) { | 764 if (!noVersion) { |
754 /* Create symbolic links for the final library file. */ | 765 /* Create symbolic links for the final library file. */ |
755 #if U_PLATFORM == U_PF_OS390 | 766 #if U_PLATFORM == U_PF_OS390 |
756 if (!o->pdsbuild) { | 767 result = pkg_createSymLinks(targetDir, o->pdsbuild); |
757 result = pkg_createSymLinks(targetDir, noVersion); | |
758 } | |
759 #else | 768 #else |
760 result = pkg_createSymLinks(targetDir, noVersion); | 769 result = pkg_createSymLinks(targetDir, noVersion); |
761 #endif | 770 #endif |
762 if (result != 0) { | 771 if (result != 0) { |
763 fprintf(stderr, "Error creating symbolic links of the da
ta library file.\n"); | 772 fprintf(stderr, "Error creating symbolic links of the da
ta library file.\n"); |
764 return result; | 773 return result; |
765 } | 774 } |
766 } | 775 } |
767 #endif | 776 #endif |
768 } /* !IN_STATIC_MODE */ | 777 } /* !IN_STATIC_MODE */ |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 | 858 |
850 return result; | 859 return result; |
851 } | 860 } |
852 | 861 |
853 | 862 |
854 /* | 863 /* |
855 * Given the base libName and version numbers, generate the libary file names an
d store it in libFileNames. | 864 * Given the base libName and version numbers, generate the libary file names an
d store it in libFileNames. |
856 * Depending on the configuration, the library name may either end with version
number or shared object suffix. | 865 * Depending on the configuration, the library name may either end with version
number or shared object suffix. |
857 */ | 866 */ |
858 static void createFileNames(UPKGOptions *o, const char mode, const char *version
_major, const char *version, const char *libName, UBool reverseExt, UBool noVers
ion) { | 867 static void createFileNames(UPKGOptions *o, const char mode, const char *version
_major, const char *version, const char *libName, UBool reverseExt, UBool noVers
ion) { |
| 868 const char* FILE_EXTENSION_SEP = uprv_strlen(pkgDataFlags[SO_EXT]) == 0 ? ""
: "."; |
| 869 const char* FILE_SUFFIX = pkgDataFlags[LIB_EXT_ORDER][0] == '.' ? "." : ""; |
| 870 |
859 #if U_PLATFORM == U_PF_MINGW | 871 #if U_PLATFORM == U_PF_MINGW |
860 /* MinGW does not need the library prefix when building in dll mode. */ | 872 /* MinGW does not need the library prefix when building in dll mode. */ |
861 if (IN_DLL_MODE(mode)) { | 873 if (IN_DLL_MODE(mode)) { |
862 sprintf(libFileNames[LIB_FILE], "%s", libName); | 874 sprintf(libFileNames[LIB_FILE], "%s", libName); |
863 } else { | 875 } else { |
864 sprintf(libFileNames[LIB_FILE], "%s%s", | 876 sprintf(libFileNames[LIB_FILE], "%s%s", |
865 pkgDataFlags[LIBPREFIX], | 877 pkgDataFlags[LIBPREFIX], |
866 libName); | 878 libName); |
867 } | 879 } |
868 #else | 880 #else |
869 sprintf(libFileNames[LIB_FILE], "%s%s", | 881 sprintf(libFileNames[LIB_FILE], "%s%s", |
870 pkgDataFlags[LIBPREFIX], | 882 pkgDataFlags[LIBPREFIX], |
871 libName); | 883 libName); |
872 #endif | 884 #endif |
873 | 885 |
874 if(o->verbose) { | 886 if(o->verbose) { |
875 fprintf(stdout, "# libFileName[LIB_FILE] = %s\n", libFileNames[LIB_FIL
E]); | 887 fprintf(stdout, "# libFileName[LIB_FILE] = %s\n", libFileNames[LIB_FIL
E]); |
876 } | 888 } |
877 | 889 |
878 #if U_PLATFORM == U_PF_MINGW | 890 #if U_PLATFORM == U_PF_MINGW |
879 sprintf(libFileNames[LIB_FILE_MINGW], "%s%s.lib", pkgDataFlags[LIBPREFIX
], libName); | 891 sprintf(libFileNames[LIB_FILE_MINGW], "%s%s.lib", pkgDataFlags[LIBPREFIX
], libName); |
880 #elif U_PLATFORM == U_PF_CYGWIN | 892 #elif U_PLATFORM == U_PF_CYGWIN |
881 sprintf(libFileNames[LIB_FILE_CYGWIN], "cyg%s.%s", | 893 sprintf(libFileNames[LIB_FILE_CYGWIN], "cyg%s%s%s", |
882 libName, | 894 libName, |
| 895 FILE_EXTENSION_SEP, |
883 pkgDataFlags[SO_EXT]); | 896 pkgDataFlags[SO_EXT]); |
884 sprintf(libFileNames[LIB_FILE_CYGWIN_VERSION], "cyg%s%s.%s", | 897 sprintf(libFileNames[LIB_FILE_CYGWIN_VERSION], "cyg%s%s%s%s", |
885 libName, | 898 libName, |
886 version_major, | 899 version_major, |
| 900 FILE_EXTENSION_SEP, |
887 pkgDataFlags[SO_EXT]); | 901 pkgDataFlags[SO_EXT]); |
888 | 902 |
889 uprv_strcat(pkgDataFlags[SO_EXT], "."); | 903 uprv_strcat(pkgDataFlags[SO_EXT], "."); |
890 uprv_strcat(pkgDataFlags[SO_EXT], pkgDataFlags[A_EXT]); | 904 uprv_strcat(pkgDataFlags[SO_EXT], pkgDataFlags[A_EXT]); |
891 #elif U_PLATFORM == U_PF_OS400 || defined(_AIX) | 905 #elif U_PLATFORM == U_PF_OS400 || defined(_AIX) |
892 sprintf(libFileNames[LIB_FILE_VERSION_TMP], "%s.%s", | 906 sprintf(libFileNames[LIB_FILE_VERSION_TMP], "%s%s%s", |
893 libFileNames[LIB_FILE], | 907 libFileNames[LIB_FILE], |
| 908 FILE_EXTENSION_SEP, |
894 pkgDataFlags[SOBJ_EXT]); | 909 pkgDataFlags[SOBJ_EXT]); |
895 #elif U_PLATFROM == U_PF_OS390 | 910 #elif U_PLATFORM == U_PF_OS390 |
896 if (o->pdsbuild) { | 911 sprintf(libFileNames[LIB_FILE_VERSION_TMP], "%s%s%s%s%s", |
897 sprintf(libFileNames[LIB_FILE], "%s", | 912 libFileNames[LIB_FILE], |
898 libName); | 913 pkgDataFlags[LIB_EXT_ORDER][0] == '.' ? "." : "", |
899 sprintf(libFileNames[LIB_FILE_VERSION_TMP], "\"%s\"", | 914 reverseExt ? version : pkgDataFlags[SOBJ_EXT], |
900 libFileNames[LIB_FILE]); | 915 FILE_EXTENSION_SEP, |
901 } else { | 916 reverseExt ? pkgDataFlags[SOBJ_EXT] : version); |
902 sprintf(libFileNames[LIB_FILE_VERSION_TMP], "%s%s%s.%s", | 917 |
903 libFileNames[LIB_FILE], | 918 sprintf(libFileNames[LIB_FILE_OS390BATCH_VERSION], "%s%s.x", |
904 pkgDataFlags[LIB_EXT_ORDER][0] == '.' ? "." : "", | 919 libFileNames[LIB_FILE], |
905 reverseExt ? version : pkgDataFlags[SOBJ_EXT], | 920 version); |
906 reverseExt ? pkgDataFlags[SOBJ_EXT] : version); | 921 sprintf(libFileNames[LIB_FILE_OS390BATCH_MAJOR], "%s%s.x", |
907 } | 922 libFileNames[LIB_FILE], |
| 923 version_major); |
908 #else | 924 #else |
909 if (noVersion && !reverseExt) { | 925 if (noVersion && !reverseExt) { |
910 sprintf(libFileNames[LIB_FILE_VERSION_TMP], "%s%s%s", | 926 sprintf(libFileNames[LIB_FILE_VERSION_TMP], "%s%s%s", |
911 libFileNames[LIB_FILE], | 927 libFileNames[LIB_FILE], |
912 pkgDataFlags[LIB_EXT_ORDER][0] == '.' ? "." : "", | 928 FILE_SUFFIX, |
913 pkgDataFlags[SOBJ_EXT]); | 929 pkgDataFlags[SOBJ_EXT]); |
914 } else { | 930 } else { |
915 sprintf(libFileNames[LIB_FILE_VERSION_TMP], "%s%s%s.%s", | 931 sprintf(libFileNames[LIB_FILE_VERSION_TMP], "%s%s%s%s%s", |
916 libFileNames[LIB_FILE], | 932 libFileNames[LIB_FILE], |
917 pkgDataFlags[LIB_EXT_ORDER][0] == '.' ? "." : "", | 933 FILE_SUFFIX, |
918 reverseExt ? version : pkgDataFlags[SOBJ_EXT], | 934 reverseExt ? version : pkgDataFlags[SOBJ_EXT], |
| 935 FILE_EXTENSION_SEP, |
919 reverseExt ? pkgDataFlags[SOBJ_EXT] : version); | 936 reverseExt ? pkgDataFlags[SOBJ_EXT] : version); |
920 } | 937 } |
921 #endif | 938 #endif |
922 if (noVersion && !reverseExt) { | 939 if (noVersion && !reverseExt) { |
923 sprintf(libFileNames[LIB_FILE_VERSION_MAJOR], "%s%s%s", | 940 sprintf(libFileNames[LIB_FILE_VERSION_MAJOR], "%s%s%s", |
924 libFileNames[LIB_FILE], | 941 libFileNames[LIB_FILE], |
925 pkgDataFlags[LIB_EXT_ORDER][0] == '.' ? "." : "", | 942 FILE_SUFFIX, |
926 pkgDataFlags[SO_EXT]); | 943 pkgDataFlags[SO_EXT]); |
927 | 944 |
928 sprintf(libFileNames[LIB_FILE_VERSION], "%s%s%s", | 945 sprintf(libFileNames[LIB_FILE_VERSION], "%s%s%s", |
929 libFileNames[LIB_FILE], | 946 libFileNames[LIB_FILE], |
930 pkgDataFlags[LIB_EXT_ORDER][0] == '.' ? "." : "", | 947 FILE_SUFFIX, |
931 pkgDataFlags[SO_EXT]); | 948 pkgDataFlags[SO_EXT]); |
932 } else { | 949 } else { |
933 sprintf(libFileNames[LIB_FILE_VERSION_MAJOR], "%s%s%s.%s", | 950 sprintf(libFileNames[LIB_FILE_VERSION_MAJOR], "%s%s%s%s%s", |
934 libFileNames[LIB_FILE], | 951 libFileNames[LIB_FILE], |
935 pkgDataFlags[LIB_EXT_ORDER][0] == '.' ? "." : "", | 952 FILE_SUFFIX, |
936 reverseExt ? version_major : pkgDataFlags[SO_EXT], | 953 reverseExt ? version_major : pkgDataFlags[SO_EXT], |
| 954 FILE_EXTENSION_SEP, |
937 reverseExt ? pkgDataFlags[SO_EXT] : version_major); | 955 reverseExt ? pkgDataFlags[SO_EXT] : version_major); |
938 | 956 |
939 sprintf(libFileNames[LIB_FILE_VERSION], "%s%s%s.%s", | 957 sprintf(libFileNames[LIB_FILE_VERSION], "%s%s%s%s%s", |
940 libFileNames[LIB_FILE], | 958 libFileNames[LIB_FILE], |
941 pkgDataFlags[LIB_EXT_ORDER][0] == '.' ? "." : "", | 959 FILE_SUFFIX, |
942 reverseExt ? version : pkgDataFlags[SO_EXT], | 960 reverseExt ? version : pkgDataFlags[SO_EXT], |
| 961 FILE_EXTENSION_SEP, |
943 reverseExt ? pkgDataFlags[SO_EXT] : version); | 962 reverseExt ? pkgDataFlags[SO_EXT] : version); |
944 } | 963 } |
945 | 964 |
946 if(o->verbose) { | 965 if(o->verbose) { |
947 fprintf(stdout, "# libFileName[LIB_FILE_VERSION] = %s\n", libFileNames
[LIB_FILE_VERSION]); | 966 fprintf(stdout, "# libFileName[LIB_FILE_VERSION] = %s\n", libFileNames
[LIB_FILE_VERSION]); |
948 } | 967 } |
949 | 968 |
950 #if U_PF_MINGW <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN | 969 #if U_PF_MINGW <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN |
951 /* Cygwin and MinGW only deals with the version major number. */ | 970 /* Cygwin and MinGW only deals with the version major number. */ |
952 uprv_strcpy(libFileNames[LIB_FILE_VERSION_TMP], libFileNames[LIB_FILE_VE
RSION_MAJOR]); | 971 uprv_strcpy(libFileNames[LIB_FILE_VERSION_TMP], libFileNames[LIB_FILE_VE
RSION_MAJOR]); |
953 #endif | 972 #endif |
954 | 973 |
955 if(IN_STATIC_MODE(mode)) { | 974 if(IN_STATIC_MODE(mode)) { |
956 sprintf(libFileNames[LIB_FILE_VERSION], "%s.%s", libFileNames[LIB_FI
LE], pkgDataFlags[A_EXT]); | 975 sprintf(libFileNames[LIB_FILE_VERSION], "%s.%s", libFileNames[LIB_FI
LE], pkgDataFlags[A_EXT]); |
957 libFileNames[LIB_FILE_VERSION_MAJOR][0]=0; | 976 libFileNames[LIB_FILE_VERSION_MAJOR][0]=0; |
958 if(o->verbose) { | 977 if(o->verbose) { |
959 fprintf(stdout, "# libFileName[LIB_FILE_VERSION] = %s (static)\n"
, libFileNames[LIB_FILE_VERSION]); | 978 fprintf(stdout, "# libFileName[LIB_FILE_VERSION] = %s (static)\n"
, libFileNames[LIB_FILE_VERSION]); |
960 } | 979 } |
961 } | 980 } |
962 } | 981 } |
963 | 982 |
964 /* Create the symbolic links for the final library file. */ | 983 /* Create the symbolic links for the final library file. */ |
965 static int32_t pkg_createSymLinks(const char *targetDir, UBool specialHandling)
{ | 984 static int32_t pkg_createSymLinks(const char *targetDir, UBool specialHandling)
{ |
966 int32_t result = 0; | 985 int32_t result = 0; |
967 char cmd[LARGE_BUFFER_MAX_SIZE]; | 986 char cmd[LARGE_BUFFER_MAX_SIZE]; |
968 char name1[SMALL_BUFFER_MAX_SIZE]; /* symlink file name */ | 987 char name1[SMALL_BUFFER_MAX_SIZE]; /* symlink file name */ |
969 char name2[SMALL_BUFFER_MAX_SIZE]; /* file name to symlink */ | 988 char name2[SMALL_BUFFER_MAX_SIZE]; /* file name to symlink */ |
| 989 const char* FILE_EXTENSION_SEP = uprv_strlen(pkgDataFlags[SO_EXT]) == 0 ? ""
: "."; |
970 | 990 |
971 #if !defined(USING_CYGWIN) && U_PLATFORM != U_PF_MINGW | 991 #if !defined(USING_CYGWIN) && U_PLATFORM != U_PF_MINGW |
972 /* No symbolic link to make. */ | 992 /* No symbolic link to make. */ |
973 if (uprv_strlen(libFileNames[LIB_FILE_VERSION]) == 0 || uprv_strlen(libFileN
ames[LIB_FILE_VERSION_MAJOR]) == 0 || | 993 if (uprv_strlen(libFileNames[LIB_FILE_VERSION]) == 0 || uprv_strlen(libFileN
ames[LIB_FILE_VERSION_MAJOR]) == 0 || |
974 uprv_strcmp(libFileNames[LIB_FILE_VERSION], libFileNames[LIB_FILE_VERSIO
N_MAJOR]) == 0) { | 994 uprv_strcmp(libFileNames[LIB_FILE_VERSION], libFileNames[LIB_FILE_VERSIO
N_MAJOR]) == 0) { |
975 return result; | 995 return result; |
976 } | 996 } |
977 | 997 |
978 sprintf(cmd, "cd %s && %s %s && %s %s %s", | 998 sprintf(cmd, "cd %s && %s %s && %s %s %s", |
979 targetDir, | 999 targetDir, |
980 RM_CMD, | 1000 RM_CMD, |
981 libFileNames[LIB_FILE_VERSION_MAJOR], | 1001 libFileNames[LIB_FILE_VERSION_MAJOR], |
982 LN_CMD, | 1002 LN_CMD, |
983 libFileNames[LIB_FILE_VERSION], | 1003 libFileNames[LIB_FILE_VERSION], |
984 libFileNames[LIB_FILE_VERSION_MAJOR]); | 1004 libFileNames[LIB_FILE_VERSION_MAJOR]); |
985 result = runCommand(cmd); | 1005 result = runCommand(cmd); |
986 if (result != 0) { | 1006 if (result != 0) { |
987 fprintf(stderr, "Error creating symbolic links. Failed command: %s\n", c
md); | 1007 fprintf(stderr, "Error creating symbolic links. Failed command: %s\n", c
md); |
988 return result; | 1008 return result; |
989 } | 1009 } |
990 #endif | 1010 #endif |
991 | 1011 |
992 if (specialHandling) { | 1012 if (specialHandling) { |
993 #if U_PLATFORM == U_PF_CYGWIN | 1013 #if U_PLATFORM == U_PF_CYGWIN |
994 sprintf(name1, "%s", libFileNames[LIB_FILE_CYGWIN]); | 1014 sprintf(name1, "%s", libFileNames[LIB_FILE_CYGWIN]); |
995 sprintf(name2, "%s", libFileNames[LIB_FILE_CYGWIN_VERSION]); | 1015 sprintf(name2, "%s", libFileNames[LIB_FILE_CYGWIN_VERSION]); |
| 1016 #elif U_PLATFORM == U_PF_OS390 |
| 1017 /* Create the symbolic links for the import data */ |
| 1018 /* Use the cmd buffer to store path to import data file to check its exi
stence */ |
| 1019 sprintf(cmd, "%s/%s", targetDir, libFileNames[LIB_FILE_OS390BATCH_VERSIO
N]); |
| 1020 if (T_FileStream_file_exists(cmd)) { |
| 1021 sprintf(cmd, "cd %s && %s %s && %s %s %s", |
| 1022 targetDir, |
| 1023 RM_CMD, |
| 1024 libFileNames[LIB_FILE_OS390BATCH_MAJOR], |
| 1025 LN_CMD, |
| 1026 libFileNames[LIB_FILE_OS390BATCH_VERSION], |
| 1027 libFileNames[LIB_FILE_OS390BATCH_MAJOR]); |
| 1028 result = runCommand(cmd); |
| 1029 if (result != 0) { |
| 1030 fprintf(stderr, "Error creating symbolic links. Failed command:
%s\n", cmd); |
| 1031 return result; |
| 1032 } |
| 1033 |
| 1034 sprintf(cmd, "cd %s && %s %s.x && %s %s %s.x", |
| 1035 targetDir, |
| 1036 RM_CMD, |
| 1037 libFileNames[LIB_FILE], |
| 1038 LN_CMD, |
| 1039 libFileNames[LIB_FILE_OS390BATCH_VERSION], |
| 1040 libFileNames[LIB_FILE]); |
| 1041 result = runCommand(cmd); |
| 1042 if (result != 0) { |
| 1043 fprintf(stderr, "Error creating symbolic links. Failed command:
%s\n", cmd); |
| 1044 return result; |
| 1045 } |
| 1046 } |
| 1047 |
| 1048 /* Needs to be set here because special handling skips it */ |
| 1049 sprintf(name1, "%s%s%s", libFileNames[LIB_FILE], FILE_EXTENSION_SEP, pkg
DataFlags[SO_EXT]); |
| 1050 sprintf(name2, "%s", libFileNames[LIB_FILE_VERSION]); |
996 #else | 1051 #else |
997 goto normal_symlink_mode; | 1052 goto normal_symlink_mode; |
998 #endif | 1053 #endif |
999 } else { | 1054 } else { |
1000 #if U_PLATFORM != U_PF_CYGWIN | 1055 #if U_PLATFORM != U_PF_CYGWIN |
1001 normal_symlink_mode: | 1056 normal_symlink_mode: |
1002 #endif | 1057 #endif |
1003 sprintf(name1, "%s.%s", libFileNames[LIB_FILE], pkgDataFlags[SO_EXT]); | 1058 sprintf(name1, "%s%s%s", libFileNames[LIB_FILE], FILE_EXTENSION_SEP, pkg
DataFlags[SO_EXT]); |
1004 sprintf(name2, "%s", libFileNames[LIB_FILE_VERSION]); | 1059 sprintf(name2, "%s", libFileNames[LIB_FILE_VERSION]); |
1005 } | 1060 } |
1006 | 1061 |
1007 sprintf(cmd, "cd %s && %s %s && %s %s %s", | 1062 sprintf(cmd, "cd %s && %s %s && %s %s %s", |
1008 targetDir, | 1063 targetDir, |
1009 RM_CMD, | 1064 RM_CMD, |
1010 name1, | 1065 name1, |
1011 LN_CMD, | 1066 LN_CMD, |
1012 name2, | 1067 name2, |
1013 name1); | 1068 name1); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 pkgDataFlags[INSTALL_CMD], | 1109 pkgDataFlags[INSTALL_CMD], |
1055 libFileNames[LIB_FILE_CYGWIN_VERSION], | 1110 libFileNames[LIB_FILE_CYGWIN_VERSION], |
1056 installDir | 1111 installDir |
1057 ); | 1112 ); |
1058 result = runCommand(cmd); | 1113 result = runCommand(cmd); |
1059 | 1114 |
1060 if (result != 0) { | 1115 if (result != 0) { |
1061 fprintf(stderr, "Error installing library. Failed command: %s\n", cmd); | 1116 fprintf(stderr, "Error installing library. Failed command: %s\n", cmd); |
1062 return result; | 1117 return result; |
1063 } | 1118 } |
| 1119 |
| 1120 #elif U_PLATFORM == U_PF_OS390 |
| 1121 if (T_FileStream_file_exists(libFileNames[LIB_FILE_OS390BATCH_VERSION])) { |
| 1122 sprintf(cmd, "%s %s %s", |
| 1123 pkgDataFlags[INSTALL_CMD], |
| 1124 libFileNames[LIB_FILE_OS390BATCH_VERSION], |
| 1125 installDir |
| 1126 ); |
| 1127 result = runCommand(cmd); |
| 1128 |
| 1129 if (result != 0) { |
| 1130 fprintf(stderr, "Error installing library. Failed command: %s\n", cm
d); |
| 1131 return result; |
| 1132 } |
| 1133 } |
1064 #endif | 1134 #endif |
1065 | 1135 |
1066 if (noVersion) { | 1136 if (noVersion) { |
1067 return result; | 1137 return result; |
1068 } else { | 1138 } else { |
1069 return pkg_createSymLinks(installDir, TRUE); | 1139 return pkg_createSymLinks(installDir, TRUE); |
1070 } | 1140 } |
1071 } | 1141 } |
1072 | 1142 |
1073 static int32_t pkg_installCommonMode(const char *installDir, const char *fileNam
e) { | 1143 static int32_t pkg_installCommonMode(const char *installDir, const char *fileNam
e) { |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 uprv_strcpy(libFileNames[LIB_FILE_VERSION], libFileNames[LIB_FILE_VERSIO
N_TMP]); | 1291 uprv_strcpy(libFileNames[LIB_FILE_VERSION], libFileNames[LIB_FILE_VERSIO
N_TMP]); |
1222 } | 1292 } |
1223 | 1293 |
1224 return result; | 1294 return result; |
1225 } | 1295 } |
1226 | 1296 |
1227 /* | 1297 /* |
1228 * Using the compiler information from the configuration file set by -O option,
generate the library file. | 1298 * Using the compiler information from the configuration file set by -O option,
generate the library file. |
1229 * command may be given to allow for a larger buffer for cmd. | 1299 * command may be given to allow for a larger buffer for cmd. |
1230 */ | 1300 */ |
1231 static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, c
onst char *objectFile, char *command) { | 1301 static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, c
onst char *objectFile, char *command, UBool specialHandling) { |
1232 int32_t result = 0; | 1302 int32_t result = 0; |
1233 char *cmd = NULL; | 1303 char *cmd = NULL; |
1234 UBool freeCmd = FALSE; | 1304 UBool freeCmd = FALSE; |
1235 int32_t length = 0; | 1305 int32_t length = 0; |
1236 | 1306 |
| 1307 (void)specialHandling; // Suppress unused variable compiler warnings on pla
tforms where all usage |
| 1308 // of this parameter is #ifdefed out. |
| 1309 |
1237 /* This is necessary because if packaging is done without assembly code, obj
ectFile might be extremely large | 1310 /* This is necessary because if packaging is done without assembly code, obj
ectFile might be extremely large |
1238 * containing many object files and so the calling function should supply a
command buffer that is large | 1311 * containing many object files and so the calling function should supply a
command buffer that is large |
1239 * enough to handle this. Otherwise, use the default size. | 1312 * enough to handle this. Otherwise, use the default size. |
1240 */ | 1313 */ |
1241 if (command != NULL) { | 1314 if (command != NULL) { |
1242 cmd = command; | 1315 cmd = command; |
1243 } | 1316 } |
1244 | 1317 |
1245 if (IN_STATIC_MODE(mode)) { | 1318 if (IN_STATIC_MODE(mode)) { |
1246 if (cmd == NULL) { | 1319 if (cmd == NULL) { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 #endif | 1393 #endif |
1321 objectFile, | 1394 objectFile, |
1322 pkgDataFlags[LD_SONAME], | 1395 pkgDataFlags[LD_SONAME], |
1323 pkgDataFlags[LD_SONAME][0] == 0 ? "" : libFileNames[LIB_FILE_VER
SION_MAJOR], | 1396 pkgDataFlags[LD_SONAME][0] == 0 ? "" : libFileNames[LIB_FILE_VER
SION_MAJOR], |
1324 pkgDataFlags[RPATH_FLAGS], | 1397 pkgDataFlags[RPATH_FLAGS], |
1325 pkgDataFlags[BIR_FLAGS]); | 1398 pkgDataFlags[BIR_FLAGS]); |
1326 | 1399 |
1327 /* Generate the library file. */ | 1400 /* Generate the library file. */ |
1328 result = runCommand(cmd); | 1401 result = runCommand(cmd); |
1329 | 1402 |
1330 #if U_PLATFORM == U_PF_OS390 && defined(OS390BATCH) | 1403 #if U_PLATFORM == U_PF_OS390 |
| 1404 char *env_tmp; |
1331 char PDS_LibName[512]; | 1405 char PDS_LibName[512]; |
1332 if (uprv_strcmp(libFileNames[LIB_FILE],"libicudata") == 0) { | 1406 char PDS_Name[512]; |
1333 sprintf(PDS_LibName,"%s%s%s", | 1407 |
| 1408 PDS_Name[0] = 0; |
| 1409 PDS_LibName[0] = 0; |
| 1410 if (specialHandling && uprv_strcmp(libFileNames[LIB_FILE],"libicudata")
== 0) { |
| 1411 if (env_tmp = getenv("ICU_PDS_NAME")) { |
| 1412 sprintf(PDS_Name, "%s%s", |
| 1413 env_tmp, |
| 1414 "DA"); |
| 1415 strcat(PDS_Name, getenv("ICU_PDS_NAME_SUFFIX")); |
| 1416 } else if (env_tmp = getenv("PDS_NAME_PREFIX")) { |
| 1417 sprintf(PDS_Name, "%s%s", |
| 1418 env_tmp, |
| 1419 U_ICU_VERSION_SHORT "DA"); |
| 1420 } else { |
| 1421 sprintf(PDS_Name, "%s%s", |
| 1422 "IXMI", |
| 1423 U_ICU_VERSION_SHORT "DA"); |
| 1424 } |
| 1425 } else if (!specialHandling && uprv_strcmp(libFileNames[LIB_FILE],"libic
udata_stub") == 0) { |
| 1426 if (env_tmp = getenv("ICU_PDS_NAME")) { |
| 1427 sprintf(PDS_Name, "%s%s", |
| 1428 env_tmp, |
| 1429 "D1"); |
| 1430 strcat(PDS_Name, getenv("ICU_PDS_NAME_SUFFIX")); |
| 1431 } else if (env_tmp = getenv("PDS_NAME_PREFIX")) { |
| 1432 sprintf(PDS_Name, "%s%s", |
| 1433 env_tmp, |
| 1434 U_ICU_VERSION_SHORT "D1"); |
| 1435 } else { |
| 1436 sprintf(PDS_Name, "%s%s", |
| 1437 "IXMI", |
| 1438 U_ICU_VERSION_SHORT "D1"); |
| 1439 } |
| 1440 } |
| 1441 |
| 1442 if (PDS_Name[0]) { |
| 1443 sprintf(PDS_LibName,"%s%s%s%s%s", |
1334 "\"//'", | 1444 "\"//'", |
1335 getenv("LOADMOD"), | 1445 getenv("LOADMOD"), |
1336 "(IXMI" U_ICU_VERSION_SHORT "DA)'\""); | 1446 "(", |
1337 } else if (uprv_strcmp(libFileNames[LIB_FILE],"libicudata_stub") == 0) { | 1447 PDS_Name, |
1338 sprintf(PDS_LibName,"%s%s%s", | 1448 ")'\""); |
1339 "\"//'", | 1449 sprintf(cmd, "%s %s -o %s %s %s%s %s %s", |
1340 getenv("LOADMOD"), | |
1341 "(IXMI" U_ICU_VERSION_SHORT "D1)'\""); | |
1342 sprintf(cmd, "%s %s -o %s %s %s%s %s %s", | |
1343 pkgDataFlags[GENLIB], | 1450 pkgDataFlags[GENLIB], |
1344 pkgDataFlags[LDICUDTFLAGS], | 1451 pkgDataFlags[LDICUDTFLAGS], |
1345 PDS_LibName, | 1452 PDS_LibName, |
1346 objectFile, | 1453 objectFile, |
1347 pkgDataFlags[LD_SONAME], | 1454 pkgDataFlags[LD_SONAME], |
1348 pkgDataFlags[LD_SONAME][0] == 0 ? "" : libFileNames[LIB_FILE_
VERSION_MAJOR], | 1455 pkgDataFlags[LD_SONAME][0] == 0 ? "" : libFileNames[LIB_FILE_
VERSION_MAJOR], |
1349 pkgDataFlags[RPATH_FLAGS], | 1456 pkgDataFlags[RPATH_FLAGS], |
1350 pkgDataFlags[BIR_FLAGS]); | 1457 pkgDataFlags[BIR_FLAGS]); |
| 1458 |
| 1459 result = runCommand(cmd); |
1351 } | 1460 } |
1352 result = runCommand(cmd); | |
1353 #endif | 1461 #endif |
1354 } | 1462 } |
1355 | 1463 |
1356 if (result != 0) { | 1464 if (result != 0) { |
1357 fprintf(stderr, "Error generating library file. Failed command: %s\n", c
md); | 1465 fprintf(stderr, "Error generating library file. Failed command: %s\n", c
md); |
1358 } | 1466 } |
1359 | 1467 |
1360 if (freeCmd) { | 1468 if (freeCmd) { |
1361 uprv_free(cmd); | 1469 uprv_free(cmd); |
1362 } | 1470 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 */ | 1516 */ |
1409 enum { | 1517 enum { |
1410 DATA_PREFIX_BRKITR, | 1518 DATA_PREFIX_BRKITR, |
1411 DATA_PREFIX_COLL, | 1519 DATA_PREFIX_COLL, |
1412 DATA_PREFIX_CURR, | 1520 DATA_PREFIX_CURR, |
1413 DATA_PREFIX_LANG, | 1521 DATA_PREFIX_LANG, |
1414 DATA_PREFIX_RBNF, | 1522 DATA_PREFIX_RBNF, |
1415 DATA_PREFIX_REGION, | 1523 DATA_PREFIX_REGION, |
1416 DATA_PREFIX_TRANSLIT, | 1524 DATA_PREFIX_TRANSLIT, |
1417 DATA_PREFIX_ZONE, | 1525 DATA_PREFIX_ZONE, |
| 1526 DATA_PREFIX_UNIT, |
1418 DATA_PREFIX_LENGTH | 1527 DATA_PREFIX_LENGTH |
1419 }; | 1528 }; |
1420 | 1529 |
1421 const static char DATA_PREFIX[DATA_PREFIX_LENGTH][10] = { | 1530 const static char DATA_PREFIX[DATA_PREFIX_LENGTH][10] = { |
1422 "brkitr", | 1531 "brkitr", |
1423 "coll", | 1532 "coll", |
1424 "curr", | 1533 "curr", |
1425 "lang", | 1534 "lang", |
1426 "rbnf", | 1535 "rbnf", |
1427 "region", | 1536 "region", |
1428 "translit", | 1537 "translit", |
1429 "zone" | 1538 "zone", |
| 1539 "unit" |
1430 }; | 1540 }; |
1431 | 1541 |
1432 static int32_t pkg_createWithoutAssemblyCode(UPKGOptions *o, const char *targetD
ir, const char mode) { | 1542 static int32_t pkg_createWithoutAssemblyCode(UPKGOptions *o, const char *targetD
ir, const char mode) { |
1433 int32_t result = 0; | 1543 int32_t result = 0; |
1434 CharList *list = o->filePaths; | 1544 CharList *list = o->filePaths; |
1435 CharList *listNames = o->files; | 1545 CharList *listNames = o->files; |
1436 int32_t listSize = pkg_countCharList(list); | 1546 int32_t listSize = pkg_countCharList(list); |
1437 char *buffer; | 1547 char *buffer; |
1438 char *cmd; | 1548 char *cmd; |
1439 char gencmnFile[SMALL_BUFFER_MAX_SIZE] = ""; | 1549 char gencmnFile[SMALL_BUFFER_MAX_SIZE] = ""; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1593 uprv_strcat(buffer, " "); | 1703 uprv_strcat(buffer, " "); |
1594 uprv_strcat(buffer, tempObjectFile); | 1704 uprv_strcat(buffer, tempObjectFile); |
1595 } else { | 1705 } else { |
1596 fprintf(stderr, "Error creating library without assembly code. Failed co
mmand: %s\n", cmd); | 1706 fprintf(stderr, "Error creating library without assembly code. Failed co
mmand: %s\n", cmd); |
1597 } | 1707 } |
1598 #endif | 1708 #endif |
1599 | 1709 |
1600 if (result == 0) { | 1710 if (result == 0) { |
1601 /* Generate the library file. */ | 1711 /* Generate the library file. */ |
1602 #if U_PLATFORM == U_PF_OS390 | 1712 #if U_PLATFORM == U_PF_OS390 |
1603 if (o->pdsbuild && IN_DLL_MODE(mode)) { | 1713 result = pkg_generateLibraryFile(targetDir, mode, buffer, cmd, (o->pdsbu
ild && IN_DLL_MODE(mode))); |
1604 result = pkg_generateLibraryFile("",mode, buffer, cmd); | |
1605 } else { | |
1606 result = pkg_generateLibraryFile(targetDir,mode, buffer, cmd); | |
1607 } | |
1608 #else | 1714 #else |
1609 result = pkg_generateLibraryFile(targetDir,mode, buffer, cmd); | 1715 result = pkg_generateLibraryFile(targetDir,mode, buffer, cmd); |
1610 #endif | 1716 #endif |
1611 } | 1717 } |
1612 | 1718 |
1613 uprv_free(buffer); | 1719 uprv_free(buffer); |
1614 uprv_free(cmd); | 1720 uprv_free(cmd); |
1615 | 1721 |
1616 return result; | 1722 return result; |
1617 } | 1723 } |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1968 T_FileStream_close(in); | 2074 T_FileStream_close(in); |
1969 } /* for each file list file */ | 2075 } /* for each file list file */ |
1970 } | 2076 } |
1971 | 2077 |
1972 /* Try calling icu-config directly to get the option file. */ | 2078 /* Try calling icu-config directly to get the option file. */ |
1973 static int32_t pkg_getOptionsFromICUConfig(UBool verbose, UOption *option) { | 2079 static int32_t pkg_getOptionsFromICUConfig(UBool verbose, UOption *option) { |
1974 #if U_HAVE_POPEN | 2080 #if U_HAVE_POPEN |
1975 FILE *p = NULL; | 2081 FILE *p = NULL; |
1976 size_t n; | 2082 size_t n; |
1977 static char buf[512] = ""; | 2083 static char buf[512] = ""; |
1978 char cmdBuf[1024]; | 2084 icu::CharString cmdBuf; |
1979 UErrorCode status = U_ZERO_ERROR; | 2085 UErrorCode status = U_ZERO_ERROR; |
1980 const char cmd[] = "icu-config --incpkgdatafile"; | 2086 const char cmd[] = "icu-config --incpkgdatafile"; |
1981 | 2087 char dirBuf[1024] = ""; |
1982 /* #1 try the same path where pkgdata was called from. */ | 2088 /* #1 try the same path where pkgdata was called from. */ |
1983 findDirname(progname, cmdBuf, 1024, &status); | 2089 findDirname(progname, dirBuf, UPRV_LENGTHOF(dirBuf), &status); |
1984 if(U_SUCCESS(status)) { | 2090 if(U_SUCCESS(status)) { |
| 2091 cmdBuf.append(dirBuf, status); |
1985 if (cmdBuf[0] != 0) { | 2092 if (cmdBuf[0] != 0) { |
1986 uprv_strncat(cmdBuf, U_FILE_SEP_STRING, 1024); | 2093 cmdBuf.append( U_FILE_SEP_STRING, status ); |
1987 } | 2094 } |
1988 uprv_strncat(cmdBuf, cmd, 1024); | 2095 cmdBuf.append( cmd, status ); |
1989 | 2096 |
1990 if(verbose) { | 2097 if(verbose) { |
1991 fprintf(stdout, "# Calling icu-config: %s\n", cmdBuf); | 2098 fprintf(stdout, "# Calling icu-config: %s\n", cmdBuf.data()); |
1992 } | 2099 } |
1993 p = popen(cmdBuf, "r"); | 2100 p = popen(cmdBuf.data(), "r"); |
1994 } | 2101 } |
1995 | 2102 |
1996 if(p == NULL || (n = fread(buf, 1, 511, p)) <= 0) { | 2103 if(p == NULL || (n = fread(buf, 1, UPRV_LENGTHOF(buf)-1, p)) <= 0) { |
1997 if(verbose) { | 2104 if(verbose) { |
1998 fprintf(stdout, "# Calling icu-config: %s\n", cmd); | 2105 fprintf(stdout, "# Calling icu-config: %s\n", cmd); |
1999 } | 2106 } |
2000 pclose(p); | 2107 pclose(p); |
2001 | 2108 |
2002 p = popen(cmd, "r"); | 2109 p = popen(cmd, "r"); |
2003 if(p == NULL || (n = fread(buf, 1, 511, p)) <= 0) { | 2110 if(p == NULL || (n = fread(buf, 1, UPRV_LENGTHOF(buf)-1, p)) <= 0) { |
2004 fprintf(stderr, "%s: icu-config: No icu-config found. (fix PATH or use
-O option)\n", progname); | 2111 fprintf(stderr, "%s: icu-config: No icu-config found. (fix PATH or use
-O option)\n", progname); |
2005 return -1; | 2112 return -1; |
2006 } | 2113 } |
2007 } | 2114 } |
2008 | 2115 |
2009 pclose(p); | 2116 pclose(p); |
2010 | 2117 |
2011 for (int32_t length = strlen(buf) - 1; length >= 0; length--) { | 2118 for (int32_t length = strlen(buf) - 1; length >= 0; length--) { |
2012 if (buf[length] == '\n' || buf[length] == ' ') { | 2119 if (buf[length] == '\n' || buf[length] == ' ') { |
2013 buf[length] = 0; | 2120 buf[length] = 0; |
(...skipping 18 matching lines...) Expand all Loading... |
2032 } | 2139 } |
2033 | 2140 |
2034 option->value = buf; | 2141 option->value = buf; |
2035 option->doesOccur = TRUE; | 2142 option->doesOccur = TRUE; |
2036 | 2143 |
2037 return 0; | 2144 return 0; |
2038 #else | 2145 #else |
2039 return -1; | 2146 return -1; |
2040 #endif | 2147 #endif |
2041 } | 2148 } |
OLD | NEW |