commit:     dcd602a4a0830f42b943bdb5eec75948efc0cee7
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  9 17:23:26 2023 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 11 21:20:07 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dcd602a4

dev-qt/qt-creator: add 11.0.2

Not going to list every changes given this ebuild is from scratch.

There are a few ebuilds for this going around, but they about all
have (IMO) overcustomization, with a lot of USE to juggle for both
users and maintainers (some handled through sed'ing cmake files) --
all while plugins can still be disabled at runtime either way.

So this is now mostly limited to options that introduce an extra
dependency (e.g. clang). "Some" of the longest to build plugins
do have dependencies, so this still allows to cut down build time
a decent amount (not that this is a short build still).

Other small notes:
* Default IUSEs match what Qt Creator enables by default at runtime
 (albeit default USE=-tracing could be interesting for faster builds).
* Left gumbo unbundling out for now given ultimate goal is to unbundle
  litehtml instead (which itself uses gumbo), but currently it requires
  a large patch for 0.8 support (likewise to unbundle on qttools).

wrt bug #905166, delaying cleanup given restoring keywords is
non-trivial and users may need time to adjust for Qt5->Qt6, but
can be dropped anytime anyway if llvm:14 cleanup is happening
(do not consider this a blocker).

Bug: https://bugs.gentoo.org/905166
Closes: https://bugs.gentoo.org/835042
Closes: https://bugs.gentoo.org/905417
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 dev-qt/qt-creator/Manifest                         |   1 +
 .../files/qt-creator-11.0.2-musl-no-execinfo.patch |  47 ++++
 .../qt-creator-11.0.2-musl-no-malloc-trim.patch    |  10 +
 .../qt-creator/files/qt-creator-11.0.2-qt653.patch |  26 +++
 dev-qt/qt-creator/metadata.xml                     |   7 +-
 dev-qt/qt-creator/qt-creator-11.0.2.ebuild         | 260 +++++++++++++++++++++
 6 files changed, 349 insertions(+), 2 deletions(-)

diff --git a/dev-qt/qt-creator/Manifest b/dev-qt/qt-creator/Manifest
index 9fd838575706..748984c50c0c 100644
--- a/dev-qt/qt-creator/Manifest
+++ b/dev-qt/qt-creator/Manifest
@@ -1 +1,2 @@
+DIST qt-creator-opensource-src-11.0.2.tar.xz 49828532 BLAKE2B 
6028b71e1a7bf5ab953caa6223a2694e625449ab9e0eaa6e0dd8b34c0d64a9a5cea7b06d4aa98015d91defad04bc945db8528f87f5bddc70ba185ca32bb7ee8b
 SHA512 
db123274e0652982f33db60b8f81610f0787357cdc7318ea2bbe105343ff905462c38e29a68f864c48bda51fee6f17859074c172f77dd2379ecc2e7028f5fcd5
 DIST qt-creator-opensource-src-8.0.2.tar.xz 48874868 BLAKE2B 
53f491441ba28f9420c76cd4adfdcb7c7ef432d756fc5bf64a507c2cd1022b35700418a7b35b7119d97f9947b5dac2a8acc56b600c3e75001f80565f1619c072
 SHA512 
59ff62e6592fd33ff74aeab13dd33f3817ba132fb98f8a87ea818e1e52b4af0dc292e362085733665f0867d67ff867794755b2f02067897a9fb1c14023c6fb23

diff --git a/dev-qt/qt-creator/files/qt-creator-11.0.2-musl-no-execinfo.patch 
b/dev-qt/qt-creator/files/qt-creator-11.0.2-musl-no-execinfo.patch
new file mode 100644
index 000000000000..b36cfef2d4e7
--- /dev/null
+++ b/dev-qt/qt-creator/files/qt-creator-11.0.2-musl-no-execinfo.patch
@@ -0,0 +1,47 @@
+execinfo is unavailable with musl (unless opted to package+use libexecinfo)
+--- a/src/libs/utils/qtcassert.cpp
++++ b/src/libs/utils/qtcassert.cpp
+@@ -9,5 +9,5 @@
+ #include <QTime>
+ 
+-#if defined(Q_OS_UNIX)
++#if defined(Q_OS_UNIX) && defined(__GLIBC__)
+ #include <stdio.h>
+ #include <signal.h>
+@@ -30,5 +30,5 @@
+     if (maxdepth < 0 || maxdepth > ArraySize)
+         maxdepth = ArraySize;
+-#if defined(Q_OS_UNIX)
++#if defined(Q_OS_UNIX) && defined(__GLIBC__)
+     void *bt[ArraySize] = {nullptr};
+     int size = backtrace(bt, maxdepth);
+--- a/src/plugins/qmldesigner/designercore/exceptions/exception.cpp
++++ b/src/plugins/qmldesigner/designercore/exceptions/exception.cpp
+@@ -4,5 +4,5 @@
+ #include "exception.h"
+ 
+-#ifdef Q_OS_LINUX
++#if defined(Q_OS_LINUX) && defined(__GLIBC__)
+ #include <execinfo.h>
+ #include <cxxabi.h>
+@@ -31,5 +31,5 @@
+ namespace QmlDesigner {
+ 
+-#ifdef Q_OS_LINUX
++#if defined(Q_OS_LINUX) && defined(__GLIBC__)
+ const char* demangle(const char* name)
+ {
+@@ -76,5 +76,5 @@
+ }
+ 
+-#ifdef Q_OS_LINUX
++#if defined(Q_OS_LINUX) && defined(__GLIBC__)
+ static QString getBackTrace()
+ {
+@@ -114,5 +114,5 @@
+   , m_file(QString::fromUtf8(file))
+   , m_description(description)
+-  #ifdef Q_OS_LINUX
++  #if defined(Q_OS_LINUX) && defined(__GLIBC__)
+   , m_backTrace(getBackTrace())
+   #endif

diff --git 
a/dev-qt/qt-creator/files/qt-creator-11.0.2-musl-no-malloc-trim.patch 
b/dev-qt/qt-creator/files/qt-creator-11.0.2-musl-no-malloc-trim.patch
new file mode 100644
index 000000000000..d4936882d4d2
--- /dev/null
+++ b/dev-qt/qt-creator/files/qt-creator-11.0.2-musl-no-malloc-trim.patch
@@ -0,0 +1,10 @@
+malloc_trim() is unavailable with musl
+--- a/src/plugins/coreplugin/mainwindow.cpp
++++ b/src/plugins/coreplugin/mainwindow.cpp
+@@ -222,5 +222,5 @@
+         m_trimTimer.setInterval(60000);
+         // glibc may not actually free memory in free().
+-#ifdef Q_OS_LINUX
++#if defined(Q_OS_LINUX) && defined(__GLIBC__)
+         connect(&m_trimTimer, &QTimer::timeout, this, [] { malloc_trim(0); });
+ #endif

diff --git a/dev-qt/qt-creator/files/qt-creator-11.0.2-qt653.patch 
b/dev-qt/qt-creator/files/qt-creator-11.0.2-qt653.patch
new file mode 100644
index 000000000000..1ad23a207d9b
--- /dev/null
+++ b/dev-qt/qt-creator/files/qt-creator-11.0.2-qt653.patch
@@ -0,0 +1,26 @@
+Uses private parts of the QtQuick3D api which added a namespace in:
+https://github.com/qt/qtquick3d/commit/2b139225745a94ab4fa7e30f28cd0207469ee68e
+--- a/src/tools/qml2puppet/qml2puppet/editor3d/generalhelper.cpp
++++ b/src/tools/qml2puppet/qml2puppet/editor3d/generalhelper.cpp
+@@ -803,5 +803,9 @@
+     const QMatrix4x4 sceneTransform = parent->sceneTransform() * 
localTransform;
+ 
++#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 3))
++    return QSSGUtils::mat44::getPosition(sceneTransform);
++#else
+     return mat44::getPosition(sceneTransform);
++#endif
+ }
+ 
+--- a/src/tools/qml2puppet/qml2puppet/editor3d/mousearea3d.cpp
++++ b/src/tools/qml2puppet/qml2puppet/editor3d/mousearea3d.cpp
+@@ -738,5 +738,9 @@
+     const QMatrix4x4 sceneTransform = parent->sceneTransform() * 
localTransform;
+ 
++#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 3))
++    return QSSGUtils::mat44::getPosition(sceneTransform);
++#else
+     return mat44::getPosition(sceneTransform);
++#endif
+ }
+ 

diff --git a/dev-qt/qt-creator/metadata.xml b/dev-qt/qt-creator/metadata.xml
index dc11e329b879..8a364df28048 100644
--- a/dev-qt/qt-creator/metadata.xml
+++ b/dev-qt/qt-creator/metadata.xml
@@ -27,7 +27,7 @@
                <flag name="designer">Enable designer for QtWidgets-based 
UIs</flag>
                <flag name="docker">Build plugin for Docker support</flag>
                <flag name="glsl">Build the GLSL editor plugin</flag>
-               <flag name="help">Enable the integrated documentation 
viewer</flag>
+               <flag name="help">Enable the integrated 
<pkg>dev-qt/qt-docs</pkg> viewer (also needed for examples)</flag>
                <flag name="imageviewer">Build plugin to open and view image 
files</flag>
                <flag name="incredibuild">Enable integration with 
Incredibuild</flag>
                <flag name="lsp">Add support for the Language Server Protocol 
(LSP)</flag>
@@ -49,12 +49,15 @@
                <flag name="serialterminal">Build the serial terminal 
plugin</flag>
                <flag name="silversearcher">Enable integration with 
<pkg>sys-apps/the_silver_searcher</pkg></flag>
                <flag name="systemd">Add support for retrieving application 
output from journald</flag>
+               <flag name="qmldesigner">Build QmlDesigner and related plugins 
(Insight, StudioWelcome)</flag>
+               <flag name="tracing">Build plugins requiring tracing 
capabilities (CtfVisualizer, PerfProfiler, QmlProfiler)</flag>
                <flag name="valgrind">Enable integration with 
<pkg>dev-util/valgrind</pkg></flag>
                <flag name="webassembly">Build WebAssembly plugin</flag>
-               <flag name="webengine">Use <pkg>dev-qt/qtwebengine</pkg> to 
view documentation</flag>
+               <flag name="webengine">Use <pkg>dev-qt/qtwebengine</pkg> with 
the help USE rather than bundled litehtml</flag>
        </use>
        <upstream>
                <bugs-to>https://bugreports.qt.io/</bugs-to>
                <doc>https://doc.qt.io/qtcreator/</doc>
+               <remote-id type="github">qt-creator/qt-creator</remote-id>
        </upstream>
 </pkgmetadata>

diff --git a/dev-qt/qt-creator/qt-creator-11.0.2.ebuild 
b/dev-qt/qt-creator/qt-creator-11.0.2.ebuild
new file mode 100644
index 000000000000..2d43880f115f
--- /dev/null
+++ b/dev-qt/qt-creator/qt-creator-11.0.2.ebuild
@@ -0,0 +1,260 @@
+# Copyright 2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+inherit cmake flag-o-matic llvm python-any-r1 readme.gentoo-r1 xdg
+
+if [[ ${PV} == 9999 ]]; then
+       inherit git-r3
+       EGIT_REPO_URI=(
+               "https://code.qt.io/qt-creator/qt-creator.git";
+               "https://github.com/qt-creator/qt-creator.git";
+       )
+       EGIT_SUBMODULES=(
+               perfparser
+               src/libs/qlitehtml
+               src/libs/qlitehtml/src/3rdparty/litehtml
+       )
+else
+       QTC_PV=${PV/_/-}
+       QTC_P=${PN}-opensource-src-${QTC_PV}
+       [[ ${QTC_PV} == ${PV} ]] && QTC_REL=official || QTC_REL=development
+       SRC_URI="https://download.qt.io/${QTC_REL}_releases/qtcreator/$(ver_cut 
1-2)/${PV/_/-}/${QTC_P}.tar.xz"
+       S=${WORKDIR}/${QTC_P}
+       KEYWORDS="~amd64"
+fi
+
+DESCRIPTION="Lightweight IDE for C++/QML development centering around Qt"
+HOMEPAGE="https://www.qt.io/product/development-tools";
+
+LICENSE="GPL-3"
+SLOT="0"
+IUSE="
+       +clang +designer doc +help qmldesigner serialterminal
+       +svg test +tracing webengine
+"
+RESTRICT="!test? ( test )"
+
+# 17+ may be usable, but there are many fixes for 17 in next version
+LLVM_MAX_SLOT=16
+QT_PV=6.2.0:6 # IDE_QT_VERSION_MIN
+
+# := is used where Qt's private APIs are used for safety
+COMMON_DEPEND="
+       >=dev-qt/qt5compat-${QT_PV}
+       >=dev-qt/qtbase-${QT_PV}=[concurrent,gui,network,widgets,xml]
+       >=dev-qt/qtdeclarative-${QT_PV}=
+       clang? (
+               dev-cpp/yaml-cpp:=
+               <sys-devel/clang-$((LLVM_MAX_SLOT+1)):=
+       )
+       designer? ( >=dev-qt/qttools-${QT_PV}[designer] )
+       help? (
+               >=dev-qt/qttools-${QT_PV}[assistant]
+               webengine? ( >=dev-qt/qtwebengine-${QT_PV} )
+       )
+       qmldesigner? (
+               >=dev-qt/qtquick3d-${QT_PV}=
+               >=dev-qt/qtsvg-${QT_PV}
+       )
+       serialterminal? ( >=dev-qt/qtserialport-${QT_PV} )
+       svg? ( >=dev-qt/qtsvg-${QT_PV} )
+       tracing? (
+               app-arch/zstd:=
+               dev-libs/elfutils
+               >=dev-qt/qtshadertools-${QT_PV}
+       )
+"
+# qtimageformats for .webp in examples, semi-optfeature but useful in general
+RDEPEND="
+       ${COMMON_DEPEND}
+       help? ( >=dev-qt/qtimageformats-${QT_PV} )
+       qmldesigner? ( >=dev-qt/qtquicktimeline-${QT_PV} )
+"
+DEPEND="${COMMON_DEPEND}"
+BDEPEND="
+       ${PYTHON_DEPS}
+       >=dev-qt/qttools-${QT_PV}[linguist]
+       doc? ( >=dev-qt/qttools-${QT_PV}[qdoc] )
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-11.0.2-musl-no-execinfo.patch
+       "${FILESDIR}"/${PN}-11.0.2-musl-no-malloc-trim.patch
+       "${FILESDIR}"/${PN}-11.0.2-qt653.patch
+)
+
+pkg_setup() {
+       python-any-r1_pkg_setup
+       use clang && llvm_pkg_setup
+}
+
+src_prepare() {
+       cmake_src_prepare
+
+       # needed for finding docs at runtime in PF
+       sed -e "/_IDE_DOC_PATH/s/qtcreator/${PF}/" \
+               -i cmake/QtCreatorAPIInternal.cmake || die
+}
+
+src_configure() {
+       # -Werror=lto-type-mismatch issues, needs looking into
+       filter-lto
+
+       # temporary workaround for musl-1.2.4 (bug #903611), this ideally
+       # needs fixing in qtbase as *64 usage comes from its headers' macros
+       use elibc_musl && append-lfs-flags
+
+       local mycmakeargs=(
+               -DBUILD_WITH_PCH=no
+               -DWITH_DOCS=$(usex doc)
+               -DBUILD_DEVELOPER_DOCS=$(usex doc)
+               -DWITH_TESTS=$(usex test)
+
+               # TODO?: try to unbundle with =no when syntax-highlighting:6 
exists
+               -DBUILD_LIBRARY_KSYNTAXHIGHLIGHTING=yes
+
+               # Much can be optional, but do not want to flood users (or 
maintainers)
+               # with too many flags. Not to mention that many plugins are 
merely
+               # wrappers around still optional tools (e.g. cvs) and any 
unwanted
+               # plugins can be disabled at runtime. So optional flags are 
limited
+               # to plugins with additional build-time dependencies.
+               -DBUILD_LIBRARY_TRACING=$(usex tracing) # 
qml+perfprofiler,ctfvisual
+               -DBUILD_EXECUTABLE_PERFPARSER=$(usex tracing)
+
+               -DBUILD_PLUGIN_CLANGCODEMODEL=$(usex clang)
+               -DBUILD_PLUGIN_CLANGFORMAT=$(usex clang)
+               -DBUILD_PLUGIN_CLANGTOOLS=$(usex clang)
+               -DCLANGTOOLING_LINK_CLANG_DYLIB=yes
+
+               -DBUILD_PLUGIN_DESIGNER=$(usex designer)
+
+               -DBUILD_PLUGIN_HELP=$(usex help)
+               -DBUILD_HELPVIEWERBACKEND_QTWEBENGINE=$(usex webengine)
+               -DBUILD_LIBRARY_QLITEHTML=$(usex help $(usex !webengine))
+               # TODO?: package litehtml, but support for latest releases seem
+               # to lag behind and bundled may work out better for now
+               # https://bugreports.qt.io/browse/QTCREATORBUG-29169
+               $(use help && usev !webengine '
+                       -DCMAKE_DISABLE_FIND_PACKAGE_litehtml=yes
+                       -DEXTERNAL_XXD=no
+               ')
+
+               -DBUILD_PLUGIN_SERIALTERMINAL=$(usex serialterminal)
+
+               -DENABLE_SVG_SUPPORT=$(usex svg)
+
+               -DWITH_QMLDESIGNER=$(usex qmldesigner)
+
+               -Djournald=no # not really useful unless match qtbase (needs 
systemd)
+
+               # not packaged, but allow using if found
+               #-DCMAKE_DISABLE_FIND_PACKAGE_LibDDemangle=yes
+               #-DCMAKE_DISABLE_FIND_PACKAGE_LibRustcDemangle=yes
+       )
+
+       cmake_src_configure
+}
+
+src_test() {
+       local -x QT_QPA_PLATFORM=offscreen
+
+       local CMAKE_SKIP_TESTS=(
+               # unknown why these fails, but seems fixed in live
+               tst_tracing_timelineitemsrenderpass
+               tst_tracing_timelinenotesrenderpass
+               tst_tracing_timelineselectionrenderpass
+               # fails when built with clang, but also seems fixed in live
+               tst_process
+               # skipping same tests+label as upstream's CI by default
+               # `grep ctest .github/workflows/build_cmake.yml`
+               tst_perfdata
+       )
+
+       cmake_src_test --label-exclude exclude_from_precheck
+}
+
+src_compile() {
+       cmake_src_compile
+
+       use doc && cmake_build {qch,html}_docs
+}
+
+src_install() {
+       cmake_src_install
+
+       if use doc; then
+               dodoc -r "${BUILD_DIR}"/doc/html
+               dodoc "${BUILD_DIR}"/share/doc/${PF}/qtcreator{,-dev}.qch
+               docompress -x /usr/share/doc/${PF}/qtcreator{,-dev}.qch
+       fi
+
+       local DISABLE_AUTOFORMATTING=yes
+       local DOC_CONTENTS="\
+Some plugins (if used) may need optional extra dependencies/USE.
+
+This list provides associations with Gentoo's packages (if exists)
+ordered as in Qt Creator's Help -> About Plugins (not exhaustive).
+
+dev-qt/qt-docs:6 with USE=\"examples qch\" is notably recommended, or
+else the example tab will be empty alongside missing documentation.
+
+Build Systems:
+- CMakeProjectManager (dev-util/cmake)
+- MesonProjectManager (dev-util/meson)
+- QbsProjectManager (dev-util/qbs)
+
+C++:
+- Beautifier (dev-util/astyle and/or dev-util/uncrustify)
+- ClangCodeModel (USE=clang, dev-util/clazy to understand Qt semantics)
+- ClangFormat (USE=clang)
+
+Code Analyzer:
+- ClangTools (USE=clang)
+- Cppcheck (dev-util/cppcheck)
+- CtfVisualizer (USE=tracing)
+- PerfProfiler (USE=tracing)
+- Valgrind (dev-util/valgrind)
+
+Core:
+- Help (USE=help + dev-qt/qt-docs:6 with USE=\"examples qch\")
+
+Device Support:
+- Android (dev-util/android-sdk-update-manager)
+
+Other Languages:
+- Nim (dev-lang/nim)
+- Python (dev-lang/python)
+
+Qt Creator:
+- Designer (USE=designer)
+
+Qt Quick:
+- Insight (USE=qmldesigner)
+- QmlDesigner (USE=qmldesigner)
+- QmlProfiler (USE=tracing)
+
+Utilities:
+- Autotest (dev-cpp/catch, dev-cpp/gtest, or dev-libs/boost if used)
+- Conan (dev-util/conan)
+- Docker (app-containers/docker)
+- Haskell (dev-lang/ghc)
+- SerialTerminal (USE=serialterminal)
+- SilverSearcher (sys-apps/the_silver_searcher)
+- StudioWelcome (USE=qmldesigner)
+
+Version Control:
+- CVS (dev-vcs/cvs)
+- Fossil (dev-vcs/fossil)
+- Git (dev-vcs/git)
+- Mercurial (dev-vcs/mercurial)
+- Subversion (dev-vcs/subversion)"
+       readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+       xdg_pkg_postinst
+       readme.gentoo_print_elog
+}

Reply via email to