commit:     51211f99f14f80bc92049cbbf1717a39c50887b2
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 26 22:55:54 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Mar 26 22:56:52 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=51211f99

dev-util/kdevelop: fix build with Clang 16, use llvm.eclass

Closes: https://bugs.gentoo.org/902101
Thanks-to: Michael Uleysky <uleysky <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../kdevelop/files/kdevelop-22.12.3-clang16.patch  | 24 ++++++++++++++++++++++
 ...p-22.12.3.ebuild => kdevelop-22.12.3-r1.ebuild} | 18 ++++++++++------
 2 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/dev-util/kdevelop/files/kdevelop-22.12.3-clang16.patch 
b/dev-util/kdevelop/files/kdevelop-22.12.3-clang16.patch
new file mode 100644
index 000000000000..38676cc16473
--- /dev/null
+++ b/dev-util/kdevelop/files/kdevelop-22.12.3-clang16.patch
@@ -0,0 +1,24 @@
+https://bugs.gentoo.org/902101
+--- a/cmake/modules/FindClang.cmake
++++ b/cmake/modules/FindClang.cmake
+@@ -97,6 +97,8 @@
+   # dito for git
+   string(REPLACE "git" "" CLANG_VERSION_CLEAN "${CLANG_VERSION}")
+ 
++  string(REGEX REPLACE "([.]0)+$" "" CLANG_VERSION_STRIPPED 
"${CLANG_VERSION}")
++  string(REGEX REPLACE "([.]0)+$" "" CLANG_VERSION_CLEAN_STRIPPED 
"${CLANG_VERSION_CLEAN}")
+   find_path(CLANG_BUILTIN_DIR
+             # cpuid.h because it is defined in ClangSupport constructor as 
valid clang builtin dir indicator
+             NAMES "cpuid.h"
+@@ -106,6 +108,10 @@
+                           "../../../clang/${CLANG_VERSION}/include"
+                           "clang/${CLANG_VERSION_CLEAN}/include"
+                           "../../../clang/${CLANG_VERSION_CLEAN}/include"
++                          "clang/${CLANG_VERSION_STRIPPED}/include"
++                          "../../../clang/${CLANG_VERSION_STRIPPED}/include"
++                          "clang/${CLANG_VERSION_CLEAN_STRIPPED}/include"
++                          
"../../../clang/${CLANG_VERSION_CLEAN_STRIPPED}/include"
+             NO_DEFAULT_PATH
+   )
+ 
+

diff --git a/dev-util/kdevelop/kdevelop-22.12.3.ebuild 
b/dev-util/kdevelop/kdevelop-22.12.3-r1.ebuild
similarity index 93%
rename from dev-util/kdevelop/kdevelop-22.12.3.ebuild
rename to dev-util/kdevelop/kdevelop-22.12.3-r1.ebuild
index cb912cc23d10..6788033f46fe 100644
--- a/dev-util/kdevelop/kdevelop-22.12.3.ebuild
+++ b/dev-util/kdevelop/kdevelop-22.12.3-r1.ebuild
@@ -7,10 +7,11 @@ ECM_HANDBOOK="forceoptional"
 ECM_TEST="true"
 KDE_ORG_CATEGORY="kdevelop"
 KFMIN=5.101.0
+LLVM_MAX_SLOT=16
 QTMIN=5.15.5
 VIRTUALDBUS_TEST="true"
 VIRTUALX_REQUIRED="test"
-inherit ecm gear.kde.org optfeature
+inherit ecm gear.kde.org llvm optfeature
 
 DESCRIPTION="Integrated Development Environment, supporting KF5/Qt, C/C++ and 
much more"
 HOMEPAGE="https://www.kdevelop.org/";
@@ -65,7 +66,7 @@ COMMON_DEPEND="
        >=kde-frameworks/kxmlgui-${KFMIN}:5
        >=kde-frameworks/sonnet-${KFMIN}:5
        >=kde-frameworks/threadweaver-${KFMIN}:5
-       >=sys-devel/clang-6.0:=
+       <sys-devel/clang-$((${LLVM_MAX_SLOT} + 1)):=
        gdbui? ( kde-plasma/libksysguard:5= )
        hex? ( app-editors/okteta:5 )
        plasma? (
@@ -95,12 +96,17 @@ RDEPEND="${COMMON_DEPEND}
        reviewboard? ( kde-apps/ktp-accounts-kcm:5 )
 "
 
-src_configure() {
-       local clang_version=$(best_version sys-devel/clang)
-       local llvm_root="/usr/lib/llvm/$(ver_cut 1 
${clang_version##sys-devel/clang-})"
+PATCHES=(
+       "${FILESDIR}"/${PN}-22.12.3-clang16.patch
+)
+
+llvm_check_deps() {
+       has_version -d "sys-devel/clang:${LLVM_SLOT}"
+}
 
+src_configure() {
        local mycmakeargs=(
-               -DLLVM_ROOT=${llvm_root}
+               -DLLVM_ROOT="$(get_llvm_prefix ${LLVM_SLOT})"
                $(cmake_use_find_package gdbui KSysGuard)
                -DBUILD_executeplasmoid=$(usex plasma)
                $(cmake_use_find_package plasma KF5Plasma)

Reply via email to