media-gfx/splash-themes-livecd: Merge gentoo-functions use fix
[gentoo.git] / sci-mathematics / e / e-1.5.ebuild
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="5"
6
7 MY_PN="E"
8 MY_P="${MY_PN}-${PV}"
9
10 DESCRIPTION="E is a theorem prover for full first-order logic with equality"
11 HOMEPAGE="http://www4.informatik.tu-muenchen.de/~schulz/E/E.html"
12 SRC_URI="http://www4.in.tum.de/~schulz/WORK/E_DOWNLOAD/V_${PV}/${MY_PN}.tgz -> ${MY_P}.tgz"
13
14 LICENSE="GPL-2"
15 SLOT="0/${PV}"
16 KEYWORDS="~amd64 ~x86"
17 IUSE="doc examples isabelle"
18
19 RDEPEND="isabelle? (
20                         >=sci-mathematics/isabelle-2011.1-r1:=
21                 )"
22 DEPEND="${RDEPEND}"
23
24 S="${WORKDIR}"/${MY_PN}
25
26 src_configure() {
27         ./configure --prefix="${ROOT}usr" \
28                 --man-prefix="${ROOT}share/man" \
29                 || die "E configure failed"
30
31         sed -e "s@CFLAGS     = @CFLAGS     = ${CFLAGS} @" \
32                 -e "s@LD         = \$(CC) @LD         = \$(CC) ${LDFLAGS} @" \
33                 -i "${S}/Makefile.vars" \
34                 || die "Could not add our flags to Makefile.vars"
35 }
36
37 src_install() {
38         for i in "${S}/PROVER/eprover" \
39                 "${S}/PROVER/epclextract" \
40                 "${S}/PROVER/eproof" \
41                 "${S}/PROVER/eproof_ram" \
42                 "${S}/PROVER/eground" \
43                 "${S}/PROVER/e_ltb_runner" \
44                 "${S}/PROVER/e_axfilter" \
45                 "${S}/PROVER/checkproof" \
46                 "${S}/PROVER/ekb_create" \
47                 "${S}/PROVER/ekb_delete" \
48                 "${S}/PROVER/ekb_ginsert" \
49                 "${S}/PROVER/ekb_insert"
50         do
51                 dobin "${i}"
52         done
53
54         for i in "${S}/DOC/man/eprover.1" \
55                 "${S}/DOC/man/epclextract.1" \
56                 "${S}/DOC/man/eproof.1" \
57                 "${S}/DOC/man/eproof_ram.1" \
58                 "${S}/DOC/man/eground.1" \
59                 "${S}/DOC/man/e_ltb_runner.1" \
60                 "${S}/DOC/man/e_axfilter.1" \
61                 "${S}/DOC/man/checkproof.1" \
62                 "${S}/DOC/man/ekb_create.1" \
63                 "${S}/DOC/man/ekb_delete.1" \
64                 "${S}/DOC/man/ekb_ginsert.1" \
65                 "${S}/DOC/man/ekb_insert.1"
66         do
67                 doman "${i}"
68         done
69
70         if use doc; then
71                 pushd "${S}"/DOC || die "Could not cd to DOC"
72                 dodoc ANNOUNCE CREDITS DONE E-REMARKS E-REMARKS.english E-USERS \
73                         HISTORY NEWS PORTING ReadMe THINKME TODO TPTP_SUBMISSION \
74                         WISHLIST eprover.pdf
75                 dohtml *.html
76                 insinto /usr/share/doc/${PF}/html
77                 doins estyle.sty
78                 popd
79         fi
80
81         if use examples; then
82                 dodir /usr/share/${MY_PN}/examples
83                 insinto /usr/share/${MY_PN}/examples
84                 doins -r EXAMPLE_PROBLEMS
85                 doins -r SIMPLE_APPS
86         fi
87
88         if use isabelle; then
89                 ISABELLE_HOME="$(isabelle getenv ISABELLE_HOME | cut -d'=' -f 2)" \
90                         || die "isabelle getenv ISABELLE_HOME failed"
91                 [[ -n "${ISABELLE_HOME}" ]] || die "ISABELLE_HOME empty"
92                 dodir "${ISABELLE_HOME}/contrib/${PN}-${PV}/etc"
93                 cat <<- EOF >> "${S}/settings"
94                         E_HOME="${ROOT}usr/bin"
95                         E_VERSION="${PV}"
96                 EOF
97                 insinto "${ISABELLE_HOME}/contrib/${PN}-${PV}/etc"
98                 doins "${S}/settings"
99         fi
100 }
101
102 pkg_postinst() {
103         if use isabelle; then
104                 if [ -f "${ROOT}etc/isabelle/components" ]; then
105                         if egrep "contrib/${PN}-[0-9.]*" "${ROOT}etc/isabelle/components"; then
106                                 sed -e "/contrib\/${PN}-[0-9.]*/d" \
107                                         -i "${ROOT}etc/isabelle/components"
108                         fi
109                         cat <<- EOF >> "${ROOT}etc/isabelle/components"
110                                 contrib/${PN}-${PV}
111                         EOF
112                 fi
113         fi
114 }
115
116 pkg_postrm() {
117         if use isabelle; then
118                 if [ ! -f "${ROOT}usr/bin/eproof" ]; then
119                         if [ -f "${ROOT}etc/isabelle/components" ]; then
120                                 # Note: this sed should only match the version of this ebuild
121                                 # Which is what we want as we do not want to remove the line
122                                 # of a new E being installed during an upgrade.
123                                 sed -e "/contrib\/${PN}-${PV}/d" \
124                                         -i "${ROOT}etc/isabelle/components"
125                         fi
126                 fi
127         fi
128 }