summaryrefslogtreecommitdiff
blob: 612279679a181badb15091d3ac2e04ac2b62b24a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit cmake-utils flag-o-matic virtualx

DESCRIPTION="Personal finance manager by KDE"
HOMEPAGE="https://kmymoney.org/"
SRC_URI="mirror://kde/stable/${PN}/${PV}/src/${P}.tar.xz"

LICENSE="GPL-2"
SLOT="4"
KEYWORDS="~amd64 ~x86"
IUSE="calendar debug doc +handbook hbci ofx quotes test weboob"

COMMON_DEPEND="
	>=app-crypt/gpgme-1.7.0[cxx]
	<app-office/libalkimia-6.0.0
	dev-libs/gmp:0=
	dev-libs/libgpg-error
	dev-qt/qtcore:4[ssl]
	dev-qt/qtdbus:4
	dev-qt/qtgui:4
	dev-qt/qtsql:4
	dev-qt/qtsvg:4
	kde-frameworks/kdelibs:4
	x11-misc/shared-mime-info
	calendar? ( dev-libs/libical:= )
	hbci? (
		>=net-libs/aqbanking-5.5.1
		>=sys-libs/gwenhywfar-4.15.3[qt4]
	)
	ofx? ( >=dev-libs/libofx-0.9.4 )
	weboob? ( www-client/weboob )
"
RDEPEND="${COMMON_DEPEND}
	kde-frameworks/oxygen-icons:*
	handbook? ( kde-frameworks/kdelibs:4[handbook] )
	quotes? ( dev-perl/Finance-Quote )
"
DEPEND="${COMMON_DEPEND}
	dev-libs/boost
	virtual/pkgconfig
	doc? ( app-doc/doxygen )
	handbook? (
		app-text/docbook-xml-dtd:4.2
		app-text/docbook-xsl-stylesheets
	)
	test? ( dev-qt/qttest:4 )
"

src_prepare() {
	cmake-utils_src_prepare

	if [[ -v LINGUAS ]] ; then
		pushd po > /dev/null || die
		local lang
		for lang in *; do
			if [[ -e ${lang} ]] && ! has ${lang/.po/} ${LINGUAS} ; then
				case ${lang} in
					CMakeLists.txt) ;;
					*) rm -r ${lang} || die ;;
				esac
				cmake_comment_add_subdirectory ${lang}
				sed -e "/add_subdirectory([[:space:]]*${lang}\/.*[[:space:]]*)/d" \
					-i CMakeLists.txt || die
			fi
		done
		popd > /dev/null || die
	fi

	if ! use handbook; then
		cmake_comment_add_subdirectory doc
	else
		if [[ -d doc && -v LINGUAS ]] ; then
			pushd doc > /dev/null || die
			local lang
			for lang in *; do
				if ! has ${lang} ${LINGUAS} && [[ ${lang} != "en_US" ]]; then
					cmake_comment_add_subdirectory ${lang}
				fi
			done
			popd > /dev/null || die
		fi
	fi

	# don't install as executable
	sed -i kmymoney/CMakeLists.txt \
		-e "/install.*kmymoney.appdata/ s/PROGRAMS/FILES/" || die
}

src_configure() {
	use debug || append-cppflags -DQT_NO_DEBUG

	local mycmakeargs=(
		-DUSE_QT_DESIGNER=OFF
		-DENABLE_LIBICAL=$(usex calendar)
		-DUSE_DEVELOPER_DOC=$(usex doc)
		-DENABLE_KBANKING=$(usex hbci)
		-DENABLE_LIBOFX=$(usex ofx)
		-DCMAKE_DISABLE_FIND_PACKAGE_KdepimLibs=ON
		-DKDE4_BUILD_TESTS=$(usex test)
		-DENABLE_WEBOOB=$(usex weboob)
	)
	cmake-utils_src_configure
}

src_compile() {
	cmake-utils_src_compile
	use doc && cmake-utils_src_compile apidoc
}

src_test() {
	local kded4_pid

	_test_runner() {
		export $(dbus-launch)
		kded4 2>&1 > /dev/null &
		kded4_pid=$!

		cmake-utils_src_test
	}

	unset DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID

	local myctestargs=( -E "(kmymoney-querytabletest)" ) # requires ktimezoned
	virtx _test_runner

	if [[ -n "${kded4_pid}" ]] ; then
		kill ${kded4_pid}
	fi

	if [[ -n "${DBUS_SESSION_BUS_PID}" ]] ; then
		kill ${DBUS_SESSION_BUS_PID}
	fi
}

src_install() {
	use doc && HTML_DOCS=( "${BUILD_DIR}/apidocs/html/." )
	cmake-utils_src_install

	# We don't want /usr/share/doc/HTML to be compressed,
	# because then khelpcenter can't find the docs
	[[ -d ${ED%/}/usr/share/doc/HTML ]] &&
		docompress -x /usr/share/doc/HTML
}