base: Allow overriding HOST_ARCH

Message ID 20260817084600.10501-1-2mooar@gmail.com
State New
Headers show
Series base: Allow overriding HOST_ARCH | expand

Commit Message

Dimitri Biermann Aug. 17, 2026, 8:46 a.m. UTC
Commit 9634b274 made HOST_ARCH an unconditional immediate assignment.
This overwrites values supplied through configuration or the BitBake
environment. It prevents creating, for example, an arm64 SDK on an
amd64 build machine.

Evaluate the detected architecture immediately in a separate variable
and retain HOST_ARCH as a weak default.

Fixes: 9634b27488df ("improve performance by immediate evaluation of HOST_ARCH")
Closes: https://github.com/ilbers/isar/issues/127

Signed-off-by: Dimitri Biermann <2mooar@gmail.com>
---
 meta/classes-global/base.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch

diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
index f074eee6..60b15b6f 100644
--- a/meta/classes-global/base.bbclass
+++ b/meta/classes-global/base.bbclass
@@ -60,7 +60,8 @@  def get_deb_host_arch():
     ).decode('utf-8').strip()
     return host_arch
 # immediately evaluate to avoid costly process call
-HOST_ARCH := "${@get_deb_host_arch()}"
+DETECTED_HOST_ARCH := "${@get_deb_host_arch()}"
+HOST_ARCH ??= "${DETECTED_HOST_ARCH}"
 HOST_DISTRO ??= "${DISTRO}"
 
 # Inject the PREFERRED_PROVIDERs for multiarch variants. This corresponds to