--- /dev/null
+# Copyright © 2012-2014, 2018 Nick Bowler
+# License GPLv3+: GNU General Public License version 3 or later.
+# There is NO WARRANTY, to the extent permitted by law.
+
+EAPI=6
+
+inherit qmake-utils
+
+MY_P=${P/qcachegrind/kcachegrind}
+
+DESCRIPTION="Qt-based GUI frontend for Callgrind"
+HOMEPAGE="https://kcachegrind.github.io/"
+SRC_URI="https://kcachegrind.github.io/files/$MY_P.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="dbus +qt5"
+
+DEPEND="qt5? (
+ dev-qt/qtgui:5
+ dbus? ( dev-qt/qtdbus:5 )
+ )
+ !qt5? (
+ >=dev-qt/qtgui-4.4:4
+ dbus? ( >=dev-qt/qtdbus-4.4:4 )
+ )"
+RDEPEND="$DEPEND
+ media-gfx/graphviz"
+
+S=$WORKDIR/$MY_P
+
+PATCHES=(
+ "$FILESDIR/$P-qt5-fix.patch"
+)
+
+pkg_setup() {
+ use dbus || PATCHES+=("$FILESDIR/$PN-disable-dbus.patch")
+}
+
+src_configure() {
+ eqmake$(usex qt5 5 4) qcg.pro
+}
+
+src_install() {
+ dobin qcachegrind/qcachegrind
+ dobin cgview/cgview
+
+ newicon -s 48 kcachegrind/hi48-app-kcachegrind.png kcachegrind.png
+ newicon -s 32 kcachegrind/hi32-app-kcachegrind.png kcachegrind.png
+
+ insinto /usr/share/applications
+ doins qcachegrind/qcachegrind.desktop
+}