1 --- rpm-5.4.15/configure.ac~ 2014-12-20 16:50:32.000000000 +0100
2 +++ rpm-5.4.15/configure.ac 2014-12-20 16:54:38.036853187 +0100
4 case "${target_cpu}" in
5 *86) RPMCANONARCH=i386 ;;
6 ia32e*) RPMCANONARCH=ia32e ;;
7 -amd64*) RPMCANONARCH=amd64 ;;
8 -x86_64*) RPMCANONARCH=x86_64 ;;
9 +amd64*) RPMCANONCOLOR=7; RPMCANONARCH=amd64 ;;
10 +x86_64*) RPMCANONCOLOR=7; RPMCANONARCH=x86_64 ;;
11 +x32) RPMCANONARCH=x32 ;;
12 alpha*) RPMCANONARCH=alpha ;;
13 sparc64*) RPMCANONARCH=sparc64 ;;
14 sparc*) RPMCANONARCH=sparc ;;
15 --- rpm-5.4.15/lib/rpmfc.c.orig 2014-12-20 16:50:32.000000000 +0100
16 +++ rpm-5.4.15/lib/rpmfc.c 2014-12-20 18:32:11.641808153 +0100
18 { "MIPS, N32 MIPS32", RPMFC_ELFMIPSN32|RPMFC_INCLUDE },
19 { "ELF 32-bit", RPMFC_ELF32|RPMFC_INCLUDE },
20 { "ELF 64-bit", RPMFC_ELF64|RPMFC_INCLUDE },
21 +// { "ELF 32-bit", RPMFC_ELFX32|RPMFC_INCLUDE },
23 { " script", RPMFC_SCRIPT },
24 { " text", RPMFC_TEXT },
26 for (fct = rpmfcTokens; fct->token != NULL; fct++) {
27 if (strstr(fmstr, fct->token) == NULL)
29 - fcolor |= fct->colors;
30 + // This is a nasty hack, but will have to do for now
31 + if ((fct->colors & RPMFC_ELF32) && (strstr(fmstr, "x86-64") != NULL))
32 + fcolor |= RPMFC_ELFX32|RPMFC_INCLUDE;
34 + fcolor |= fct->colors;
35 if (fcolor & RPMFC_INCLUDE)
38 --- rpm-5.4.15/lib/rpmfc.h.orig 2014-12-20 17:51:48.584934979 +0100
39 +++ rpm-5.4.15/lib/rpmfc.h 2014-12-20 17:56:14.690160030 +0100
42 RPMFC_ELF32 = (1 << 0),
43 RPMFC_ELF64 = (1 << 1),
44 + RPMFC_ELFX32 = (1 << 2),
45 RPMFC_ELFMIPSN32 = (1 << 2),
46 -#define RPMFC_ELF (RPMFC_ELF32|RPMFC_ELF64|RPMFC_ELFMIPSN32)
47 +#define RPMFC_ELF (RPMFC_ELF32|RPMFC_ELF64|RPMFC_ELFX32|RPMFC_ELFMIPSN32)
48 /* (1 << 3) leaks into package headers, reserved */
50 RPMFC_DESKTOP_FILE = (1 << 4),
51 diff -ur rpm-5.4.15/autodeps/linux.prov rpm-5.4.15.x32/autodeps/linux.prov
52 --- rpm-5.4.15/autodeps/linux.prov 2010-03-18 10:54:56.000000000 +0100
53 +++ rpm-5.4.15.x32/autodeps/linux.prov 2014-12-20 19:18:57.339941715 +0100
57 # --- Alpha does not mark 64bit dependencies
58 +# --- Only x86_64 has x32bit dependencies
62 + x86_64) markx32="()(x32bit)"
63 + mark64="()(64bit)" ;;
64 *) mark64="()(64bit)" ;;
69 lib64=`if file -L $f 2>/dev/null | \
70 grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
71 + libx32=`if file -L $f 2>/dev/null | \
72 + grep "ELF 32-bit.*x86-64" > /dev/null; \
73 + then echo "$markx32"; fi`
74 + lib64="$lib64$libx32"
75 if [ "$soname" != "" ]; then
78 Only in rpm-5.4.15.x32/autodeps: linux.prov.orig
79 diff -ur rpm-5.4.15/autodeps/linux.req rpm-5.4.15.x32/autodeps/linux.req
80 --- rpm-5.4.15/autodeps/linux.req 2010-03-18 10:54:56.000000000 +0100
81 +++ rpm-5.4.15.x32/autodeps/linux.req 2014-12-20 19:20:04.622910545 +0100
85 # --- Alpha does not mark 64bit dependencies
86 +# --- Only x86_64 has x32bit dependencies
90 + x86_64) markx32="()(x32bit)"
91 + mark64="()(64bit)" ;;
92 *) mark64="()(64bit)" ;;
96 [ -r $f -a -x $f ] || continue
97 lib64=`if file -L $f 2>/dev/null | \
98 grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
99 + libx32=`if file -L $f 2>/dev/null | \
100 + grep "ELF 32-bit.*x86-64" >/dev/null; then echo "$markx32"; fi`
101 + lib64="$lib64$libx32"
103 if ($1 !~ /libNoVersion.so/ && $1 !~ /4[um]lib.so/ && $1 !~ /libredhat-kernel.so/) {
104 gsub(/'\''"/,"\\&",$1);
106 [ -r $f ] || continue
107 lib64=`if file -L $f 2>/dev/null | \
108 grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
109 + libx32=`if file -L $f 2>/dev/null | \
110 + grep "ELF 32-bit.*x86-64" >/dev/null; then echo "$markx32"; fi`
111 + lib64="$lib64$libx32"
113 if ($1 !~ /libNoVersion.so/ && $1 !~ /4[um]lib.so/ && $1 !~ /libredhat-kernel.so/) {
114 gsub(/'\''"/,"\\&",$1);
116 [ -r $f ] || continue
117 lib64=`if file -L $f 2>/dev/null | \
118 grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
119 + libx32=`if file -L $f 2>/dev/null | \
120 + grep "ELF 32-bit.*x86-64" >/dev/null; then echo "$markx32"; fi`
121 + lib64="$lib64$libx32"
122 $OBJDUMP -p $f | awk 'BEGIN { START=0; LIBNAME=""; needed='$needed'; }
124 /^Dynamic Section:$/ { START=1; }
125 diff -ur rpm-5.4.15/lib/rpmds.c rpm-5.4.15.x32/lib/rpmds.c
126 --- rpm-5.4.15/lib/rpmds.c 2014-12-20 19:35:31.114557975 +0100
127 +++ rpm-5.4.15.x32/lib/rpmds.c 2014-12-20 19:34:54.958087185 +0100
128 @@ -2922,19 +2922,26 @@
129 * @retval t soname dependency
130 * @param s elf string (NULL uses "")
131 * @param isElf64 is this an ELF64 symbol?
132 + * @param isX32 is this an X32 symbol?
134 #if defined(HAVE_GELF_H) && defined(HAVE_LIBELF) && !defined(__FreeBSD__)
135 -static char * sonameDep(/*@returned@*/ char * t, const char * s, int isElf64)
136 +static char * sonameDep(/*@returned@*/ char * t, const char * s, int isElf64, int isX32)
140 #if !defined(__alpha__) && !defined(__sun)
142 if (s[strlen(s)-1] != ')')
143 (void) stpcpy( stpcpy(t, s), "()(64bit)");
145 (void) stpcpy( stpcpy(t, s), "(64bit)");
148 + if (s[strlen(s)-1] != ')')
149 + (void) stpcpy( stpcpy(t, s), "()(x32bit)");
151 + (void) stpcpy( stpcpy(t, s), "(x32bit)");
156 @@ -2967,6 +2975,7 @@
164 @@ -3009,6 +3018,7 @@
167 isElf64 = ehdr->e_ident[EI_CLASS] == ELFCLASS64;
168 + isX32 = (ehdr->e_ident[EI_CLASS] == ELFCLASS32) && (ehdr->e_machine == EM_X86_64);
169 isDSO = ehdr->e_type == ET_DYN;
172 @@ -3110,7 +3120,7 @@
174 /* Add next provide dependency. */
175 ds = rpmdsSingle(RPMTAG_PROVIDES,
176 - sonameDep(t, buf, isElf64),
177 + sonameDep(t, buf, isElf64, isX32),
178 "", RPMSENSE_FIND_PROVIDES);
179 xx = add(context, ds);
181 @@ -3163,7 +3173,7 @@
183 /* Add next require dependency. */
184 ds = rpmdsSingle(RPMTAG_REQUIRENAME,
185 - sonameDep(t, buf, isElf64),
186 + sonameDep(t, buf, isElf64, isX32),
187 "", RPMSENSE_FIND_REQUIRES);
188 xx = add(context, ds);
190 @@ -3205,7 +3215,7 @@
193 ds = rpmdsSingle(RPMTAG_REQUIRENAME,
194 - sonameDep(buf, s, isElf64),
195 + sonameDep(buf, s, isElf64, isX32),
196 "", RPMSENSE_FIND_REQUIRES);
197 xx = add(context, ds);
199 @@ -3220,7 +3230,7 @@
200 /* Add next provide dependency. */
202 ds = rpmdsSingle(RPMTAG_PROVIDENAME,
203 - sonameDep(buf, s, isElf64),
204 + sonameDep(buf, s, isElf64, isX32),
205 "", RPMSENSE_FIND_PROVIDES);
206 xx = add(context, ds);
208 @@ -3256,7 +3266,7 @@
209 /* Add next provide dependency. */
211 ds = rpmdsSingle(RPMTAG_PROVIDENAME,
212 - sonameDep(buf, s, isElf64), "", RPMSENSE_FIND_PROVIDES);
213 + sonameDep(buf, s, isElf64, isX32), "", RPMSENSE_FIND_PROVIDES);
214 xx = add(context, ds);
217 diff -ur rpm-5.4.15/build/parseSpec.c rpm-5.4.15-fixed/build/parseSpec.c
218 --- rpm-5.4.15/build/parseSpec.c 2015-04-02 20:52:18.192956656 +0200
219 +++ rpm-5.4.15-fixed/build/parseSpec.c 2015-04-02 20:49:57.416291008 +0200
220 @@ -707,10 +708,25 @@
222 /* Check for description in each package and add arch and os */
224 - const char *platform = rpmExpand("%{_target_platform}", NULL);
225 - const char *platformNoarch = NULL;
226 + const char *platform = NULL;
227 const char *arch = rpmExpand("%{_target_cpu}", NULL);
228 const char *os = rpmExpand("%{_target_os}", NULL);
229 +#ifdef RPM_VENDOR_PLD
231 + * This is a hack for x32 compatibility, on x32 _target_platform
232 + * does not use _target_cpu, it must use hardcoded x86-64.
233 + * This results in noarch packages using platform x86_64-pld-linux-gnux32
234 + * and being unusable on ix86.
236 + const char *platformNoarch = xstrdup("noarch-pld-linux");
237 + if (strcmp(arch,"noarch"))
238 + platform = rpmExpand("%{_target_platform}", NULL);
240 + platform = xstrdup("noarch-pld-linux");
242 + const char *platformNoarch = NULL;
243 + platform = rpmExpand("%{_target_platform}", NULL);
246 for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {