dev-util/clair: 2.1.3 bump
[gentoo.git] / sci-visualization / gri / gri-2.12.23-r1.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 inherit eutils elisp-common
7
8 DESCRIPTION="Language for scientific graphics programming"
9 HOMEPAGE="http://gri.sourceforge.net/"
10 SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
11
12 LICENSE="GPL-2"
13 SLOT="0"
14 KEYWORDS="amd64 ~ppc x86 ~amd64-linux ~x86-linux"
15 IUSE="doc emacs examples hdf5"
16
17 DEPEND="
18         app-text/ghostscript-gpl
19         >=sci-libs/netcdf-4
20         virtual/latex-base
21         virtual/imagemagick-tools[png]
22         emacs? ( >=app-editors/emacs-23.1:* )"
23 RDEPEND="${DEPEND}"
24
25 SITEFILE="50gri-gentoo.el"
26
27 src_prepare() {
28         epatch \
29                 "${FILESDIR}"/${PN}-2.12.18-postscript.patch \
30                 "${FILESDIR}"/${P}-perl-5.16.patch \
31                 "${FILESDIR}"/${P}-texinfo5.patch
32         # Makefile.am contains a call to the missing script that triggers gentoo qa
33         sed -i -e 's|${SHELL} ../missing --run tex|tex|g' \
34                 doc/Makefile.in || die
35         sed \
36                 -e "/system/d" \
37                 -i doc/tst_suite/tst_rpn.gri || die
38 }
39
40 src_compile() {
41         # gentoo bug #302621
42         use hdf5 && has_version sci-libs/hdf5[mpi] && \
43                 export CXX=mpicxx CC=mpicc
44         VARTEXFONTS="${T}/fonts" emake
45         use emacs && elisp-compile src/*.el
46 }
47
48 src_install() {
49         default
50         # license text not necessary
51         rm "${ED}"/usr/share/gri/doc/license.txt || die
52
53         # install target installs it always and in the wrong location
54         # remove it here and call elisp-install in case of USE=emacs below
55         rm -rf "${ED}"/usr/share/emacs || die
56
57         if ! use doc; then
58                 sed -i -e "s/Manual at.*//" "${ED}"/usr/share/gri/startup.msg || die
59                 rm "${ED}"/usr/share/gri/doc/{cmd,}refcard.ps || die
60                 rm -rf "${ED}"/usr/share/gri/doc/html || die
61         fi
62         if ! use examples; then
63                 sed -i -e "s/Examples at.*//" "${ED}"/usr/share/gri/startup.msg || die
64                 rm -rf "${ED}"/usr/share/gri/doc/examples || die
65         fi
66         #move docs to the proper place
67         use doc || use examples && \
68                 mv -f "${ED}"/usr/share/gri/doc/* "${ED}"/usr/share/doc/${PF}
69         rm -rf "${ED}"/usr/share/gri/doc || die
70
71         if use emacs; then
72                 cd src
73                 elisp-install ${PN} *.{el,elc}
74                 elisp-site-file-install "${FILESDIR}/${SITEFILE}"
75         fi
76 }
77
78 pkg_postinst() {
79         use emacs && elisp-site-regen
80 }
81
82 pkg_postrm() {
83         use emacs && elisp-site-regen
84 }