]> TLD Linux GIT Repositories - packages/rpm.git/blob - x32.patch
- release down to 2
[packages/rpm.git] / x32.patch
1 diff -ur rpm-4.16.1.2/build/rpmfc.c rpm-4.16.1.2.x32/build/rpmfc.c
2 --- rpm-4.16.1.2/build/rpmfc.c  2021-03-21 21:51:28.231530270 +0100
3 +++ rpm-4.16.1.2.x32/build/rpmfc.c      2021-03-21 21:50:04.127398387 +0100
4 @@ -641,6 +641,7 @@
5  
6    { "ELF 32-bit",              RPMFC_ELF32|RPMFC_INCLUDE },
7    { "ELF 64-bit",              RPMFC_ELF64|RPMFC_INCLUDE },
8 +//  { "ELF 32-bit",            RPMFC_ELFX32|RPMFC_INCLUDE },
9  
10    { "troff or preprocessor input",     RPMFC_INCLUDE },
11    { "GNU Info",                        RPMFC_INCLUDE },
12 @@ -746,7 +747,11 @@
13         if (strstr(fmstr, fct->token) == NULL)
14             continue;
15  
16 -       fcolor |= fct->colors;
17 +       // This is a nasty hack, but will have to do for now
18 +       if ((fct->colors & RPMFC_ELF32) && (strstr(fmstr, "x86-64") != NULL))
19 +           fcolor |= RPMFC_ELFX32|RPMFC_INCLUDE;
20 +       else
21 +           fcolor |= fct->colors;
22         if (fcolor & RPMFC_INCLUDE)
23             break;
24      }
25 @@ -1147,7 +1152,10 @@
26                 color = RPMFC_ELF64;
27                 break;
28             case ELFCLASS32:
29 -               color = RPMFC_ELF32;
30 +               if (ehdr.e_machine == EM_X86_64)
31 +                   color = RPMFC_ELFX32;
32 +               else
33 +                   color = RPMFC_ELF32;
34                 break;
35             }
36             elf_end(elf);
37 diff -ur rpm-4.16.1.2/build/rpmfc.h rpm-4.16.1.2.x32/build/rpmfc.h
38 --- rpm-4.16.1.2/build/rpmfc.h  2020-05-28 12:04:25.011136544 +0200
39 +++ rpm-4.16.1.2.x32/build/rpmfc.h      2021-03-21 21:50:04.127398387 +0100
40 @@ -26,8 +26,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_WHITE                        = (1 << 29),
51 diff -ur rpm-4.16.1.2/configure.ac rpm-4.16.1.2.x32/configure.ac
52 --- rpm-4.16.1.2/configure.ac   2021-03-21 21:51:28.221530479 +0100
53 +++ rpm-4.16.1.2.x32/configure.ac       2021-03-21 21:50:04.127398387 +0100
54 @@ -930,6 +930,10 @@
55         host_os=`echo "${host_os}" | sed 's/-gnueabi$//'`
56         host_os_gnu=-gnueabi
57  fi
58 +if echo "$host_os" | grep '.*-gnux32' > /dev/null ; then
59 +       host_os=`echo "${host_os}" | sed 's/-gnux32$//'`
60 +       host_os_gnu=-gnux32
61 +fi
62  if echo "$host_os" | grep '.*-gnu' > /dev/null ; then
63         host_os=`echo "${host_os}" | sed 's/-gnu$//'`
64  fi
65 diff -ur rpm-4.16.1.2/fileattrs/python.attr rpm-4.16.1.2.x32/fileattrs/python.attr
66 --- rpm-4.16.1.2/fileattrs/python.attr  2020-08-31 11:14:07.991087349 +0200
67 +++ rpm-4.16.1.2.x32/fileattrs/python.attr      2021-03-21 21:50:04.127398387 +0100
68 @@ -14,14 +14,15 @@
69  %__python_requires() %{lua:
70      -- Match buildroot paths of the form
71      --    /PATH/OF/BUILDROOT/usr/lib/pythonMAJOR.MINOR/  and
72 -    --    /PATH/OF/BUILDROOT/usr/lib64/pythonMAJOR.MINOR/
73 +    --    /PATH/OF/BUILDROOT/usr/lib64/pythonMAJOR.MINOR/ and
74 +    --    /PATH/OF/BUILDROOT/usr/libx32/pythonMAJOR.MINOR/
75      -- generating a line of the form:
76      --    python(abi) = MAJOR.MINOR
77      local path = rpm.expand('%1')
78 -    if path:match('/usr/lib%d*/python%d+%.%d+/.*') then
79 -        local requires = path:gsub('.*/usr/lib%d*/python(%d+%.%d+)/.*', 'python(abi) = %1')
80 +    if path:match('/usr/lib%w*/python%d+%.%d+/.*') then
81 +        local requires = path:gsub('.*/usr/lib%w*/python(%d+%.%d+)/.*', 'python(abi) = %1')
82          print(requires)
83      end
84  }
85  
86 -%__python_path ^((%{_prefix}/lib(64)?/python[[:digit:]]+\\.[[:digit:]]+/.*\\.(py[oc]?|so))|(%{_bindir}/python[[:digit:]]+\\.[[:digit:]]+))$
87 +%__python_path ^((%{_prefix}/lib(64|x32)?/python[[:digit:]]+\\.[[:digit:]]+/.*\\.(py[oc]?|so))|(%{_bindir}/python[[:digit:]]+\\.[[:digit:]]+))$
88 diff -ur rpm-4.16.1.2/fileattrs/pythondist.attr rpm-4.16.1.2.x32/fileattrs/pythondist.attr
89 --- rpm-4.16.1.2/fileattrs/pythondist.attr      2020-05-28 12:04:25.026136626 +0200
90 +++ rpm-4.16.1.2.x32/fileattrs/pythondist.attr  2021-03-21 21:50:04.127398387 +0100
91 @@ -1,3 +1,3 @@
92  %__pythondist_provides %{_rpmconfigdir}/pythondistdeps.py --provides --majorver-provides
93  %__pythondist_requires %{_rpmconfigdir}/pythondistdeps.py --requires
94 -%__pythondist_path             /lib(64)?/python[[:digit:]]\\.[[:digit:]]+/site-packages/[^/]+\\.(dist-info|egg-info|egg-link)$
95 +%__pythondist_path             /lib(64|x32)?/python[[:digit:]]\\.[[:digit:]]+/site-packages/[^/]+\\.(dist-info|egg-info|egg-link)$
96 diff -ur rpm-4.16.1.2/installplatform rpm-4.16.1.2.x32/installplatform
97 --- rpm-4.16.1.2/installplatform        2020-05-28 12:04:25.027136631 +0200
98 +++ rpm-4.16.1.2.x32/installplatform    2021-03-21 21:51:47.671145954 +0100
99 @@ -21,6 +21,9 @@
100  
101    ARCH_INSTALL_POST='%{nil}'
102    LIB=lib
103 +  TARGETCPU="%{_target_cpu}"
104 +  APPEND_TARGET_ABI=
105 +  PREFERCOLOR=
106  
107    # XXX FIXME: incomplete and quite likely wrong too in places,
108    # consult various arch folks for correct names etc.
109 @@ -82,7 +84,16 @@
110         ISANAME=x86
111         ISABITS=64
112         CANONARCH=x86_64
113 -       CANONCOLOR=3
114 +       CANONCOLOR=7
115 +       ;;
116 +    x32)
117 +       ISANAME=x86
118 +       ISABITS=x32
119 +       CANONARCH=x32
120 +       CANONCOLOR=7
121 +       APPEND_TARGET_ABI=1
122 +       TARGETCPU="x86_64"
123 +       PREFERCOLOR=4
124         ;;
125      ia64)
126         ISANAME=ia
127 @@ -190,10 +200,14 @@
128    # skip architectures for which we dont have full config parameters
129    [ -z "$CANONARCH" ] && continue
130  
131 -  if [ "$OS" = "linux" ] && [ "$CANONCOLOR" = 3 ]; then
132 +  if [ "$OS" = "linux" ] && ( [ "$CANONCOLOR" = 3 ] || [ "$CANONARCH" = "x86_64" ] ); then
133        LIB=${LIB}64
134    fi
135  
136 +  if [ "$OS" = "linux" ] && [ "$CANONARCH" = "x32" ]; then
137 +      LIB=${LIB}x32
138 +  fi
139 +
140    PPD="${DESTDIR}/${platformdir}/${ARCH}-${OS}"
141    [ -d $PPD ] || mkdir -p $PPD
142  
143 @@ -202,7 +216,10 @@
144    | sed -e "s,@RPMRC_OPTFLAGS@,$RPMRC_OPTFLAGS," \
145         -e "s,@RPMCANONARCH@,$CANONARCH,g" \
146         -e "s,@RPMCANONCOLOR@,$CANONCOLOR," \
147 +       -e "s,@RPMPREFERCOLOR@,${PREFERCOLOR:+%_prefer_color\\t$PREFERCOLOR}," \
148         -e "s,@RPMRC_GNU@,$RPMRC_GNU," \
149 +       -e "s,@TARGET_ABI@,${APPEND_TARGET_ABI:+%{?_gnu\}}," \
150 +       -e "s,@TARGETCPU@,$TARGETCPU," \
151         -e "s,@LIB@,$LIB," \
152         -e "s,@ARCH_INSTALL_POST@,$ARCH_INSTALL_POST," \
153         -e '/\${\w*:-/!s,\${,%{_,' \
154 diff -ur rpm-4.16.1.2/platform.in rpm-4.16.1.2.x32/platform.in
155 --- rpm-4.16.1.2/platform.in    2020-05-28 12:04:25.047136741 +0200
156 +++ rpm-4.16.1.2.x32/platform.in        2021-03-21 21:51:47.671145954 +0100
157 @@ -8,7 +8,7 @@
158  %_vendor               @RPMCANONVENDOR@
159  %_os                   @RPMCANONOS@
160  %_gnu                  @RPMRC_GNU@
161 -%_target_platform      %{_target_cpu}-%{_vendor}-%{_target_os}
162 +%_target_platform      @TARGETCPU@-%{_vendor}-%{_target_os}@TARGET_ABI@
163  %optflags              @RPMRC_OPTFLAGS@
164  
165  %__isa_name            @ISANAME@
166 @@ -21,6 +21,7 @@
167  #      1       Elf32 permitted
168  #      2       Elf64 permitted
169  %_transaction_color    @RPMCANONCOLOR@
170 +@RPMPREFERCOLOR@
171  
172  #==============================================================================
173  # ---- configure macros.
174 diff -ur rpm-4.16.1.2/rpmrc.in rpm-4.16.1.2.x32/rpmrc.in
175 --- rpm-4.16.1.2/rpmrc.in       2020-05-28 12:04:25.075136894 +0200
176 +++ rpm-4.16.1.2.x32/rpmrc.in   2021-03-21 21:50:04.127398387 +0100
177 @@ -24,6 +24,7 @@
178  optflags: x86_64 -O2 -g
179  optflags: amd64 -O2 -g
180  optflags: ia32e -O2 -g
181 +optflags: x32 -O2 -g -mtune=generic -march=x86-64
182  
183  optflags: alpha -O2 -g -mieee
184  optflags: alphaev5 -O2 -g -mieee -mtune=ev5
185 @@ -155,6 +156,8 @@
186  
187  archcolor: riscv64 2
188  
189 +archcolor: x32 4
190 +
191  #############################################################
192  # Canonical arch names and numbers
193  
194 @@ -170,6 +173,7 @@
195  arch_canon:    amd64:  amd64   1
196  arch_canon:    ia32e:  ia32e   1
197  arch_canon:    em64t:  em64t   1
198 +arch_canon:    x32: x32        1
199  
200  arch_canon:    alpha:  alpha   2
201  arch_canon:    alphaev5: alphaev5      2
202 @@ -379,6 +383,8 @@
203  buildarchtranslate: amd64: x86_64
204  buildarchtranslate: ia32e: x86_64
205  
206 +buildarchtranslate: x32: x32
207 +
208  buildarchtranslate: sh3: sh3
209  buildarchtranslate: sh4: sh4
210  buildarchtranslate: sh4a: sh4
211 @@ -486,10 +492,12 @@
212  
213  arch_compat: ia64: noarch
214  
215 -arch_compat: x86_64: amd64 em64t athlon noarch
216 +arch_compat: x86_64: amd64 em64t athlon x32 noarch
217  arch_compat: amd64: x86_64 em64t athlon noarch
218  arch_compat: ia32e: x86_64 em64t athlon noarch
219  
220 +arch_compat: x32: x32 x86_64 noarch
221 +
222  arch_compat: sh3: noarch
223  arch_compat: sh4: noarch
224  arch_compat: sh4a: sh4
225 @@ -628,6 +636,8 @@
226  buildarch_compat: amd64: x86_64
227  buildarch_compat: ia32e: x86_64
228  
229 +buildarch_compat: x32: noarch
230 +
231  buildarch_compat: sh3: noarch
232  buildarch_compat: sh4: noarch
233  buildarch_compat: sh4a: sh4
234 diff -ur rpm-4.16.1.2/tools/elfdeps.c rpm-4.16.1.2.x32/tools/elfdeps.c
235 --- rpm-4.16.1.2/tools/elfdeps.c        2020-05-28 12:04:25.084136944 +0200
236 +++ rpm-4.16.1.2.x32/tools/elfdeps.c    2021-03-21 21:50:04.127398387 +0100
237 @@ -94,6 +94,9 @@
238             break;
239         }
240      }
241 +    if ((ehdr->e_ident[EI_CLASS] == ELFCLASS32) && (ehdr->e_machine == EM_X86_64)) {
242 +       marker = "(x32bit)";
243 +    }
244      return marker;
245  }
246