|
| 1 | +# Copyright 1999-2020 Gentoo Authors |
| 2 | +# Distributed under the terms of the GNU General Public License v2 |
| 3 | + |
| 4 | +EAPI=7 |
| 5 | + |
| 6 | +PYTHON_COMPAT=( python3_{6,7,8} ) |
| 7 | + |
| 8 | +inherit cmake-utils gnome2-utils python-single-r1 xdg-utils |
| 9 | + |
| 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" |
| 13 | + |
| 14 | +SLOT="0" |
| 15 | +LICENSE="GPL-2" |
| 16 | +KEYWORDS="~amd64 ~ppc ~ppc64 ~x86" |
| 17 | + |
| 18 | +IUSE="aqbanking debug doc examples gnome-keyring +gui mysql nls ofx postgres |
| 19 | + python quotes -register2 smartcard sqlite test" |
| 20 | + |
| 21 | +# Examples doesn't build unless GUI is also built |
| 22 | +REQUIRED_USE=" |
| 23 | + examples? ( gui ) |
| 24 | + python? ( ${PYTHON_REQUIRED_USE} ) |
| 25 | + smartcard? ( aqbanking )" |
| 26 | + |
| 27 | +# libdbi version requirement for sqlite taken from bug #455134 |
| 28 | +# |
| 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. |
| 33 | +RDEPEND=" |
| 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] |
| 37 | + >=sys-libs/zlib-1.1.4 |
| 38 | + dev-libs/boost:=[icu,nls] |
| 39 | + dev-libs/icu:= |
| 40 | + dev-libs/libxslt |
| 41 | + aqbanking? ( |
| 42 | + >=net-libs/aqbanking-6[ofx?] |
| 43 | + >=sys-libs/gwenhywfar-5.1.2 |
| 44 | + smartcard? ( sys-libs/libchipcard ) |
| 45 | + ) |
| 46 | + gnome-keyring? ( >=app-crypt/libsecret-0.18 ) |
| 47 | + gui? ( |
| 48 | + >=x11-libs/gtk+-3.14.0:3 |
| 49 | + gnome-base/dconf |
| 50 | + net-libs/webkit-gtk:4= |
| 51 | + sys-libs/gwenhywfar[gtk] |
| 52 | + ) |
| 53 | + mysql? ( |
| 54 | + dev-db/libdbi |
| 55 | + dev-db/libdbi-drivers[mysql] |
| 56 | + ) |
| 57 | + ofx? ( >=dev-libs/libofx-0.9.1:= ) |
| 58 | + postgres? ( |
| 59 | + dev-db/libdbi |
| 60 | + dev-db/libdbi-drivers[postgres] |
| 61 | + ) |
| 62 | + python? ( ${PYTHON_DEPS} ) |
| 63 | + quotes? ( |
| 64 | + >=dev-perl/Finance-Quote-1.11 |
| 65 | + dev-perl/Date-Manip |
| 66 | + dev-perl/HTML-TableExtract |
| 67 | + ) |
| 68 | + sqlite? ( |
| 69 | + >=dev-db/libdbi-0.9.0 |
| 70 | + >=dev-db/libdbi-drivers-0.9.0[sqlite] |
| 71 | + ) |
| 72 | +" |
| 73 | + |
| 74 | +DEPEND="${RDEPEND} |
| 75 | + >=dev-cpp/gtest-1.8.0 |
| 76 | + >=sys-devel/gettext-0.19.6 |
| 77 | + dev-lang/perl |
| 78 | + dev-perl/XML-Parser |
| 79 | + sys-devel/libtool |
| 80 | + virtual/pkgconfig |
| 81 | +" |
| 82 | + |
| 83 | +PDEPEND="doc? ( |
| 84 | + ~app-doc/gnucash-docs-${PV} |
| 85 | + gnome-extra/yelp |
| 86 | +)" |
| 87 | + |
| 88 | +PATCHES=( |
| 89 | + "${FILESDIR}"/${PN}-3.2-no-gui.patch |
| 90 | + "${FILESDIR}"/${PN}-3.8-examples-subdir.patch |
| 91 | + "${FILESDIR}"/${PN}-3.8-exclude-license.patch |
| 92 | +) |
| 93 | + |
| 94 | +S="${WORKDIR}/${PN}-$(ver_cut 1-2)" |
| 95 | + |
| 96 | +pkg_setup() { |
| 97 | + use python && python-single-r1_pkg_setup |
| 98 | + xdg_environment_reset |
| 99 | +} |
| 100 | + |
| 101 | +src_prepare() { |
| 102 | + cmake-utils_src_prepare |
| 103 | + |
| 104 | + # Fix tests writing to /tmp |
| 105 | + local fixtestfiles=( |
| 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 |
| 112 | + ) |
| 113 | + for x in "${fixtestfiles[@]}"; do |
| 114 | + sed -i -e "s|\"/tmp/|\"${T}/|g" "${x}" || die "sed of "${x}" failed" |
| 115 | + done |
| 116 | +} |
| 117 | + |
| 118 | +src_configure() { |
| 119 | + export GUILE_AUTO_COMPILE=0 |
| 120 | + |
| 121 | + local sql_on_off="OFF" |
| 122 | + if use mysql || use postgres || use sqlite ; then |
| 123 | + sql_on_off="ON" |
| 124 | + fi |
| 125 | + |
| 126 | + local mycmakeargs=( |
| 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) |
| 135 | + ) |
| 136 | + |
| 137 | + cmake-utils_src_configure |
| 138 | +} |
| 139 | + |
| 140 | +src_test() { |
| 141 | + if use python ; then |
| 142 | + cp common/test-core/unittest_support.py \ |
| 143 | + "${BUILD_DIR}"/common/test-core/ || die |
| 144 | + fi |
| 145 | + |
| 146 | + LOCALE_TESTS= |
| 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." |
| 153 | + else |
| 154 | + LOCALE_TESTS=true |
| 155 | + fi |
| 156 | + else |
| 157 | + ewarn "'locale' not found." |
| 158 | + fi |
| 159 | + |
| 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 |
| 164 | + fi |
| 165 | + |
| 166 | + cd "${BUILD_DIR}" || die |
| 167 | + XDG_DATA_HOME="${T}/$(whoami)" eninja check |
| 168 | +} |
| 169 | + |
| 170 | +src_install() { |
| 171 | + cmake-utils_src_install |
| 172 | + |
| 173 | + rm "${ED}"/usr/share/doc/${PF}/*win32-bin.txt |
| 174 | + |
| 175 | + if use examples ; then |
| 176 | + docompress -x /usr/share/doc/${PF}/examples |
| 177 | + else |
| 178 | + rm -r "${ED}"/usr/share/doc/${PF}/examples |
| 179 | + fi |
| 180 | + |
| 181 | + use aqbanking && dodoc doc/README.HBCI |
| 182 | + use ofx && dodoc doc/README.OFX |
| 183 | +} |
| 184 | + |
| 185 | +pkg_postinst() { |
| 186 | + if use gui ; then |
| 187 | + xdg_icon_cache_update |
| 188 | + gnome2_schemas_update |
| 189 | + fi |
| 190 | + xdg_desktop_database_update |
| 191 | + xdg_mimeinfo_database_update |
| 192 | + |
| 193 | + ewarn "Backup all financial files or databases before using GnuCash >=2.7.0!" |
| 194 | + ewarn |
| 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." |
| 197 | +} |
| 198 | + |
| 199 | +pkg_postrm() { |
| 200 | + if use gui ; then |
| 201 | + xdg_icon_cache_update |
| 202 | + gnome2_schemas_update |
| 203 | + fi |
| 204 | + xdg_desktop_database_update |
| 205 | + xdg_mimeinfo_database_update |
| 206 | +} |
0 commit comments