]> git.pld-linux.org Git - packages/rpm.git/blob - x32.patch
bb34415f4bfd759b8592a2b49f62244bcf41febe
[packages/rpm.git] / x32.patch
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/build/rpmfc.c.orig       2014-12-20 16:50:32.000000000 +0100
16 +++ rpm-5.4.15/build/rpmfc.c    2014-12-20 18:32:11.641808153 +0100
17 @@ -581,6 +581,7 @@
18  
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    { "troff or preprocessor input",     RPMFC_INCLUDE },
24    { "GNU Info",                        RPMFC_INCLUDE },
25 @@ -685,7 +686,11 @@
26         if (strstr(fmstr, fct->token) == NULL)
27             continue;
28  
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/build/rpmfc.h.orig       2014-12-20 17:51:48.584934979 +0100
39 +++ rpm-5.4.15/build/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),
51 diff -ur rpm-5.4.15/lib/rpmds.c rpm-5.4.15.x32/lib/rpmds.c
52 --- rpm-5.4.15/lib/rpmds.c      2014-12-20 19:35:31.114557975 +0100
53 +++ rpm-5.4.15.x32/lib/rpmds.c  2014-12-20 19:34:54.958087185 +0100
54 @@ -2922,19 +2922,26 @@
55   * @retval t           soname dependency
56   * @param s            elf string (NULL uses "")
57   * @param isElf64      is this an ELF64 symbol?
58 + * @param isX32                is this an X32 symbol?
59   */
60  #if defined(HAVE_GELF_H) && defined(HAVE_LIBELF) && !defined(__FreeBSD__)
61 -static char * sonameDep(/*@returned@*/ char * t, const char * s, int isElf64)
62 +static char * sonameDep(/*@returned@*/ char * t, const char * s, int isElf64, int isX32)
63         /*@modifies t @*/
64  {
65      *t = '\0';
66  #if !defined(__alpha__) && !defined(__sun)
67      if (isElf64) {
68         if (s[strlen(s)-1] != ')')
69         (void) stpcpy( stpcpy(t, s), "()(64bit)");
70      else
71             (void) stpcpy( stpcpy(t, s), "(64bit)");
72      }else
73 +       if (isX32) {
74 +         if (s[strlen(s)-1] != ')')
75 +           (void) stpcpy( stpcpy(t, s), "()(x32bit)");
76 +         else
77 +           (void) stpcpy( stpcpy(t, s), "(x32bit)");
78 +       } else
79  #endif
80         (void) stpcpy(t, s);
81      return t;
82 @@ -2967,6 +2975,7 @@
83      char * t;
84      int xx;
85      int isElf64;
86 +    int isX32;
87      int isDSO;
88      int gotSONAME = 0;
89      int gotDEBUG = 0;
90 @@ -3009,6 +3018,7 @@
91  /*@=evalorder@*/
92  
93      isElf64 = ehdr->e_ident[EI_CLASS] == ELFCLASS64;
94 +    isX32 = (ehdr->e_ident[EI_CLASS] == ELFCLASS32) && (ehdr->e_machine == EM_X86_64);
95      isDSO = ehdr->e_type == ET_DYN;
96  
97      /*@-uniondef @*/
98 @@ -3110,7 +3120,7 @@
99  
100                             /* Add next provide dependency. */
101                             ds = rpmdsSingle(RPMTAG_PROVIDES,
102 -                                       sonameDep(t, buf, isElf64),
103 +                                       sonameDep(t, buf, isElf64, isX32),
104                                         "", RPMSENSE_FIND_PROVIDES);
105                             xx = add(context, ds);
106                             (void)rpmdsFree(ds);
107 @@ -3163,7 +3173,7 @@
108  
109                             /* Add next require dependency. */
110                             ds = rpmdsSingle(RPMTAG_REQUIRENAME,
111 -                                       sonameDep(t, buf, isElf64),
112 +                                       sonameDep(t, buf, isElf64, isX32),
113                                         "", RPMSENSE_FIND_REQUIRES);
114                             xx = add(context, ds);
115                             (void)rpmdsFree(ds);
116 @@ -3205,7 +3215,7 @@
117  assert(s != NULL);
118                         buf[0] = '\0';
119                         ds = rpmdsSingle(RPMTAG_REQUIRENAME,
120 -                               sonameDep(buf, s, isElf64),
121 +                               sonameDep(buf, s, isElf64, isX32),
122                                 "", RPMSENSE_FIND_REQUIRES);
123                         xx = add(context, ds);
124                         (void)rpmdsFree(ds);
125 @@ -3220,7 +3230,7 @@
126                         /* Add next provide dependency. */
127                         buf[0] = '\0';
128                         ds = rpmdsSingle(RPMTAG_PROVIDENAME,
129 -                               sonameDep(buf, s, isElf64),
130 +                               sonameDep(buf, s, isElf64, isX32),
131                                 "", RPMSENSE_FIND_PROVIDES);
132                         xx = add(context, ds);
133                         (void)rpmdsFree(ds);
134 @@ -3256,7 +3266,7 @@
135         /* Add next provide dependency. */
136         buf[0] = '\0';
137         ds = rpmdsSingle(RPMTAG_PROVIDENAME,
138 -               sonameDep(buf, s, isElf64), "", RPMSENSE_FIND_PROVIDES);
139 +               sonameDep(buf, s, isElf64, isX32), "", RPMSENSE_FIND_PROVIDES);
140         xx = add(context, ds);
141         (void)rpmdsFree(ds);
142         ds = NULL;
143 diff -ur rpm-5.4.15/build/parseSpec.c rpm-5.4.15-fixed/build/parseSpec.c
144 --- rpm-5.4.15/build/parseSpec.c        2015-04-02 20:52:18.192956656 +0200
145 +++ rpm-5.4.15-fixed/build/parseSpec.c  2015-04-02 20:49:57.416291008 +0200
146 @@ -707,10 +708,25 @@
147  
148      /* Check for description in each package and add arch and os */
149    {
150 -    const char *platform = rpmExpand("%{_target_platform}", NULL);
151 -    const char *platformNoarch = NULL;
152 +    const char *platform = NULL;
153      const char *arch = rpmExpand("%{_target_cpu}", NULL);
154      const char *os = rpmExpand("%{_target_os}", NULL);
155 +#ifdef RPM_VENDOR_PLD
156 +/*
157 + * This is a hack for x32 compatibility, on x32 _target_platform
158 + * does not use _target_cpu, it must use hardcoded x86-64.
159 + * This results in noarch packages using platform x86_64-pld-linux-gnux32
160 + * and being unusable on ix86.
161 + */
162 +    const char *platformNoarch = xstrdup("noarch-pld-linux");
163 +    if (strcmp(arch,"noarch"))
164 +        platform = rpmExpand("%{_target_platform}", NULL);
165 +    else
166 +        platform = xstrdup("noarch-pld-linux");
167 +#else
168 +    const char *platformNoarch = NULL;
169 +    platform = rpmExpand("%{_target_platform}", NULL);
170 +#endif
171  
172      for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
173         he->tag = RPMTAG_OS;
174 diff -ur rpm-5.4.15/autodeps/linux.prov rpm-5.4.15.x32/autodeps/linux.prov
175 --- rpm-5.4.15/autodeps/linux.prov      2010-03-18 10:54:56.000000000 +0100
176 +++ rpm-5.4.15.x32/autodeps/linux.prov  2014-12-20 19:18:57.339941715 +0100
177 @@ -16,8 +16,12 @@
178  
179  #
180  # --- Alpha does not mark 64bit dependencies
181 +# --- Only x86_64 has x32bit dependencies
182 +markx32=""
183  case `uname -m` in
184    alpha*)      mark64="" ;;
185 +  x86_64)      markx32="()(x32bit)"
186 +               mark64="()(64bit)" ;;
187    *)           mark64="()(64bit)" ;;
188  esac
189  
190 @@ -28,6 +32,10 @@
191  
192      lib64=`if file -L $f 2>/dev/null | \
193         grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
194 +    libx32=`if file -L $f 2>/dev/null | \
195 +       grep "ELF 32-bit.*x86-64" > /dev/null; \
196 +       then echo "$markx32"; fi`
197 +    lib64="$lib64$libx32"
198      if [ "$soname" != "" ]; then
199         if [ ! -L $f ]; then
200             echo $soname$lib64
201 diff -ur rpm-5.4.15/autodeps/linux.req rpm-5.4.15.x32/autodeps/linux.req
202 --- rpm-5.4.15/autodeps/linux.req       2010-03-18 10:54:56.000000000 +0100
203 +++ rpm-5.4.15.x32/autodeps/linux.req   2014-12-20 19:20:04.622910545 +0100
204 @@ -38,8 +38,12 @@
205  
206  #
207  # --- Alpha does not mark 64bit dependencies
208 +# --- Only x86_64 has x32bit dependencies
209 +markx32=""
210  case `uname -m` in
211    alpha*)      mark64="" ;;
212 +  x86_64)      markx32="()(x32bit)"
213 +               mark64="()(64bit)" ;;
214    *)           mark64="()(64bit)" ;;
215  esac
216  
217 @@ -50,6 +54,9 @@
218      [ -r $f -a -x $f ] || continue
219      lib64=`if file -L $f 2>/dev/null | \
220         grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
221 +    libx32=`if file -L $f 2>/dev/null | \
222 +       grep "ELF 32-bit.*x86-64" >/dev/null; then echo "$markx32"; fi`
223 +    lib64="$lib64$libx32"
224      ldd $f | awk '/=>/ {
225         if ($1 !~ /libNoVersion.so/ && $1 !~ /4[um]lib.so/ && $1 !~ /libredhat-kernel.so/) {
226             gsub(/'\''"/,"\\&",$1);
227 @@ -64,6 +71,9 @@
228      [ -r $f ] || continue
229      lib64=`if file -L $f 2>/dev/null | \
230         grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
231 +    libx32=`if file -L $f 2>/dev/null | \
232 +       grep "ELF 32-bit.*x86-64" >/dev/null; then echo "$markx32"; fi`
233 +    lib64="$lib64$libx32"
234      ldd $f | awk '/=>/ {
235         if ($1 !~ /libNoVersion.so/ && $1 !~ /4[um]lib.so/ && $1 !~ /libredhat-kernel.so/) {
236             gsub(/'\''"/,"\\&",$1);
237 @@ -98,6 +108,9 @@
238      [ -r $f ] || continue
239      lib64=`if file -L $f 2>/dev/null | \
240         grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
241 +    libx32=`if file -L $f 2>/dev/null | \
242 +       grep "ELF 32-bit.*x86-64" >/dev/null; then echo "$markx32"; fi`
243 +    lib64="$lib64$libx32"
244      $OBJDUMP -p $f | awk 'BEGIN { START=0; LIBNAME=""; needed='$needed'; }
245         /^$/ { START=0; }
246         /^Dynamic Section:$/ { START=1; }
This page took 0.038852 seconds and 2 git commands to generate.