app-office/ledger: Bug fixes, EAPI=6
[gentoo.git] / app-office / ledger / ledger-3.1.1-r1.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 PYTHON_COMPAT=( python2_7 )
7
8 inherit check-reqs cmake-utils elisp-common python-single-r1
9
10 DESCRIPTION="A double-entry accounting system with a command-line reporting interface"
11 HOMEPAGE="https://www.ledger-cli.org/"
12 SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
13
14 LICENSE="BSD"
15 KEYWORDS="~amd64 ~x86"
16 SLOT="0"
17 IUSE="doc emacs python"
18 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
19 RESTRICT="test"
20
21 SITEFILE=50${PN}-gentoo-${PV}.el
22
23 CHECKREQS_MEMORY=8G
24
25 RDEPEND="
26         dev-libs/boost:=[python?]
27         dev-libs/gmp:0=
28         dev-libs/mpfr:0=
29         emacs? ( virtual/emacs )
30         python? (
31                 dev-libs/boost:=[${PYTHON_USEDEP}]
32                 dev-python/cheetah
33                 ${PYTHON_DEPS}
34         )
35 "
36 DEPEND="
37         ${RDEPEND}
38         dev-libs/utfcpp
39         doc? (
40                 sys-apps/texinfo
41                 virtual/texi2dvi
42                 dev-texlive/texlive-fontsrecommended
43         )
44 "
45
46 PATCHES=(
47         "${FILESDIR}/${PN}-${PV}-boost.patch" # bug 609108
48         "${FILESDIR}/${PF}-boost-python.patch" # bug 654326
49         )
50
51 # Building with python integration seems to fail without 8G available
52 # RAM(!)  Since the memory check in check-reqs doesn't count swap, it
53 # may be unfair to fail the build entirely on the memory test alone.
54 # Therefore check-reqs_pkg_pretend is deliberately omitted so that we
55 # ewarn but not eerror.
56 pkg_pretend() {
57         :
58 }
59
60 pkg_setup() {
61         if use python; then
62                 check-reqs_pkg_setup
63                 python-single-r1_pkg_setup
64         fi
65 }
66
67 src_prepare() {
68         cmake-utils_src_prepare
69
70         # Want to type "info ledger" not "info ledger3"
71         sed -i -e 's/ledger3/ledger/g' \
72                 doc/ledger3.texi \
73                 doc/CMakeLists.txt \
74                 test/CheckTexinfo.py \
75                 tools/cleanup.sh \
76                 tools/gendocs.sh \
77                 tools/prepare-commit-msg \
78                 tools/spellcheck.sh \
79                 || die "Failed to update info file name in file contents"
80
81         mv doc/ledger{3,}.texi || die "Failed to rename info file name"
82
83         eapply_user
84 }
85
86 src_configure() {
87         local mycmakeargs=(
88                 -DBUILD_EMACSLISP="$(usex emacs)"
89                 -DBUILD_DOCS="$(usex doc)"
90                 -DBUILD_WEB_DOCS="$(usex doc)"
91                 -DUSE_PYTHON="$(usex python)"
92                 -DCMAKE_INSTALL_DOCDIR="/usr/share/doc/${PF}"
93                 -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON
94         )
95
96         cmake-utils_src_configure
97 }
98
99 src_compile() {
100         cmake-utils_src_compile
101
102         use doc && cmake-utils_src_make doc
103 }
104
105 src_install() {
106         cmake-utils_src_install
107
108         use emacs && elisp-site-file-install "${FILESDIR}/${SITEFILE}"
109 }
110
111 pkg_postinst() {
112         use emacs && elisp-site-regen
113
114         einfo
115         einfo "Since version 3, vim support is released separately."
116         einfo "See https://github.com/ledger/vim-ledger"
117         einfo
118 }
119
120 pkg_postrm() {
121         use emacs && elisp-site-regen
122 }
123
124 # rainy day TODO:
125 # - IUSE test