From patchwork Tue Jul 15 14:31:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 66830 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EB0AC83F17 for ; Tue, 15 Jul 2025 14:31:48 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.10201.1752589903623446248 for ; Tue, 15 Jul 2025 07:31:43 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7275712FC for ; Tue, 15 Jul 2025 07:31:34 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BDF383F694 for ; Tue, 15 Jul 2025 07:31:42 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH] libclc: split out of clang Date: Tue, 15 Jul 2025 15:31:38 +0100 Message-ID: <20250715143139.1829393-1-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 15 Jul 2025 14:31:48 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/220298 Split the libclc subproject out of the clang recipe and into a dedicated libclc recipe. Verified that nothing is dropped by adding clang and libclc to an image and verifying that the file list is the same before and after this change. Signed-off-by: Ross Burton --- meta/conf/distro/include/maintainers.inc | 1 + meta/recipes-devtools/clang/clang_git.bb | 17 +++---- meta/recipes-devtools/clang/libclc_git.bb | 54 +++++++++++++++++++++++ 3 files changed, 61 insertions(+), 11 deletions(-) create mode 100644 meta/recipes-devtools/clang/libclc_git.bb diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc index f49d7317ee9..67f392161c4 100644 --- a/meta/conf/distro/include/maintainers.inc +++ b/meta/conf/distro/include/maintainers.inc @@ -328,6 +328,7 @@ RECIPE_MAINTAINER:pn-libcap-ng = "Yi Zhao " RECIPE_MAINTAINER:pn-libcap-ng-python = "Yi Zhao " RECIPE_MAINTAINER:pn-libcgroup = "Unassigned " RECIPE_MAINTAINER:pn-libcheck = "Yi Zhao " +RECIPE_MAINTAINER:pn-libclc = "Khem Raj " RECIPE_MAINTAINER:pn-libcomps = "Unassigned " RECIPE_MAINTAINER:pn-libconvert-asn1-perl = "Tim Orling " RECIPE_MAINTAINER:pn-libcxx = "Khem Raj " diff --git a/meta/recipes-devtools/clang/clang_git.bb b/meta/recipes-devtools/clang/clang_git.bb index 1daac48edaf..4cbe22f4546 100644 --- a/meta/recipes-devtools/clang/clang_git.bb +++ b/meta/recipes-devtools/clang/clang_git.bb @@ -130,7 +130,7 @@ HF[vardepvalue] = "${HF}" # Ensure that LLVM_PROJECTS does not contain compiler runtime components e.g. libcxx etc # they are enabled via LLVM_ENABLE_RUNTIMES -LLVM_PROJECTS ?= "clang;clang-tools-extra;libclc;lld" +LLVM_PROJECTS ?= "clang;clang-tools-extra;lld" # linux hosts (.so) on Windows .pyd SOLIBSDEV:mingw32 = ".pyd" @@ -191,7 +191,7 @@ EXTRA_OECMAKE:append:class-target = "\ DEPENDS = "binutils zlib zstd libffi libxml2 libxml2-native ninja-native swig-native spirv-tools-native llvm-tblgen-native" DEPENDS:append:class-nativesdk = " clang-crosssdk-${SDK_SYS} virtual/nativesdk-cross-binutils nativesdk-python3" -DEPENDS:append:class-target = " clang-cross-${TARGET_ARCH} python3 ${@bb.utils.contains('TC_CXX_RUNTIME', 'llvm', 'compiler-rt libcxx', '', d)} spirv-llvm-translator-native" +DEPENDS:append:class-target = " clang-cross-${TARGET_ARCH} python3 ${@bb.utils.contains('TC_CXX_RUNTIME', 'llvm', 'compiler-rt libcxx', '', d)}" RRECOMMENDS:${PN} = "binutils" RRECOMMENDS:${PN}:append:class-target = "${@bb.utils.contains('TC_CXX_RUNTIME', 'llvm', ' libcxx-dev', '', d)}" @@ -258,7 +258,6 @@ do_install:append:class-native () { install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clangd-indexer ${D}${bindir}/clangd-indexer fi install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tidy-confusable-chars-gen ${D}${bindir}/clang-tidy-confusable-chars-gen - install -Dm 0755 ${B}${BINPATHPREFIX}/bin/prepare_builtins ${D}${bindir}/prepare_builtins for f in `find ${D}${bindir} -executable -type f -not -type l`; do test -n "`file -b $f|grep -i ELF`" && ${STRIP} $f @@ -294,11 +293,11 @@ do_install:append:class-nativesdk () { fi } -PROVIDES:append:class-native = " llvm-native libclc-native" -PROVIDES:append:class-target = " llvm libclc" -PROVIDES:append:class-nativesdk = " nativesdk-llvm nativesdk-libclc" +PROVIDES:append:class-native = " llvm-native" +PROVIDES:append:class-target = " llvm" +PROVIDES:append:class-nativesdk = " nativesdk-llvm" -PACKAGES =+ "${PN}-libllvm ${PN}-libclang-python ${PN}-libclang-cpp ${PN}-tidy ${PN}-format ${PN}-tools ${PN}-clc \ +PACKAGES =+ "${PN}-libllvm ${PN}-libclang-python ${PN}-libclang-cpp ${PN}-tidy ${PN}-format ${PN}-tools \ libclang llvm-linker-tools" BBCLASSEXTEND = "native nativesdk" @@ -315,8 +314,6 @@ RDEPENDS:${PN}-tools += "\ perl-module-term-ansicolor \ " -RPROVIDES:${PN}-clc = "${MLPREFIX}libclc" - RRECOMMENDS:${PN}-tidy += "${PN}-tools" FILES:llvm-linker-tools = "${libdir}/LLVMgold* ${libdir}/libLTO.so.* ${libdir}/LLVMPolly*" @@ -383,8 +380,6 @@ FILES:${PN} += "\ ${nonarch_libdir}/${BPN}/*/include/ \ " -FILES:${PN}-clc += "${datadir}/clc" - FILES:${PN}-libllvm =+ "\ ${libdir}/libLLVM.so.${MAJOR_VER}.${MINOR_VER} \ ${libdir}/libLLVM-${MAJOR_VER}.so \ diff --git a/meta/recipes-devtools/clang/libclc_git.bb b/meta/recipes-devtools/clang/libclc_git.bb new file mode 100644 index 00000000000..da849ba6ce8 --- /dev/null +++ b/meta/recipes-devtools/clang/libclc_git.bb @@ -0,0 +1,54 @@ +SUMMARY = "Implementation of the library requirements of the OpenCL C programming language." +HOMEPAGE = "https://libclc.llvm.org" +SECTION = "devel" + +require common-clang.inc +require common-source.inc + +LIC_FILES_CHKSUM = "file://libclc/LICENSE.TXT;md5=7cc795f6cbb2d801d84336b83c8017db" + +inherit cmake pkgconfig + +TOOLCHAIN = "clang" + +# The clang dependency is actually just target LLVM +DEPENDS += "clang spirv-llvm-translator-native" + +OECMAKE_SOURCEPATH = "${S}/libclc" + +# Semicolon-separated list of targets to build +LIBCLC_TARGETS ?= "all" + +EXTRA_OECMAKE = "\ + -DLLVM_DIR=${STAGING_LIBDIR}/cmake/llvm/ \ + -DLIBCLC_TARGETS_TO_BUILD=${LIBCLC_TARGETS} \ +" + +# Until the target LLVMConfig.cmake points to the correct native directory for +# the binaries, we need to specify their location manually. +EXTRA_OECMAKE:append:class-target = "\ + -DLLVM_TOOL_clang=${STAGING_BINDIR_TOOLCHAIN}/${HOST_PREFIX}clang \ + -DLLVM_TOOL_llvm-as=${STAGING_BINDIR_TOOLCHAIN}/${HOST_PREFIX}llvm-as \ + -DLLVM_TOOL_llvm-link=${STAGING_BINDIR_NATIVE}/llvm-link \ + -DLLVM_TOOL_opt=${STAGING_BINDIR_NATIVE}/opt \ +" + +# Need to build a native prepare_builtins binary in target builds. The easiest +# way to do this is with a second native cmake build tree. +PATH .= ":${B}/native" + +do_build_prepare_builtins() { + cmake -G Ninja \ + -S ${OECMAKE_SOURCEPATH} -B ${B}/native/ \ + -DCMAKE_TOOLCHAIN_FILE:FILEPATH=${WORKDIR}/toolchain-native.cmake \ + -DLIBCLC_TARGETS_TO_BUILD= + cmake --build ${B}/native --target prepare_builtins +} +do_build_prepare_builtins:class-native() { + : +} +addtask build_prepare_builtins after do_configure before do_compile + +FILES:${PN} += "${datadir}/clc" + +BBCLASSEXTEND = "native nativesdk"