]> git.pld-linux.org Git - packages/rpm.git/blame - x32.patch
- rel 46; fake python version for eggs dependency generator, so it will generate...
[packages/rpm.git] / x32.patch
CommitLineData
321b78b0
JR
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
3@@ -2200,8 +2200,9 @@
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
17@@ -581,6 +581,7 @@
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 },
22
23 { " script", RPMFC_SCRIPT },
24 { " text", RPMFC_TEXT },
25@@ -685,7 +686,11 @@
26 for (fct = rpmfcTokens; fct->token != NULL; fct++) {
27 if (strstr(fmstr, fct->token) == NULL)
28 continue;
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;
33+ else
34+ fcolor |= fct->colors;
35 if (fcolor & RPMFC_INCLUDE)
36 return fcolor;
37 }
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
40@@ -20,8 +20,9 @@
41 RPMFC_BLACK = 0,
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 */
49
50 RPMFC_DESKTOP_FILE = (1 << 4),
51diff -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
54@@ -16,8 +16,12 @@
55
56 #
57 # --- Alpha does not mark 64bit dependencies
58+# --- Only x86_64 has x32bit dependencies
59+markx32=""
60 case `uname -m` in
61 alpha*) mark64="" ;;
62+ x86_64) markx32="()(x32bit)"
63+ mark64="()(64bit)" ;;
64 *) mark64="()(64bit)" ;;
65 esac
66
67@@ -28,6 +32,10 @@
68
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
76 if [ ! -L $f ]; then
77 echo $soname$lib64
78Only in rpm-5.4.15.x32/autodeps: linux.prov.orig
79diff -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
82@@ -38,8 +38,12 @@
83
84 #
85 # --- Alpha does not mark 64bit dependencies
86+# --- Only x86_64 has x32bit dependencies
87+markx32=""
88 case `uname -m` in
89 alpha*) mark64="" ;;
90+ x86_64) markx32="()(x32bit)"
91+ mark64="()(64bit)" ;;
92 *) mark64="()(64bit)" ;;
93 esac
94
95@@ -50,6 +54,9 @@
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"
102 ldd $f | awk '/=>/ {
103 if ($1 !~ /libNoVersion.so/ && $1 !~ /4[um]lib.so/ && $1 !~ /libredhat-kernel.so/) {
104 gsub(/'\''"/,"\\&",$1);
105@@ -64,6 +71,9 @@
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"
112 ldd $f | awk '/=>/ {
113 if ($1 !~ /libNoVersion.so/ && $1 !~ /4[um]lib.so/ && $1 !~ /libredhat-kernel.so/) {
114 gsub(/'\''"/,"\\&",$1);
115@@ -98,6 +108,9 @@
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'; }
123 /^$/ { START=0; }
124 /^Dynamic Section:$/ { START=1; }
125diff -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?
133 */
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)
137 /*@modifies t @*/
138 {
139 *t = '\0';
140 #if !defined(__alpha__) && !defined(__sun)
141 if (isElf64) {
142 if (s[strlen(s)-1] != ')')
143 (void) stpcpy( stpcpy(t, s), "()(64bit)");
144 else
145 (void) stpcpy( stpcpy(t, s), "(64bit)");
146 }else
147+ if (isX32) {
148+ if (s[strlen(s)-1] != ')')
149+ (void) stpcpy( stpcpy(t, s), "()(x32bit)");
150+ else
151+ (void) stpcpy( stpcpy(t, s), "(x32bit)");
152+ } else
153 #endif
154 (void) stpcpy(t, s);
155 return t;
156@@ -2967,6 +2975,7 @@
157 char * t;
158 int xx;
159 int isElf64;
160+ int isX32;
161 int isDSO;
162 int gotSONAME = 0;
163 int gotDEBUG = 0;
164@@ -3009,6 +3018,7 @@
165 /*@=evalorder@*/
166
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;
170
171 /*@-uniondef @*/
172@@ -3110,7 +3120,7 @@
173
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);
180 (void)rpmdsFree(ds);
181@@ -3163,7 +3173,7 @@
182
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);
189 (void)rpmdsFree(ds);
190@@ -3205,7 +3215,7 @@
191 assert(s != NULL);
192 buf[0] = '\0';
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);
198 (void)rpmdsFree(ds);
199@@ -3220,7 +3230,7 @@
200 /* Add next provide dependency. */
201 buf[0] = '\0';
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);
207 (void)rpmdsFree(ds);
208@@ -3256,7 +3266,7 @@
209 /* Add next provide dependency. */
210 buf[0] = '\0';
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);
215 (void)rpmdsFree(ds);
216 ds = NULL;
57aa272c
JR
217diff -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
4a2f243b
JR
220@@ -707,10 +708,25 @@
221
57aa272c
JR
222 /* Check for description in each package and add arch and os */
223 {
4a2f243b
JR
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);
57aa272c
JR
229+#ifdef RPM_VENDOR_PLD
230+/*
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.
235+ */
236+ const char *platformNoarch = xstrdup("noarch-pld-linux");
4a2f243b
JR
237+ if (strcmp(arch,"noarch"))
238+ platform = rpmExpand("%{_target_platform}", NULL);
239+ else
240+ platform = xstrdup("noarch-pld-linux");
57aa272c 241+#else
4a2f243b
JR
242+ const char *platformNoarch = NULL;
243+ platform = rpmExpand("%{_target_platform}", NULL);
57aa272c 244+#endif
57aa272c 245
4a2f243b
JR
246 for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
247 he->tag = RPMTAG_OS;
This page took 0.05131 seconds and 4 git commands to generate.