Gentoo Archives: gentoo-commits

From: "Arfrever Frehtes Taifersar Arahesis (arfrever)" <arfrever@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-libs/icu/files: icu-4.6-pkgdata.patch
Date: Fri, 28 Jan 2011 16:36:25
Message-Id: 20110128163614.D1B1920054@flycatcher.gentoo.org
1 arfrever 11/01/28 16:36:14
2
3 Added: icu-4.6-pkgdata.patch
4 Log:
5 Fix building with large CFLAGS (bug #326021).
6
7 (Portage version: 2.2.0_alpha19_p6/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.1 dev-libs/icu/files/icu-4.6-pkgdata.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/icu/files/icu-4.6-pkgdata.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/icu/files/icu-4.6-pkgdata.patch?rev=1.1&content-type=text/plain
14
15 Index: icu-4.6-pkgdata.patch
16 ===================================================================
17 https://bugs.gentoo.org/show_bug.cgi?id=326021
18 https://ssl.icu-project.org/trac/ticket/8281
19 https://ssl.icu-project.org/trac/changeset/29332
20 https://ssl.icu-project.org/trac/changeset/29333
21
22 --- tools/pkgdata/pkgdata.cpp
23 +++ tools/pkgdata/pkgdata.cpp
24 @@ -1,5 +1,5 @@
25 /******************************************************************************
26 - * Copyright (C) 2000-2010, International Business Machines
27 + * Copyright (C) 2000-2011, International Business Machines
28 * Corporation and others. All Rights Reserved.
29 *******************************************************************************
30 * file name: pkgdata.c
31 @@ -99,6 +99,7 @@
32
33 #define LARGE_BUFFER_MAX_SIZE 2048
34 #define SMALL_BUFFER_MAX_SIZE 512
35 +#define BUFFER_PADDING_SIZE 20
36
37 static void loadLists(UPKGOptions *o, UErrorCode *status);
38
39 @@ -484,9 +485,8 @@
40
41 if (!specialHandling) {
42 #if defined(USING_CYGWIN) || defined(OS400)
43 -#define CMD_PADDING_SIZE 20
44 - if ((len + CMD_PADDING_SIZE) >= SMALL_BUFFER_MAX_SIZE) {
45 - cmd = (char *)uprv_malloc(len + CMD_PADDING_SIZE);
46 + if ((len + BUFFER_PADDING_SIZE) >= SMALL_BUFFER_MAX_SIZE) {
47 + cmd = (char *)uprv_malloc(len + BUFFER_PADDING_SIZE);
48 } else {
49 cmd = cmdBuffer;
50 }
51 @@ -1133,6 +1133,7 @@
52 int32_t result = 0;
53 char *cmd = NULL;
54 UBool freeCmd = FALSE;
55 + int32_t length = 0;
56
57 /* This is necessary because if packaging is done without assembly code, objectFile might be extremely large
58 * containing many object files and so the calling function should supply a command buffer that is large
59 @@ -1140,15 +1141,18 @@
60 */
61 if (command != NULL) {
62 cmd = command;
63 - } else {
64 - if ((cmd = (char *)uprv_malloc(sizeof(char) * LARGE_BUFFER_MAX_SIZE)) == NULL) {
65 - fprintf(stderr, "Unable to allocate memory for command.\n");
66 - return -1;
67 - }
68 - freeCmd = TRUE;
69 }
70
71 if (mode == MODE_STATIC) {
72 + if (cmd == NULL) {
73 + length = uprv_strlen(pkgDataFlags[AR]) + uprv_strlen(pkgDataFlags[ARFLAGS]) + uprv_strlen(targetDir) +
74 + uprv_strlen(libFileNames[LIB_FILE_VERSION]) + uprv_strlen(objectFile) + uprv_strlen(pkgDataFlags[RANLIB]) + BUFFER_PADDING_SIZE;
75 + if ((cmd = (char *)uprv_malloc(sizeof(char) * length)) == NULL) {
76 + fprintf(stderr, "Unable to allocate memory for command.\n");
77 + return -1;
78 + }
79 + freeCmd = TRUE;
80 + }
81 sprintf(cmd, "%s %s %s%s %s",
82 pkgDataFlags[AR],
83 pkgDataFlags[ARFLAGS],
84 @@ -1166,6 +1170,21 @@
85 result = runCommand(cmd);
86 }
87 } else /* if (mode == MODE_DLL) */ {
88 + if (cmd == NULL) {
89 + length = uprv_strlen(pkgDataFlags[GENLIB]) + uprv_strlen(pkgDataFlags[LDICUDTFLAGS]) +
90 + uprv_strlen(targetDir) + uprv_strlen(libFileNames[LIB_FILE_VERSION_TMP]) +
91 + uprv_strlen(objectFile) + uprv_strlen(pkgDataFlags[LD_SONAME]) +
92 + uprv_strlen(pkgDataFlags[LD_SONAME][0] == 0 ? "" : libFileNames[LIB_FILE_VERSION_MAJOR]) +
93 + uprv_strlen(pkgDataFlags[RPATH_FLAGS]) + uprv_strlen(pkgDataFlags[BIR_FLAGS]) + BUFFER_PADDING_SIZE;
94 +#ifdef U_CYGWIN
95 + length += uprv_strlen(targetDir) + uprv_strlen(libFileNames[LIB_FILE_CYGWIN_VERSION]);
96 +#endif
97 + if ((cmd = (char *)uprv_malloc(sizeof(char) * length)) == NULL) {
98 + fprintf(stderr, "Unable to allocate memory for command.\n");
99 + return -1;
100 + }
101 + freeCmd = TRUE;
102 + }
103 #ifdef U_CYGWIN
104 sprintf(cmd, "%s%s%s %s -o %s%s %s %s%s %s %s",
105 pkgDataFlags[GENLIB],
106 @@ -1209,7 +1228,7 @@
107 tempObjectFile[uprv_strlen(tempObjectFile)-1] = 'o';
108
109 length = uprv_strlen(pkgDataFlags[COMPILER]) + uprv_strlen(pkgDataFlags[LIBFLAGS])
110 - + uprv_strlen(tempObjectFile) + uprv_strlen(gencFilePath) + 10;
111 + + uprv_strlen(tempObjectFile) + uprv_strlen(gencFilePath) + BUFFER_PADDING_SIZE;
112
113 cmd = (char *)uprv_malloc(sizeof(char) * length);
114 if (cmd == NULL) {