--- a/m4/dpkg-arch.m4 2026-10-14 12:41:34.709430018 +0800 +++ b/m4/dpkg-arch.m4 2026-10-14 12:41:34.709459828 +0800 @@ -55,12 +55,40 @@ AC_DEFUN([DPKG_ARCHITECTURE], [ DPKG_CPU_TYPE DPKG_OS_TYPE - AC_MSG_CHECKING([dpkg architecture name]) - _DPKG_ARCHITECTURE([DEB_HOST_ARCH], [dpkg_arch]) - AS_IF([test "x$dpkg_arch" = "x"], [ - AC_MSG_ERROR([cannot determine host dpkg architecture]) - ], [ + dnl Termux/Android: data/cputable, data/ostable and data/tupletable only + dnl describe the Debian and GNU worlds -- ostable has no "android" entry at + dnl all -- so the generic lookup below can never resolve a *-linux-android + dnl host triple and configure dies with "cannot determine host dpkg + dnl architecture". + dnl + dnl Termux names its architectures after the GNU CPU name (the repository + dnl serves x86_64, aarch64, arm and i686), and the package database shipped + dnl in our bootstrap was written with exactly those names, so we have to + dnl report the same thing or dpkg would reject every installed package. + dnl + dnl Note the host OS arrives as "linux-android", not "android": config.sub + dnl normalises --host=x86_64-linux-android into x86_64-pc-linux-android. + AS_CASE([$host_os], + [*android*], [ + AS_CASE([$host_cpu], + [x86_64|aarch64|i686|arm], [dpkg_arch=$host_cpu], + [armv7*], [dpkg_arch=arm], + [AC_MSG_ERROR([unsupported Android CPU: $host_cpu])]) + cpu_type=$host_cpu + os_type=android + have_dpkg_arch=yes + ]) + AS_IF([test "x$have_dpkg_arch" = "xyes"], [ + AC_MSG_CHECKING([dpkg architecture name]) AC_MSG_RESULT([$dpkg_arch]) + ], [ + AC_MSG_CHECKING([dpkg architecture name]) + _DPKG_ARCHITECTURE([DEB_HOST_ARCH], [dpkg_arch]) + AS_IF([test "x$dpkg_arch" = "x"], [ + AC_MSG_ERROR([cannot determine host dpkg architecture]) + ], [ + AC_MSG_RESULT([$dpkg_arch]) + ]) ]) AC_DEFINE_UNQUOTED([ARCHITECTURE], ["${dpkg_arch}"], [Set this to the canonical dpkg architecture name.])