diff mbox series

[16/19] sdks: Add clang toolchain to SDKs

Message ID 20241105184540.3450302-16-raj.khem@gmail.com
State New
Headers show
Series [01/19] clang.inc: Global settings for clang toolchain | expand

Commit Message

Khem Raj Nov. 5, 2024, 6:45 p.m. UTC
Use SDK_TOOLCHAINS_LANGS to tether clang toolchain into SDKs

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 documentation/ref-manual/variables.rst         |  2 +-
 meta/classes-recipe/populate_sdk_base.bbclass  |  2 ++
 .../packagegroup-clang-cross-canadian.bb       | 18 ++++++++++++++++++
 .../packagegroup-clang-sdk-target.bb           | 15 +++++++++++++++
 .../packagegroup-core-buildessential.bb        |  5 +++++
 .../packagegroups/packagegroup-core-sdk.bb     |  1 +
 6 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-core/packagegroups/packagegroup-clang-cross-canadian.bb
 create mode 100644 meta/recipes-core/packagegroups/packagegroup-clang-sdk-target.bb

Comments

Mathieu Dubois-Briand Nov. 6, 2024, 10:38 a.m. UTC | #1
On Tue, Nov 05, 2024 at 10:45:35AM -0800, Khem Raj wrote:
> Use SDK_TOOLCHAINS_LANGS to tether clang toolchain into SDKs
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---

Hi Khem,

Thanks for your patches, but I believe there is an issue with this one:
it modifies files in both openembedded-core and yocto-docs.

Could you provide the documentation modification as a separate commit ?
Khem Raj Nov. 6, 2024, 2:54 p.m. UTC | #2
On Wed, Nov 6, 2024 at 2:38 AM Mathieu Dubois-Briand <
mathieu.dubois-briand@bootlin.com> wrote:

> On Tue, Nov 05, 2024 at 10:45:35AM -0800, Khem Raj wrote:
> > Use SDK_TOOLCHAINS_LANGS to tether clang toolchain into SDKs
> >
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > ---
>
> Hi Khem,
>
> Thanks for your patches, but I believe there is an issue with this one:
> it modifies files in both openembedded-core and yocto-docs.
>
> Could you provide the documentation modification as a separate commit ?


Thanks for reporting this. Will push into control tree soon

>
>
> --
> Mathieu Dubois-Briand, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
diff mbox series

Patch

diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
index 07ed143ac56..77dbe2814cb 100644
--- a/documentation/ref-manual/variables.rst
+++ b/documentation/ref-manual/variables.rst
@@ -7715,7 +7715,7 @@  system and gives an overview of their function and contents.
 
    :term:`SDK_TOOLCHAIN_LANGS`
       Specifies programming languages to support in the SDK, as a
-      space-separated list. Currently supported items are ``rust`` and ``go``.
+      space-separated list. Currently supported items are ``clang``, ``rust`` and ``go``.
 
    :term:`SDK_UPDATE_URL`
       An optional URL for an update server for the extensible SDK. If set,
diff --git a/meta/classes-recipe/populate_sdk_base.bbclass b/meta/classes-recipe/populate_sdk_base.bbclass
index 031c65f05f3..68a772c3bd2 100644
--- a/meta/classes-recipe/populate_sdk_base.bbclass
+++ b/meta/classes-recipe/populate_sdk_base.bbclass
@@ -64,12 +64,14 @@  SDK_TOOLCHAIN_LANGS:remove:mipsarchn32 = "rust"
 TOOLCHAIN_HOST_TASK ?= " \
     nativesdk-packagegroup-sdk-host \
     packagegroup-cross-canadian-${MACHINE} \
+    ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'clang', 'packagegroup-clang-cross-canadian-${MACHINE}', '', d)} \
     ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'go', 'packagegroup-go-cross-canadian-${MACHINE}', '', d)} \
     ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'rust', 'packagegroup-rust-cross-canadian-${MACHINE}', '', d)} \
 "
 TOOLCHAIN_HOST_TASK_ATTEMPTONLY ?= ""
 TOOLCHAIN_TARGET_TASK ?= " \
     ${@multilib_pkg_extend(d, 'packagegroup-core-standalone-sdk-target')} \
+    ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'clang', multilib_pkg_extend(d, 'packagegroup-clang-sdk-target'), '', d)} \
     ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'go', multilib_pkg_extend(d, 'packagegroup-go-sdk-target'), '', d)} \
     ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'rust', multilib_pkg_extend(d, 'libstd-rs'), '', d)} \
     target-sdk-provides-dummy \
diff --git a/meta/recipes-core/packagegroups/packagegroup-clang-cross-canadian.bb b/meta/recipes-core/packagegroups/packagegroup-clang-cross-canadian.bb
new file mode 100644
index 00000000000..2a6303cc824
--- /dev/null
+++ b/meta/recipes-core/packagegroups/packagegroup-clang-cross-canadian.bb
@@ -0,0 +1,18 @@ 
+SUMMARY = "Host SDK package for Clang cross canadian toolchain"
+PN = "packagegroup-clang-cross-canadian-${MACHINE}"
+
+inherit cross-canadian packagegroup
+
+PACKAGEGROUP_DISABLE_COMPLEMENTARY = "1"
+
+CLANG="clang-cross-canadian-${TRANSLATED_TARGET_ARCH}"
+
+RDEPENDS:${PN} = " \
+    ${@all_multilib_tune_values(d, 'CLANG')} \
+    nativesdk-binutils \
+    nativesdk-clang \
+    nativesdk-glibc-dev \
+    nativesdk-libgcc-dev \
+    nativesdk-compiler-rt-dev \
+    nativesdk-libcxx-dev \
+"
diff --git a/meta/recipes-core/packagegroups/packagegroup-clang-sdk-target.bb b/meta/recipes-core/packagegroups/packagegroup-clang-sdk-target.bb
new file mode 100644
index 00000000000..2b30642427c
--- /dev/null
+++ b/meta/recipes-core/packagegroups/packagegroup-clang-sdk-target.bb
@@ -0,0 +1,15 @@ 
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+SUMMARY = "Target packages for the Clang SDK"
+
+inherit packagegroup
+
+RDEPENDS:${PN} = " \
+    clang \
+    libcxx \
+    compiler-rt \
+"
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-buildessential.bb b/meta/recipes-core/packagegroups/packagegroup-core-buildessential.bb
index 2cd67ad05f8..d140f1f54af 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-buildessential.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-buildessential.bb
@@ -29,3 +29,8 @@  RDEPENDS:packagegroup-core-buildessential = "\
     pkgconfig \
     "
 
+RDEPENDS:packagegroup-core-buildessential:append:toolchain-clang = "\
+    clang \
+    libcxx \
+    compiler-rt \
+    "
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb b/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb
index 84e1a41d9a0..c2385a97b44 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb
@@ -30,6 +30,7 @@  RDEPENDS:packagegroup-core-sdk = "\
     tcl \
     ${@bb.utils.contains('TARGET_TOOLCHAIN_LANGS', 'go', 'packagegroup-go-sdk-target', '', d)} \
     ${@bb.utils.contains('TARGET_TOOLCHAIN_LANGS', 'rust', 'packagegroup-rust-sdk-target', '', d)} \
+    ${@bb.utils.contains('TARGET_TOOLCHAIN_LANGS', 'clang', 'packagegroup-clang-sdk-target', '', d)} \
 "
 
 SANITIZERS = "libasan-dev libubsan-dev"