Skip to content

Commit

Permalink
contrib/heaptrack: new package (1.5.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
nekopsykose committed Jun 29, 2024
1 parent 6d0bf1e commit a49fda5
Show file tree
Hide file tree
Showing 5 changed files with 218 additions and 0 deletions.
19 changes: 19 additions & 0 deletions contrib/heaptrack/patches/ambiguous.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/builddir/heaptrack-1.5.0/src/analyze/gui/gui.cpp:26:6: error: 'maybe_unused' attribute cannot be applied to types
26 | void Q_DECL_UNUSED initRCCIconTheme()
| ^
/usr/include/qt6/QtCore/qcompilerdetection.h:984:27: note: expanded from macro 'Q_DECL_UNUSED'
984 | # define Q_DECL_UNUSED [[maybe_unused]]
| ^
1 error generated.
--
--- a/src/analyze/gui/gui.cpp
+++ b/src/analyze/gui/gui.cpp
@@ -23,7 +23,7 @@
#include <QResource>

// FIXME: patch KIconTheme so that this isn't needed here
-void Q_DECL_UNUSED initRCCIconTheme()
+void initRCCIconTheme()
{
const QString iconThemeRcc = qApp->applicationDirPath() + QStringLiteral("/../share/icons/breeze/breeze-icons.rcc");
if (!QFile::exists(iconThemeRcc)) {
67 changes: 67 additions & 0 deletions contrib/heaptrack/patches/kdiagram.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
Patch-Source: https://invent.kde.org/sdk/heaptrack/-/commit/2de688e02fbc5ff96fcf29ad3af962e8035824eb
--
From 2de688e02fbc5ff96fcf29ad3af962e8035824eb Mon Sep 17 00:00:00 2001
From: Alessandro Astone <ales.astone@gmail.com>
Date: Wed, 27 Dec 2023 19:21:06 +0100
Subject: [PATCH] Support KChart6 for KF6

---
src/analyze/CMakeLists.txt | 14 ++++++++++++--
src/analyze/gui/CMakeLists.txt | 2 +-
2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/analyze/CMakeLists.txt b/src/analyze/CMakeLists.txt
index e57d242e..e71aee9f 100644
--- a/src/analyze/CMakeLists.txt
+++ b/src/analyze/CMakeLists.txt
@@ -34,6 +34,12 @@ endif()
add_subdirectory(print)

if(HEAPTRACK_BUILD_GUI)
+ if(QT_VERSION_MAJOR EQUAL 6)
+ set(KChartName KChart6)
+ else()
+ set(KChartName KChart)
+ endif()
+
find_package(Qt${QT_VERSION_MAJOR} ${QT_MIN_VERSION} ${REQUIRED_IN_APPIMAGE} NO_MODULE OPTIONAL_COMPONENTS Widgets)
set_package_properties(Qt${QT_VERSION_MAJOR} PROPERTIES TYPE RECOMMENDED PURPOSE "Required for the heaptrack_gui executable.")
find_package(ECM 1.0.0 ${REQUIRED_IN_APPIMAGE} NO_MODULE)
@@ -41,8 +47,8 @@ if(HEAPTRACK_BUILD_GUI)
if(Qt${QT_VERSION_MAJOR}_FOUND AND ECM_FOUND)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
find_package(KF${QT_VERSION_MAJOR} ${REQUIRED_IN_APPIMAGE} COMPONENTS CoreAddons I18n ItemModels ThreadWeaver ConfigWidgets KIO IconThemes)
- find_package(KChart ${REQUIRED_IN_APPIMAGE} "2.6.0")
- set_package_properties(KChart PROPERTIES TYPE RECOMMENDED PURPOSE "Required for the heaptrack_gui executable. Get it from the kdiagram module.")
+ find_package(${KChartName} ${REQUIRED_IN_APPIMAGE} "2.6.0")
+ set_package_properties(${KChartName} PROPERTIES TYPE RECOMMENDED PURPOSE "Required for the heaptrack_gui executable. Get it from the kdiagram module.")
if(KF${QT_VERSION_MAJOR}I18n_FOUND)
ki18n_install(../../po)
endif()
@@ -51,6 +57,10 @@ if(HEAPTRACK_BUILD_GUI)
endif()
endif()

+if(KChart6_FOUND)
+ set(KChart_FOUND TRUE)
+endif()
+
if (KF${QT_VERSION_MAJOR}_FOUND)
add_subdirectory(gui)
endif()
diff --git a/src/analyze/gui/CMakeLists.txt b/src/analyze/gui/CMakeLists.txt
index f5803b67..2124683d 100644
--- a/src/analyze/gui/CMakeLists.txt
+++ b/src/analyze/gui/CMakeLists.txt
@@ -92,7 +92,7 @@ if (KChart_FOUND)
histogrammodel.cpp
)
list(APPEND LIBRARIES
- KChart
+ ${KChartName}
Qt${QT_VERSION_MAJOR}::Svg
)
endif()
--
GitLab

75 changes: 75 additions & 0 deletions contrib/heaptrack/patches/qt6.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
Patch-Source: https://invent.kde.org/sdk/heaptrack/-/commit/38fd1d7b0ff53a35ed7c4ef241c21c8c06e1efb2
--
From 38fd1d7b0ff53a35ed7c4ef241c21c8c06e1efb2 Mon Sep 17 00:00:00 2001
From: Nicolas Fella <nicolas.fella@gmx.de>
Date: Tue, 2 Jan 2024 15:47:29 +0100
Subject: [PATCH] Use QString for KConfigGroup names

Required in KF6
---
src/analyze/gui/mainwindow.cpp | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/analyze/gui/mainwindow.cpp b/src/analyze/gui/mainwindow.cpp
index 1ebd4c9c..c3be2fa7 100644
--- a/src/analyze/gui/mainwindow.cpp
+++ b/src/analyze/gui/mainwindow.cpp
@@ -57,8 +57,8 @@ const int MAINWINDOW_VERSION = 1;

namespace Config {
namespace Groups {
-const char MainWindow[] = "MainWindow";
-const char CodeNavigation[] = "CodeNavigation";
+const QString MainWindow() { return QStringLiteral("MainWindow"); }
+const QString CodeNavigation() { return QStringLiteral("CodeNavigation"); }
}
namespace Entries {
const char State[] = "State";
@@ -317,7 +317,7 @@ MainWindow::MainWindow(QWidget* parent)
{
m_ui->setupUi(this);

- auto group = m_config->group(Config::Groups::MainWindow);
+ auto group = m_config->group(Config::Groups::MainWindow());
auto state = group.readEntry(Config::Entries::State, QByteArray());
restoreState(state, MAINWINDOW_VERSION);

@@ -671,7 +671,7 @@ MainWindow::MainWindow(QWidget* parent)
MainWindow::~MainWindow()
{
auto state = saveState(MAINWINDOW_VERSION);
- auto group = m_config->group(Config::Groups::MainWindow);
+ auto group = m_config->group(Config::Groups::MainWindow());
group.writeEntry(Config::Entries::State, state);
}

@@ -788,7 +788,7 @@ void MainWindow::setupCodeNavigationMenu()
auto group = new QActionGroup(this);
group->setExclusive(true);

- const auto settings = m_config->group(Config::Groups::CodeNavigation);
+ const auto settings = m_config->group(Config::Groups::CodeNavigation());
const auto currentIdx = settings.readEntry(Config::Entries::IDE, firstAvailableIde());

for (int i = 0; i < LAST_IDE; ++i) {
@@ -838,7 +838,7 @@ void MainWindow::setupCodeNavigationMenu()

void MainWindow::setCodeNavigationIDE(QAction* action)
{
- auto settings = m_config->group(Config::Groups::CodeNavigation);
+ auto settings = m_config->group(Config::Groups::CodeNavigation());

if (action->data() == -1) {
const auto customCmd =
@@ -859,7 +859,7 @@ void MainWindow::setCodeNavigationIDE(QAction* action)

void MainWindow::navigateToCode(const QString& filePath, int lineNumber, int columnNumber)
{
- const auto settings = m_config->group(Config::Groups::CodeNavigation);
+ const auto settings = m_config->group(Config::Groups::CodeNavigation());
const auto ideIdx = settings.readEntry(Config::Entries::IDE, firstAvailableIde());

QString command;
--
GitLab

16 changes: 16 additions & 0 deletions contrib/heaptrack/patches/unw-nongnu.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--- a/cmake/FindLibunwind.cmake
+++ b/cmake/FindLibunwind.cmake
@@ -22,13 +22,10 @@
# SPDX-License-Identifier: BSD-3-Clause


-find_path(LIBUNWIND_INCLUDE_DIR libunwind.h )
if(NOT EXISTS "${LIBUNWIND_INCLUDE_DIR}/unwind.h")
MESSAGE("Found libunwind.h but corresponding unwind.h is absent!")
SET(LIBUNWIND_INCLUDE_DIR "")
endif()
-
-find_library(LIBUNWIND_LIBRARY unwind)

if(LIBUNWIND_INCLUDE_DIR AND EXISTS "${LIBUNWIND_INCLUDE_DIR}/libunwind-common.h")
file(STRINGS "${LIBUNWIND_INCLUDE_DIR}/libunwind-common.h" LIBUNWIND_HEADER_CONTENTS REGEX "#define UNW_VERSION_[A-Z]+\t[0-9]*")
41 changes: 41 additions & 0 deletions contrib/heaptrack/template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
pkgname = "heaptrack"
pkgver = "1.5.0"
pkgrel = 0
build_style = "cmake"
configure_args = [
"-DHEAPTRACK_USE_QT6=ON",
"-DLIBUNWIND_INCLUDE_DIR=/usr/include/libunwind-nongnu",
"-DLIBUNWIND_LIBRARY=unwind-nongnu",
]
hostmakedepends = [
"cmake",
"extra-cmake-modules",
"gettext",
"ninja",
"pkgconf",
]
makedepends = [
"boost-devel",
"elfutils-devel",
"kconfigwidgets-devel",
"kcoreaddons-devel",
"kdiagram-devel",
"ki18n-devel",
"kiconthemes-devel",
"kio-devel",
"kitemmodels-devel",
"libunwind-nongnu-devel",
"linux-headers",
"qt6-qtbase-devel",
"threadweaver-devel",
"zlib-ng-compat-devel",
"zstd-devel",
]
pkgdesc = "KDE heap memory profiler"
maintainer = "psykose <alice@ayaya.dev>"
license = "GPL-2.0-or-later"
url = "https://apps.kde.org/heaptrack"
source = f"$(KDE_SITE)/heaptrack/{pkgver}/heaptrack-{pkgver}.tar.xz"
sha256 = "a278d9d8f91e8bfb8a1c2f5b73eecab47fd45d0693f5dbea637536413cec2ea5"
# FIXME: weird failures
options = ["!check"]

0 comments on commit a49fda5

Please sign in to comment.