CONFIG: improve handling of debian multi-arch

- no guarantee that dpkg-architecture command is actually available,
  so revert to a reasonable guess from 'uname -m' and 'uname -s'
This commit is contained in:
Mark Olesen
2022-12-16 10:51:03 +01:00
parent 4dafaa8cfe
commit 87cff55f9e
2 changed files with 54 additions and 16 deletions

View File

@ -33,6 +33,9 @@
# WM_COMPILER_LIB_ARCH
# DEB_TARGET_MULTIARCH
#
# Possible Dependencies
# - dpkg-architecture
#
#------------------------------------------------------------------------------
if [ -z "$WMAKE_SCRIPTS_SYSFUNCTIONS" ]
@ -40,10 +43,17 @@ then
# Load once, but do not rely on this variable elsewhere
WMAKE_SCRIPTS_SYSFUNCTIONS=loaded
# Debian multi-arch, ignore missing/bad dpkg-architecture.
if [ -z "$DEB_TARGET_MULTIARCH" ]
# Handle debian multi-arch...
# but dpkg-architecture command may also be missing
if [ -z "$DEB_TARGET_MULTIARCH" ] && [ -f /etc/debian_version ]
then
DEB_TARGET_MULTIARCH=$(dpkg-architecture -qDEB_TARGET_MULTIARCH 2>/dev/null || true)
DEB_TARGET_MULTIARCH="$(dpkg-architecture -qDEB_TARGET_MULTIARCH 2>/dev/null || true)"
if [ -z "$DEB_TARGET_MULTIARCH" ] && [ "${WM_ARCH#linux}" != "${WM_ARCH}" ]
then
# Reasonable guess at a multi-arch name (eg, x86_64-linux-gnu)
# TODO: aarch64 -> arm64 ?
DEB_TARGET_MULTIARCH="$(uname -m)-linux-gnu"
fi
fi
# True if OS is <darwin>.