1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python3_{6,7,8} )
8 inherit cmake-utils gnome2-utils python-single-r1 xdg-utils
10 DESCRIPTION="A personal finance manager"
11 HOMEPAGE="http://www.gnucash.org/"
12 SRC_URI="https://github.com/Gnucash/${PN}/releases/download/${PV}/${P}.tar.bz2"
16 KEYWORDS="amd64 ~ppc ~ppc64 x86"
18 IUSE="aqbanking debug doc examples gnome-keyring +gui mysql nls ofx postgres
19 python quotes -register2 smartcard sqlite test"
21 # Examples doesn't build unless GUI is also built
24 python? ( ${PYTHON_REQUIRED_USE} )
25 smartcard? ( aqbanking )"
27 # libdbi version requirement for sqlite taken from bug #455134
29 # dev-libs/boost must always be built with nls enabled.
30 # guile[deprecated] because of SCM_LIST*() use.
31 # net-libs/aqbanking dropped gtk with v6, so to simplify the dependency,
32 # we just rely on that.
34 >=dev-libs/glib-2.46.0:2
35 >=dev-libs/libxml2-2.7.0:2
36 >=dev-scheme/guile-2.2.0:12=[deprecated,regex]
38 dev-libs/boost:=[icu,nls]
42 >=net-libs/aqbanking-6[ofx?]
43 >=sys-libs/gwenhywfar-5.1.2
44 smartcard? ( sys-libs/libchipcard )
46 gnome-keyring? ( >=app-crypt/libsecret-0.18 )
48 >=x11-libs/gtk+-3.14.0:3
50 net-libs/webkit-gtk:4=
51 sys-libs/gwenhywfar[gtk]
55 dev-db/libdbi-drivers[mysql]
57 ofx? ( >=dev-libs/libofx-0.9.1:= )
60 dev-db/libdbi-drivers[postgres]
62 python? ( ${PYTHON_DEPS} )
64 >=dev-perl/Finance-Quote-1.11
66 dev-perl/HTML-TableExtract
70 >=dev-db/libdbi-drivers-0.9.0[sqlite]
76 >=sys-devel/gettext-0.19.6
84 ~app-doc/gnucash-docs-${PV}
89 "${FILESDIR}"/${PN}-3.2-no-gui.patch
90 "${FILESDIR}"/${PN}-3.8-examples-subdir.patch
91 "${FILESDIR}"/${PN}-3.8-exclude-license.patch
94 S="${WORKDIR}/${PN}-$(ver_cut 1-2)"
97 use python && python-single-r1_pkg_setup
102 cmake-utils_src_prepare
104 # Fix tests writing to /tmp
106 "${S}"/gnucash/report/report-system/test/test-commodity-utils.scm
107 "${S}"/gnucash/report/report-system/test/test-extras.scm
108 "${S}"/gnucash/report/report-system/test/test-report-html.scm
109 "${S}"/gnucash/report/report-system/test/test-report-system.scm
110 "${S}"/libgnucash/backend/xml/test/test-xml-pricedb.cpp
111 "${S}"/libgnucash/backend/dbi/test/test-backend-dbi-basic.cpp
113 for x in "${fixtestfiles[@]}"; do
114 sed -i -e "s|\"/tmp/|\"${T}/|g" "${x}" || die "sed of "${x}" failed"
119 export GUILE_AUTO_COMPILE=0
121 local sql_on_off="OFF"
122 if use mysql || use postgres || use sqlite ; then
127 -DCOMPILE_GSCHEMAS=OFF
128 -DDISABLE_NLS=$(usex !nls)
129 -DENABLE_REGISTER2=$(usex register2)
130 -DWITH_AQBANKING=$(usex aqbanking)
131 -DWITH_OFX=$(usex ofx)
132 -DWITH_PYTHON=$(usex python)
133 -DWITH_SQL=${sql_on_off}
134 -DWITH_GNUCASH=$(usex gui)
137 cmake-utils_src_configure
142 cp common/test-core/unittest_support.py \
143 "${BUILD_DIR}"/common/test-core/ || die
147 if type locale >/dev/null 2>&1; then
148 MY_LOCALES="$(locale -a)"
149 if [[ "${MY_LOCALES}" != *en_US* ||
150 "${MY_LOCALES}" != *en_GB* ||
151 "${MY_LOCALES}" != *fr_FR* ]] ; then
152 ewarn "Missing one or more of en_US, en_GB, or fr_FR locales."
157 ewarn "'locale' not found."
160 if [[ ! ${LOCALE_TESTS} ]]; then
161 ewarn "Disabling test-qof and test-gnc-numeric."
162 echo 'set(CTEST_CUSTOM_TESTS_IGNORE test-qof test-gnc-numeric)' \
163 > "${BUILD_DIR}"/CTestCustom.cmake || die
166 cd "${BUILD_DIR}" || die
167 XDG_DATA_HOME="${T}/$(whoami)" eninja check
171 cmake-utils_src_install
173 rm "${ED}"/usr/share/doc/${PF}/*win32-bin.txt
175 if use examples ; then
176 docompress -x /usr/share/doc/${PF}/examples
178 rm -r "${ED}"/usr/share/doc/${PF}/examples
181 use aqbanking && dodoc doc/README.HBCI
182 use ofx && dodoc doc/README.OFX
187 xdg_icon_cache_update
188 gnome2_schemas_update
190 xdg_desktop_database_update
191 xdg_mimeinfo_database_update
193 ewarn "Backup all financial files or databases before using GnuCash >=2.7.0!"
195 ewarn "GnuCash 2.7.0 introduced large changes in its file format and database"
196 ewarn "schema that WILL prevent you from reverting back to GnuCash 2.6."
201 xdg_icon_cache_update
202 gnome2_schemas_update
204 xdg_desktop_database_update
205 xdg_mimeinfo_database_update