app-office/gnucash: Bump to 3.0
[gentoo.git] / app-office / gnucash / gnucash-3.0.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
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_{4,5,6} )
9
10 inherit cmake-utils gnome2-utils python-single-r1 xdg-utils
11
12 DESCRIPTION="A personal finance manager"
13 HOMEPAGE="http://www.gnucash.org/"
14 SRC_URI="mirror://sourceforge/${PN}/${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 # Add doc back in for 3.0 and bump app-doc/gnucash-docs
22 IUSE="aqbanking chipcard debug examples gnome-keyring mysql nls ofx postgres
23           python quotes -register2 sqlite"
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 RDEPEND="
32         >=dev-libs/glib-2.40.0:2
33         >=dev-libs/libxml2-2.7.0:2
34         >=dev-scheme/guile-2.0.0:12=[regex]
35         >=sys-libs/zlib-1.1.4
36         >=x11-libs/gtk+-3.14.0:3
37         dev-libs/boost:=[icu,nls]
38         dev-libs/icu:=
39         dev-libs/libxslt
40         gnome-base/dconf
41         net-libs/webkit-gtk:4=
42         aqbanking? (
43                 >=net-libs/aqbanking-5[gtk,ofx?]
44                 sys-libs/gwenhywfar[gtk]
45                 chipcard? ( sys-libs/libchipcard )
46         )
47         gnome-keyring? ( >=app-crypt/libsecret-0.18 )
48         mysql? (
49                 dev-db/libdbi
50                 dev-db/libdbi-drivers[mysql]
51         )
52         ofx? ( >=dev-libs/libofx-0.9.1 )
53         postgres? (
54                 dev-db/libdbi
55                 dev-db/libdbi-drivers[postgres]
56         )
57         python? ( ${PYTHON_DEPS} )
58         quotes? (
59                 >=dev-perl/Finance-Quote-1.11
60                 dev-perl/Date-Manip
61                 dev-perl/HTML-TableExtract
62         )
63         sqlite? (
64                 >=dev-db/libdbi-0.9.0
65                 >=dev-db/libdbi-drivers-0.9.0[sqlite]
66         )
67 "
68
69 DEPEND="${RDEPEND}
70         ~dev-cpp/gtest-${GV}
71         >=sys-devel/gettext-0.19.6
72         dev-lang/perl
73         dev-perl/XML-Parser
74         gnome-base/gnome-common
75         sys-devel/libtool
76         virtual/pkgconfig
77 "
78
79 # Uncomment for 3.0
80 # PDEPEND="doc? (
81 #       ~app-doc/gnucash-docs-${PV}
82 #       gnome-extra/yelp
83 # )"
84
85 #PATCHES=( "${FILESDIR}"/${PN}-2.7.4-fix-tests-for-32bit-platforms.patch )
86
87 pkg_setup() {
88         use python && python-single-r1_pkg_setup
89         xdg_environment_reset
90 }
91
92 src_configure() {
93         local sql_on_off="OFF"
94         if use mysql || use postgres || use sqlite ; then
95                 sql_on_off="ON"
96         fi
97
98         local mycmakeargs=(
99                 -DGMOCK_ROOT="${WORKDIR}"/googletest-release-${GV}/googlemock
100                 -DGTEST_ROOT="${WORKDIR}"/googletest-release-${GV}/googletest
101
102                 -DDISABLE_NLS=$(usex !nls)
103                 -DENABLE_REGISTER2=$(usex register2)
104                 -DWITH_AQBANKING=$(usex aqbanking)
105                 -DWITH_OFX=$(usex ofx)
106                 -DWITH_PYTHON=$(usex python)
107                 -DWITH_SQL=${sql_on_off}
108         )
109
110         cmake-utils_src_configure
111 }
112
113 src_test() {
114         if use python ; then
115                 cp common/test-core/unittest_support.py \
116                    "${BUILD_DIR}"/common/test-core/ || die
117         fi
118
119         cd "${BUILD_DIR}" || die
120         XDG_DATA_HOME="${T}/$(whoami)" emake check
121 }
122
123 src_install() {
124         cmake-utils_src_install
125
126         rm "${ED%/}"/usr/share/doc/${PF}/README.dependencies || die
127         rm "${ED%/}"/usr/share/glib-2.0/schemas/gschemas.compiled || die
128
129         if use examples ; then
130                 mv "${ED%/}"/usr/share/doc/gnucash \
131                    "${ED%/}"/usr/share/doc/${PF}/examples || die
132                 pushd "${ED%/}"/usr/share/doc/${PF}/examples/ > /dev/null || die
133                 rm AUTHORS DOCUMENTERS LICENSE NEWS projects.html ChangeLog* \
134                    *win32-bin.txt || die
135                 popd > /dev/null || die
136                 docompress -x /usr/share/doc/${PF}/examples/
137         else
138                 rm -r "${ED%/}"/usr/share/doc/gnucash || die
139         fi
140
141         use aqbanking && dodoc doc/README.HBCI
142         use ofx && dodoc doc/README.OFX
143 }
144
145 pkg_postinst() {
146         gnome2_icon_cache_update
147         gnome2_schemas_update
148         xdg_desktop_database_update
149         xdg_mimeinfo_database_update
150
151         ewarn "Backup all financial files or databases before using GnuCash >=2.7.0!"
152         ewarn
153         ewarn "GnuCash 2.7.0 introduced large changes in its file format and database"
154         ewarn "schema that WILL prevent you from reverting back to GnuCash 2.6."
155 }
156
157 pkg_postrm() {
158         gnome2_icon_cache_update
159         gnome2_schemas_update
160         xdg_desktop_database_update
161         xdg_mimeinfo_database_update
162 }