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
6 { "ELF 32-bit", RPMFC_ELF32|RPMFC_INCLUDE },
7 { "ELF 64-bit", RPMFC_ELF64|RPMFC_INCLUDE },
8 +// { "ELF 32-bit", RPMFC_ELFX32|RPMFC_INCLUDE },
10 { "troff or preprocessor input", RPMFC_INCLUDE },
11 { "GNU Info", RPMFC_INCLUDE },
13 if (strstr(fmstr, fct->token) == NULL)
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;
21 + fcolor |= fct->colors;
22 if (fcolor & RPMFC_INCLUDE)
25 @@ -1147,7 +1152,10 @@
29 - color = RPMFC_ELF32;
30 + if (ehdr.e_machine == EM_X86_64)
31 + color = RPMFC_ELFX32;
33 + color = RPMFC_ELF32;
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
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_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
55 host_os=`echo "${host_os}" | sed 's/-gnueabi$//'`
58 +if echo "$host_os" | grep '.*-gnux32' > /dev/null ; then
59 + host_os=`echo "${host_os}" | sed 's/-gnux32$//'`
62 if echo "$host_os" | grep '.*-gnu' > /dev/null ; then
63 host_os=`echo "${host_os}" | sed 's/-gnu$//'`
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
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')
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
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
101 ARCH_INSTALL_POST='%{nil}'
103 + TARGETCPU="%{_target_cpu}"
106 # XXX FIXME: incomplete and quite likely wrong too in places,
107 # consult various arch folks for correct names etc.
121 + FORCE_RPMRC_GNU="%{?_gnu}"
130 + if [ "$OS" = "linux" ] && [ "$CANONARCH" = "x32" ]; then
134 PPD="${DESTDIR}/${platformdir}/${ARCH}-${OS}"
135 [ -d $PPD ] || mkdir -p $PPD
138 -e "s,@RPMCANONARCH@,$CANONARCH,g" \
139 -e "s,@RPMCANONCOLOR@,$CANONCOLOR," \
140 -e "s,@RPMRC_GNU@,$RPMRC_GNU," \
141 + -e "s,@FORCE_RPMRC_GNU@,$FORCE_RPMRC_GNU," \
142 + -e "s,@TARGETCPU@,$TARGETCPU," \
144 -e "s,@ARCH_INSTALL_POST@,$ARCH_INSTALL_POST," \
145 -e '/\${\w*:-/!s,\${,%{_,' \
146 diff -ur rpm-4.16.1.2/platform.in rpm-4.16.1.2.x32/platform.in
147 --- rpm-4.16.1.2/platform.in 2020-05-28 12:04:25.047136741 +0200
148 +++ rpm-4.16.1.2.x32/platform.in 2021-03-21 21:51:47.671145954 +0100
150 %_vendor @RPMCANONVENDOR@
153 -%_target_platform %{_target_cpu}-%{_vendor}-%{_target_os}
154 +%_target_platform @TARGETCPU@-%{_vendor}-%{_target_os}@FORCE_RPMRC_GNU@
155 %optflags @RPMRC_OPTFLAGS@
157 %__isa_name @ISANAME@
158 diff -ur rpm-4.16.1.2/rpmrc.in rpm-4.16.1.2.x32/rpmrc.in
159 --- rpm-4.16.1.2/rpmrc.in 2020-05-28 12:04:25.075136894 +0200
160 +++ rpm-4.16.1.2.x32/rpmrc.in 2021-03-21 21:50:04.127398387 +0100
162 optflags: x86_64 -O2 -g
163 optflags: amd64 -O2 -g
164 optflags: ia32e -O2 -g
165 +optflags: x32 -O2 -g -mtune=generic -march=x86-64
167 optflags: alpha -O2 -g -mieee
168 optflags: alphaev5 -O2 -g -mieee -mtune=ev5
175 #############################################################
176 # Canonical arch names and numbers
179 arch_canon: amd64: amd64 1
180 arch_canon: ia32e: ia32e 1
181 arch_canon: em64t: em64t 1
182 +arch_canon: x32: x32 1
184 arch_canon: alpha: alpha 2
185 arch_canon: alphaev5: alphaev5 2
187 buildarchtranslate: amd64: x86_64
188 buildarchtranslate: ia32e: x86_64
190 +buildarchtranslate: x32: x32
192 buildarchtranslate: sh3: sh3
193 buildarchtranslate: sh4: sh4
194 buildarchtranslate: sh4a: sh4
195 @@ -486,10 +492,12 @@
197 arch_compat: ia64: noarch
199 -arch_compat: x86_64: amd64 em64t athlon noarch
200 +arch_compat: x86_64: amd64 em64t athlon x32 noarch
201 arch_compat: amd64: x86_64 em64t athlon noarch
202 arch_compat: ia32e: x86_64 em64t athlon noarch
204 +arch_compat: x32: x32 x86_64 noarch
206 arch_compat: sh3: noarch
207 arch_compat: sh4: noarch
208 arch_compat: sh4a: sh4
210 buildarch_compat: amd64: x86_64
211 buildarch_compat: ia32e: x86_64
213 +buildarch_compat: x32: noarch
215 buildarch_compat: sh3: noarch
216 buildarch_compat: sh4: noarch
217 buildarch_compat: sh4a: sh4
218 diff -ur rpm-4.16.1.2/tools/elfdeps.c rpm-4.16.1.2.x32/tools/elfdeps.c
219 --- rpm-4.16.1.2/tools/elfdeps.c 2020-05-28 12:04:25.084136944 +0200
220 +++ rpm-4.16.1.2.x32/tools/elfdeps.c 2021-03-21 21:50:04.127398387 +0100
225 + if ((ehdr->e_ident[EI_CLASS] == ELFCLASS32) && (ehdr->e_machine == EM_X86_64)) {
226 + marker = "(x32bit)";