app-office/gnucash: Fix MissingTestRestrict
[gentoo.git] / app-office / gnucash / gnucash-3.5.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 # google{test,mock} version
7 GV="1.8.0"
8 PYTHON_COMPAT=( python3_{5,6} )
9
10 inherit cmake-utils flag-o-matic gnome2-utils python-single-r1 xdg-utils
11
12 DESCRIPTION="A personal finance manager"
13 HOMEPAGE="http://www.gnucash.org/"
14 SRC_URI="https://github.com/Gnucash/${PN}/releases/download/${PV}/${P}.tar.bz2
15         https://github.com/google/googletest/archive/release-${GV}.tar.gz -> gtest-${GV}.tar.gz"
16
17 SLOT="0"
18 LICENSE="GPL-2"
19 KEYWORDS="amd64 ~ppc ~ppc64 x86"
20
21 IUSE="aqbanking chipcard debug doc examples gnome-keyring +gui mysql nls ofx
22           postgres python quotes -register2 sqlite"
23
24 REQUIRED_USE="
25         chipcard? ( aqbanking )
26         python? ( ${PYTHON_REQUIRED_USE} )"
27
28 # libdbi version requirement for sqlite taken from bug #455134
29 #
30 # dev-libs/boost must always be built with nls enabled.
31 # guile[deprecated] because of SCM_LIST*() use
32 RDEPEND="
33         >=dev-libs/glib-2.46.0:2
34         >=dev-libs/libxml2-2.7.0:2
35         >=sys-libs/zlib-1.1.4
36         >=dev-scheme/guile-2.2.0:12=[deprecated,regex]
37         dev-libs/boost:=[icu,nls]
38         dev-libs/icu:=
39         dev-libs/libxslt
40         aqbanking? (
41                 >=net-libs/aqbanking-5[gtk,ofx?]
42                 sys-libs/gwenhywfar[gtk]
43                 chipcard? ( sys-libs/libchipcard )
44         )
45         gnome-keyring? ( >=app-crypt/libsecret-0.18 )
46         gui? (
47                 gnome-base/dconf
48                 net-libs/webkit-gtk:4=
49                 >=x11-libs/gtk+-3.14.0:3
50         )
51         mysql? (
52                 dev-db/libdbi
53                 dev-db/libdbi-drivers[mysql]
54         )
55         ofx? ( >=dev-libs/libofx-0.9.1 )
56         postgres? (
57                 dev-db/libdbi
58                 dev-db/libdbi-drivers[postgres]
59         )
60         python? ( ${PYTHON_DEPS} )
61         quotes? (
62                 >=dev-perl/Finance-Quote-1.11
63                 dev-perl/Date-Manip
64                 dev-perl/HTML-TableExtract
65         )
66         sqlite? (
67                 >=dev-db/libdbi-0.9.0
68                 >=dev-db/libdbi-drivers-0.9.0[sqlite]
69         )
70 "
71
72 DEPEND="${RDEPEND}
73         ~dev-cpp/gtest-${GV}
74         >=sys-devel/gettext-0.19.6
75         dev-lang/perl
76         dev-perl/XML-Parser
77         sys-devel/libtool
78         virtual/pkgconfig
79 "
80
81 PDEPEND="doc? (
82         ~app-doc/gnucash-docs-${PV}
83         gnome-extra/yelp
84 )"
85
86 PATCHES=( "${FILESDIR}"/${PN}-3.2-no-gui.patch )
87
88 pkg_setup() {
89         use python && python-single-r1_pkg_setup
90         xdg_environment_reset
91 }
92
93 src_unpack() {
94         default
95         cp "${FILESDIR}"/gnucash-3.4-test-stress-options.scm \
96            ${PN}-${PV}/${PN}/report/standard-reports/test/test-stress-options.scm \
97                 || die "Failed copying scm"
98 }
99
100 src_configure() {
101         local sql_on_off="OFF"
102         if use mysql || use postgres || use sqlite ; then
103                 sql_on_off="ON"
104         fi
105
106         local mycmakeargs=(
107                 -DGMOCK_ROOT="${WORKDIR}"/googletest-release-${GV}/googlemock
108                 -DGTEST_ROOT="${WORKDIR}"/googletest-release-${GV}/googletest
109                 # Disable fallback to guile-2.0
110                 -DCMAKE_DISABLE_FIND_PACKAGE_GUILE2=ON
111                 -DCOMPILE_GSCHEMAS=OFF
112                 -DDISABLE_NLS=$(usex !nls)
113                 -DENABLE_REGISTER2=$(usex register2)
114                 -DWITH_AQBANKING=$(usex aqbanking)
115                 -DWITH_OFX=$(usex ofx)
116                 -DWITH_PYTHON=$(usex python)
117                 -DWITH_SQL=${sql_on_off}
118                 -DWITH_GNUCASH=$(usex gui)
119         )
120
121         cmake-utils_src_configure
122 }
123
124 src_test() {
125         if use python ; then
126                 cp common/test-core/unittest_support.py \
127                    "${BUILD_DIR}"/common/test-core/ || die
128         fi
129
130         cd "${BUILD_DIR}" || die
131         XDG_DATA_HOME="${T}/$(whoami)" emake check
132 }
133
134 src_install() {
135         cmake-utils_src_install
136
137         rm "${ED%/}"/usr/share/doc/${PF}/README.dependencies || die
138
139         if use examples ; then
140                 mv "${ED%/}"/usr/share/doc/gnucash \
141                    "${ED%/}"/usr/share/doc/${PF}/examples || die
142                 pushd "${ED%/}"/usr/share/doc/${PF}/examples/ > /dev/null || die
143                 rm AUTHORS DOCUMENTERS LICENSE NEWS projects.html ChangeLog* \
144                    *win32-bin.txt || die
145                 popd > /dev/null || die
146                 docompress -x /usr/share/doc/${PF}/examples/
147         else
148                 rm -r "${ED%/}"/usr/share/doc/gnucash || die
149         fi
150
151         use aqbanking && dodoc doc/README.HBCI
152         use ofx && dodoc doc/README.OFX
153 }
154
155 pkg_postinst() {
156         if use gui ; then
157                 gnome2_icon_cache_update
158                 gnome2_schemas_update
159         fi
160         xdg_desktop_database_update
161         xdg_mimeinfo_database_update
162
163         ewarn "Backup all financial files or databases before using GnuCash >=2.7.0!"
164         ewarn
165         ewarn "GnuCash 2.7.0 introduced large changes in its file format and database"
166         ewarn "schema that WILL prevent you from reverting back to GnuCash 2.6."
167 }
168
169 pkg_postrm() {
170         if use gui ; then
171                 gnome2_icon_cache_update
172                 gnome2_schemas_update
173         fi
174         xdg_desktop_database_update
175         xdg_mimeinfo_database_update
176 }