commit:     24dd58fe4592775fe430ee98d17ecb7825a02ade
Author:     Peter Levine <plevine457 <AT> gmail <DOT> com>
AuthorDate: Fri May  8 07:11:14 2020 +0000
Commit:     Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
CommitDate: Thu Jun 25 07:11:04 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=24dd58fe

dev-qt/qt-creator: Support clang-10

Builds and runs without issue using patch from
https://codereview.qt-project.org/c/qt-creator/qt-creator/+/299377

Closes: https://bugs.gentoo.org/720240
Closes: https://bugs.gentoo.org/711788
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Peter Levine <plevine457 <AT> gmail.com>
Signed-off-by: Jason A. Donenfeld <zx2c4 <AT> gentoo.org>

 .../files/qt-creator-4.12.0-dylib-fix.patch        | 84 ++++++++++++++++++++++
 dev-qt/qt-creator/qt-creator-9999.ebuild           | 13 +++-
 2 files changed, 95 insertions(+), 2 deletions(-)

diff --git a/dev-qt/qt-creator/files/qt-creator-4.12.0-dylib-fix.patch 
b/dev-qt/qt-creator/files/qt-creator-4.12.0-dylib-fix.patch
new file mode 100644
index 00000000000..0d4deb2c795
--- /dev/null
+++ b/dev-qt/qt-creator/files/qt-creator-4.12.0-dylib-fix.patch
@@ -0,0 +1,84 @@
+From 1c5faa6dcf16135ee31252d13766d01536a69405 Mon Sep 17 00:00:00 2001
+From: Peter Levine <[email protected]>
+Date: Tue, 5 May 2020 03:45:35 -0400
+Subject: [PATCH] Fix building against clang configured with
+ CLANG_LINK_CLANG_DYLIB
+
+LLVM/Clang upstream only officially supports building shared
+components as a single dynamic library (via
+LLVM_BUILD_LLVM_DYLIB=ON, CLANG_LINK_CLANG_DYLIB=ON, etc..).
+Linux distros like Fedora and Gentoo have followed suit.
+
+Unfortunately, QT-Creator's src/shared/clang/clang_installation.pri
+file assumes clang is built with separate component libraries
+and the build fails.
+
+This change alters the build to check for the existence
+of clang component libraries and, if found, link to them, or
+otherwise to libclang-cpp.
+
+Task-number: QTCREATORBUG-23172
+Change-Id: I17df5822d7aeb471227f21f2cf4a71871d6f9b86
+---
+ src/shared/clang/clang_installation.pri | 35 +++++++++++++++----------
+ 1 file changed, 21 insertions(+), 14 deletions(-)
+
+diff --git a/src/shared/clang/clang_installation.pri 
b/src/shared/clang/clang_installation.pri
+index 08838838bca..c191c57f1c7 100644
+--- a/src/shared/clang/clang_installation.pri
++++ b/src/shared/clang/clang_installation.pri
+@@ -204,19 +204,6 @@ isEmpty(LLVM_VERSION) {
+         }
+     }
+ 
+-    
isEmpty(QTC_CLANG_BUILDMODE_MISMATCH)|!equals(QTC_CLANG_BUILDMODE_MISMATCH, 1) {
+-        CLANGFORMAT_MAIN_HEADER = $$LLVM_INCLUDEPATH/clang/Format/Format.h
+-        exists($$CLANGFORMAT_MAIN_HEADER) {
+-            CLANGFORMAT_LIBS=-lclangFormat -lclangToolingInclusions 
-lclangToolingCore -lclangRewrite -lclangLex -lclangBasic
+-            ALL_CLANG_LIBS=-lclangFormat -lclangToolingInclusions 
-lclangTooling -lclangToolingCore \
+-                           -lclangRewrite -lclangIndex -lclangFrontend 
-lclangParse -lclangSerialization \
+-                           -lclangSema -lclangEdit -lclangAnalysis 
-lclangDriver -lclangDynamicASTMatchers \
+-                           -lclangASTMatchers -lclangAST -lclangLex 
-lclangBasic
+-            win32:CLANGFORMAT_LIBS += -lversion
+-        }
+-    }
+-    win32:ALL_CLANG_LIBS += -lversion
+-
+     LIBCLANG_MAIN_HEADER = $$LLVM_INCLUDEPATH/clang-c/Index.h
+     !exists($$LIBCLANG_MAIN_HEADER) {
+         $$llvmWarningOrError(\
+@@ -237,10 +224,30 @@ isEmpty(LLVM_VERSION) {
+     LIBCLANG_LIBS += $${CLANG_LIB}
+ 
+     
isEmpty(QTC_CLANG_BUILDMODE_MISMATCH)|!equals(QTC_CLANG_BUILDMODE_MISMATCH, 1) {
++        CLANGFORMAT_MAIN_HEADER = $$LLVM_INCLUDEPATH/clang/Format/Format.h
++        exists($$CLANGFORMAT_MAIN_HEADER) {
++            
exists($${LLVM_LIBDIR}/libclangFormat.so*)|exists($${LLVM_LIBDIR}/libclangFormat.dylib)
 {
++                CLANGFORMAT_LIBS=-lclangFormat -lclangToolingInclusions 
-lclangToolingCore -lclangRewrite -lclangLex -lclangBasic
++                ALL_CLANG_LIBS=-lclangFormat -lclangToolingInclusions 
-lclangTooling -lclangToolingCore \
++                           -lclangRewrite -lclangIndex -lclangFrontend 
-lclangParse -lclangSerialization \
++                           -lclangSema -lclangEdit -lclangAnalysis 
-lclangDriver -lclangDynamicASTMatchers \
++                           -lclangASTMatchers -lclangAST -lclangLex 
-lclangBasic
++                win32:CLANGFORMAT_LIBS += -lversion
++                win32:ALL_CLANG_LIBS += -lversion
++            } else {
++                CLANGFORMAT_LIBS=-lclang-cpp
++                ALL_CLANG_LIBS=-lclang-cpp
++            }
++        }
++
+         QTC_DISABLE_CLANG_REFACTORING=$$(QTC_DISABLE_CLANG_REFACTORING)
+         isEmpty(QTC_DISABLE_CLANG_REFACTORING) {
+             !contains(QMAKE_DEFAULT_LIBDIRS, $$LLVM_LIBDIR): LIBTOOLING_LIBS 
= -L$${LLVM_LIBDIR}
+-            LIBTOOLING_LIBS += $$CLANGTOOLING_LIBS $$LLVM_STATIC_LIBS
++            
exists($${LLVM_LIBDIR}/libclangTooling.so*)|exists($${LLVM_LIBDIR}/libclangTooling.dylib)
 {
++                LIBTOOLING_LIBS += $$CLANGTOOLING_LIBS $$LLVM_STATIC_LIBS
++            } else {
++                LIBTOOLING_LIBS += -lclang-cpp $$LLVM_STATIC_LIBS
++            }
+         }
+     }
+ 
+-- 
+2.26.2
+

diff --git a/dev-qt/qt-creator/qt-creator-9999.ebuild 
b/dev-qt/qt-creator/qt-creator-9999.ebuild
index bf48a061bde..01f6e2d47c2 100644
--- a/dev-qt/qt-creator/qt-creator-9999.ebuild
+++ b/dev-qt/qt-creator/qt-creator-9999.ebuild
@@ -2,7 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
-LLVM_MAX_SLOT=8
+LLVM_MAX_SLOT=10
 PLOCALES="cs da de fr ja pl ru sl uk zh-CN zh-TW"
 
 inherit llvm qmake-utils virtualx xdg
@@ -64,7 +64,14 @@ CDEPEND="
        >=dev-qt/qtwidgets-${QT_PV}
        >=dev-qt/qtx11extras-${QT_PV}
        >=dev-qt/qtxml-${QT_PV}
-       clang? ( sys-devel/clang:8= )
+       clang? (
+               || (
+                       sys-devel/clang:10
+                       sys-devel/clang:9
+                       sys-devel/clang:8
+               )
+               <sys-devel/clang-$((LLVM_MAX_SLOT + 1)):=
+       )
        designer? ( >=dev-qt/designer-${QT_PV} )
        help? (
                >=dev-qt/qthelp-${QT_PV}
@@ -101,6 +108,8 @@ for x in ${PLOCALES}; do
 done
 unset x
 
+PATCHES=( "${FILESDIR}"/${PN}-4.12.0-dylib-fix.patch )
+
 pkg_setup() {
        use clang && llvm_pkg_setup
 }

Reply via email to