diff -ur rpm-4.15.1.orig/build/rpmfc.c rpm-4.15.1/build/rpmfc.c --- rpm-4.15.1.orig/build/rpmfc.c 2019-12-29 14:07:19.877313873 +0100 +++ rpm-4.15.1/build/rpmfc.c 2019-12-29 13:47:23.183804165 +0100 @@ -595,6 +595,7 @@ { "ELF 32-bit", RPMFC_ELF32|RPMFC_INCLUDE }, { "ELF 64-bit", RPMFC_ELF64|RPMFC_INCLUDE }, +// { "ELF 32-bit", RPMFC_ELFX32|RPMFC_INCLUDE }, { "troff or preprocessor input", RPMFC_INCLUDE }, { "GNU Info", RPMFC_INCLUDE }, @@ -696,7 +697,11 @@ if (strstr(fmstr, fct->token) == NULL) continue; - fcolor |= fct->colors; + // This is a nasty hack, but will have to do for now + if ((fct->colors & RPMFC_ELF32) && (strstr(fmstr, "x86-64") != NULL)) + fcolor |= RPMFC_ELFX32|RPMFC_INCLUDE; + else + fcolor |= fct->colors; if (fcolor & RPMFC_INCLUDE) break; } diff -ur rpm-4.15.1.orig/build/rpmfc.h rpm-4.15.1/build/rpmfc.h --- rpm-4.15.1.orig/build/rpmfc.h 2019-06-26 16:17:31.397985717 +0200 +++ rpm-4.15.1/build/rpmfc.h 2019-12-29 13:45:05.936980833 +0100 @@ -26,8 +26,9 @@ RPMFC_BLACK = 0, RPMFC_ELF32 = (1 << 0), RPMFC_ELF64 = (1 << 1), + RPMFC_ELFX32 = (1 << 2), RPMFC_ELFMIPSN32 = (1 << 2), -#define RPMFC_ELF (RPMFC_ELF32|RPMFC_ELF64|RPMFC_ELFMIPSN32) +#define RPMFC_ELF (RPMFC_ELF32|RPMFC_ELF64|RPMFC_ELFX32|RPMFC_ELFMIPSN32) /* (1 << 3) leaks into package headers, reserved */ RPMFC_WHITE = (1 << 29), diff -ur rpm-4.15.1.orig/configure.ac rpm-4.15.1/configure.ac --- rpm-4.15.1.orig/configure.ac 2019-12-29 14:07:19.813977936 +0100 +++ rpm-4.15.1/configure.ac 2019-12-29 14:27:41.381850928 +0100 @@ -1050,6 +1050,9 @@ host_os=`echo "${host_os}" | sed 's/-gnueabi$//'` host_os_gnu=-gnueabi fi +if echo "$host_os" | grep '.*-gnux32' > /dev/null ; then + host_os=`echo "${host_os}" | sed 's/-gnux32$//'` +fi if echo "$host_os" | grep '.*-gnu' > /dev/null ; then host_os=`echo "${host_os}" | sed 's/-gnu$//'` fi diff -ur rpm-4.15.1.orig/installplatform rpm-4.15.1/installplatform --- rpm-4.15.1.orig/installplatform 2019-06-26 16:17:31.404985707 +0200 +++ rpm-4.15.1/installplatform 2019-12-29 14:52:09.331085139 +0100 @@ -21,6 +21,7 @@ ARCH_INSTALL_POST='%{nil}' LIB=lib + TARGETCPU="%{_target_cpu}" # XXX FIXME: incomplete and quite likely wrong too in places, # consult various arch folks for correct names etc. @@ -82,7 +83,15 @@ ISANAME=x86 ISABITS=64 CANONARCH=x86_64 + CANONCOLOR=7 + ;; + x32) + ISANAME=x86 + ISABITS=32 + CANONARCH=x32 CANONCOLOR=3 + RPMRC_GNU="${RPMRC_GNU}x32" + TARGETCPU="x86_64" ;; ia64) ISANAME=ia @@ -190,10 +199,14 @@ # skip architectures for which we dont have full config parameters [ -z "$CANONARCH" ] && continue - if [ "$OS" = "linux" ] && [ "$CANONCOLOR" = 3 ]; then + if [ "$OS" = "linux" ] && [ "$CANONARCH" = "x86_64" ]; then LIB=${LIB}64 fi + if [ "$OS" = "linux" ] && [ "$CANONARCH" = "x32" ]; then + LIB=${LIB}x32 + fi + PPD="${DESTDIR}/${platformdir}/${ARCH}-${OS}" [ -d $PPD ] || mkdir -p $PPD @@ -202,6 +215,7 @@ -e "s,@RPMCANONARCH@,$CANONARCH,g" \ -e "s,@RPMCANONCOLOR@,$CANONCOLOR," \ -e "s,@RPMRC_GNU@,$RPMRC_GNU," \ + -e "s,@TARGETCPU@,$TARGETCPU," \ -e "s,@LIB@,$LIB," \ -e "s,@ARCH_INSTALL_POST@,$ARCH_INSTALL_POST," \ -e '/\${\w*:-/!s,\${,%{_,' \ diff -ur rpm-4.15.1.orig/platform.in rpm-4.15.1/platform.in --- rpm-4.15.1.orig/platform.in 2019-11-13 10:19:29.371710954 +0100 +++ rpm-4.15.1/platform.in 2019-12-29 14:47:30.886959421 +0100 @@ -8,7 +8,7 @@ %_vendor @RPMCANONVENDOR@ %_os @RPMCANONOS@ %_gnu @RPMRC_GNU@ -%_target_platform %{_target_cpu}-%{_vendor}-%{_target_os} +%_target_platform @TARGETCPU@-%{_vendor}-%{_target_os}%{?_gnu} %optflags @RPMRC_OPTFLAGS@ %__isa_name @ISANAME@ diff -ur rpm-4.15.1.orig/rpmrc.in rpm-4.15.1/rpmrc.in --- rpm-4.15.1.orig/rpmrc.in 2019-11-13 10:19:29.418711227 +0100 +++ rpm-4.15.1/rpmrc.in 2019-12-29 14:51:20.293119352 +0100 @@ -24,6 +24,7 @@ optflags: x86_64 -O2 -g optflags: amd64 -O2 -g optflags: ia32e -O2 -g +optflags: x32 -O2 -g -mtune=generic -march=x86-64 optflags: alpha -O2 -g -mieee optflags: alphaev5 -O2 -g -mieee -mtune=ev5 @@ -155,6 +156,8 @@ archcolor: riscv64 2 +archcolor: x32 4 + ############################################################# # Canonical arch names and numbers @@ -170,6 +173,7 @@ arch_canon: amd64: amd64 1 arch_canon: ia32e: ia32e 1 arch_canon: em64t: em64t 1 +arch_canon: x32: x32 1 arch_canon: alpha: alpha 2 arch_canon: alphaev5: alphaev5 2 @@ -379,6 +383,8 @@ buildarchtranslate: amd64: x86_64 buildarchtranslate: ia32e: x86_64 +buildarchtranslate: x32: x32 + buildarchtranslate: sh3: sh3 buildarchtranslate: sh4: sh4 buildarchtranslate: sh4a: sh4 @@ -490,6 +496,8 @@ arch_compat: amd64: x86_64 em64t athlon noarch arch_compat: ia32e: x86_64 em64t athlon noarch +arch_compat: x32: x32 noarch + arch_compat: sh3: noarch arch_compat: sh4: noarch arch_compat: sh4a: sh4 @@ -628,6 +636,8 @@ buildarch_compat: amd64: x86_64 buildarch_compat: ia32e: x86_64 +buildarch_compat: x32: noarch + buildarch_compat: sh3: noarch buildarch_compat: sh4: noarch buildarch_compat: sh4a: sh4 diff -ur rpm-4.15.1.orig/tools/elfdeps.c rpm-4.15.1/tools/elfdeps.c --- rpm-4.15.1.orig/tools/elfdeps.c 2019-06-26 16:17:31.462985619 +0200 +++ rpm-4.15.1/tools/elfdeps.c 2019-12-29 14:22:05.339471071 +0100 @@ -94,6 +94,9 @@ break; } } + if ((ehdr->e_ident[EI_CLASS] == ELFCLASS32) && (ehdr->e_machine == EM_X86_64)) { + marker = "(x32bit)"; + } return marker; } --- rpm-4.15.1/fileattrs/pythondist.attr~ 2019-06-26 23:17:31.000000000 +0900 +++ rpm-4.15.1/fileattrs/pythondist.attr 2020-01-04 23:34:05.680366882 +0900 @@ -1,3 +1,3 @@ %__pythondist_provides %{_rpmconfigdir}/pythondistdeps.py --provides --majorver-provides %__pythondist_requires %{_rpmconfigdir}/pythondistdeps.py --requires -%__pythondist_path /lib(64)?/python[[:digit:]]\\.[[:digit:]]+/site-packages/[^/]+\\.(dist-info|egg-info|egg-link)$ +%__pythondist_path /lib(64|x32)?/python[[:digit:]]\\.[[:digit:]]+/site-packages/[^/]+\\.(dist-info|egg-info|egg-link)$ --- rpm-4.16.0/fileattrs/python.attr.orig 2020-08-31 11:14:07.991087349 +0200 +++ rpm-4.16.0/fileattrs/python.attr 2020-10-03 10:47:16.560360859 +0200 @@ -14,14 +14,15 @@ %__python_requires() %{lua: -- Match buildroot paths of the form -- /PATH/OF/BUILDROOT/usr/lib/pythonMAJOR.MINOR/ and - -- /PATH/OF/BUILDROOT/usr/lib64/pythonMAJOR.MINOR/ + -- /PATH/OF/BUILDROOT/usr/lib64/pythonMAJOR.MINOR/ and + -- /PATH/OF/BUILDROOT/usr/libx32/pythonMAJOR.MINOR/ -- generating a line of the form: -- python(abi) = MAJOR.MINOR local path = rpm.expand('%1') - if path:match('/usr/lib%d*/python%d+%.%d+/.*') then - local requires = path:gsub('.*/usr/lib%d*/python(%d+%.%d+)/.*', 'python(abi) = %1') + if path:match('/usr/lib%w*/python%d+%.%d+/.*') then + local requires = path:gsub('.*/usr/lib%w*/python(%d+%.%d+)/.*', 'python(abi) = %1') print(requires) end } -%__python_path ^((%{_prefix}/lib(64)?/python[[:digit:]]+\\.[[:digit:]]+/.*\\.(py[oc]?|so))|(%{_bindir}/python[[:digit:]]+\\.[[:digit:]]+))$ +%__python_path ^((%{_prefix}/lib(64|x32)?/python[[:digit:]]+\\.[[:digit:]]+/.*\\.(py[oc]?|so))|(%{_bindir}/python[[:digit:]]+\\.[[:digit:]]+))$