diff mbox series

[2/2] clang: auto-derive CLANG_EXTRA_OE_DISTRO from DISTRO

Message ID 20260812161341.822689-2-f_l_k@t-online.de
State New
Headers show
Series [1/2] clang: fix IsOpenEmbedded() detection for CLANG_EXTRA_OE_DISTRO entries | expand

Commit Message

Markus Volk Aug. 12, 2026, 4:13 p.m. UTC
CLANG_EXTRA_OE_VENDORS already auto-derives from TARGET_VENDOR and
SDK_VENDOR, recognizing a self-hosted OE build host without manual
configuration. CLANG_EXTRA_OE_DISTRO has no equivalent -- it ships
only 'poky:poky', so a self-hosted host running a custom DISTRO must
be manually registered before Distro::IsOpenEmbedded() recognizes it
via /etc/os-release.

This is easy to get wrong by hand, since the registered id must
exactly match the raw ID= value in /etc/os-release, including any
hyphens, which must NOT be converted to underscores (unlike the
generated C++ enumerator name, which requires the conversion). A
single typo silently disables the OE-specific GCC-install candidate
with no error, causing native clang-toolchain builds to fail to find
crtbeginS.o/libgcc despite running on a genuinely OE-built host.

Auto-derive an entry for the current DISTRO the same way
CLANG_EXTRA_OE_VENDORS already does, so self-hosted OE build hosts
are recognized out of the box with no configuration and no
hyphen/underscore typo risk. 'poky' is skipped since it is already
the shipped default.

Signed-off-by: Markus Volk <f_l_k@t-online.de>
Co-authored-by: Claude <noreply@anthropic.com>
---
 meta/recipes-devtools/clang/llvm-project-source.inc | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/meta/recipes-devtools/clang/llvm-project-source.inc b/meta/recipes-devtools/clang/llvm-project-source.inc
index 5cd08d4085..5a07080d55 100644
--- a/meta/recipes-devtools/clang/llvm-project-source.inc
+++ b/meta/recipes-devtools/clang/llvm-project-source.inc
@@ -28,6 +28,7 @@  CLANG_EXTRA_OE_VENDORS ?= "${TARGET_VENDOR} ${SDK_VENDOR}"
 # ":" separated the ID in "/etc/os-release" and the triple for finding gcc on this OE DISTRO.
 # eg: "poky:poky wrlinux:wrs"
 CLANG_EXTRA_OE_DISTRO ?= "poky:poky"
+CLANG_EXTRA_OE_DISTRO:append = "${@ ' ' + d.getVar('DISTRO') + ':oe' if d.getVar('DISTRO') not in ['poky', ''] else ''}"
 # Match with MULTILIB_GLOBAL_VARIANTS
 ML_VARIANTS = "lib32 lib64 libx32"