summaryrefslogtreecommitdiff
blob: 9840c716d59b4a46cad8ae9b0db6418ee2e403a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI="5"

inherit eutils multilib

MY_PV=${PV/_p/pl}
MY_P=${PN}-${MY_PV}

DESCRIPTION="Proof assistant written in O'Caml"
HOMEPAGE="http://coq.inria.fr/"
SRC_URI="http://${PN}.inria.fr/distrib/V${MY_PV}/files/${MY_P}.tar.gz"

LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="amd64 ~ppc ~x86"
IUSE="gtk debug +ocamlopt doc camlp5"

RDEPEND="
	>=dev-lang/ocaml-3.11.2:=[ocamlopt?]
	camlp5? ( >=dev-ml/camlp5-6.02.3:=[ocamlopt?] )
	!camlp5? ( || ( dev-ml/camlp4:= <dev-lang/ocaml-4.02.0 ) )
	gtk? ( >=dev-ml/lablgtk-2.10.1:=[ocamlopt?] )"
DEPEND="${RDEPEND}
	doc? (
		media-libs/netpbm[png,zlib]
		virtual/latex-base
		dev-tex/hevea
		dev-tex/xcolor
		dev-texlive/texlive-pictures
		dev-texlive/texlive-mathextra
		dev-texlive/texlive-latexextra
		)"

S=${WORKDIR}/${MY_P}

src_prepare() {
	epatch "${FILESDIR}/${PN}-8.4_p5-do-not-install-revision.patch"
	# Fix generation of the index_urls.txt file with Gentoo dev-tex/hevea versions.
	# http://lists.gforge.inria.fr/pipermail/coq-commits/2014-October/013582.html
	epatch "${FILESDIR}/${P}-hevea.patch"
	epatch "${FILESDIR}/${PN}-8.4_p5-no-clean-before-test.patch"
}

src_configure() {
	ocaml_lib=$(ocamlc -where)
	local myconf=(
		--prefix /usr
		--bindir /usr/bin
		--libdir /usr/$(get_libdir)/coq
		--mandir /usr/share/man
		--emacslib /usr/share/emacs/site-lisp
		--coqdocdir /usr/$(get_libdir)/coq/coqdoc
		--docdir /usr/share/doc/${PF}
		--configdir /etc/xdg/${PN}
		--lablgtkdir ${ocaml_lib}/lablgtk2
		)

	use debug && myconf+=( --debug )
	use doc || myconf+=( --with-doc no )

	if use gtk; then
		if use ocamlopt; then
			myconf+=( --coqide opt )
		else
			myconf+=( --coqide byte )
		fi
	else
		myconf+=( --coqide no )
	fi

	if use ocamlopt; then
		myconf+=( --opt )
	else
		myconf+=( -byte-only )
	fi

	if use camlp5; then
		myconf+=( --camlp5dir ${ocaml_lib}/camlp5 )
	else
		myconf+=( --usecamlp4 )
	fi

	export CAML_LD_LIBRARY_PATH="${S}/kernel/byterun/"
	./configure ${myconf[@]} || die "configure failed"
}

src_compile() {
	emake STRIP="true" -j1 world VERBOSE=1
}

src_test() {
	emake STRIP="true" check VERBOSE=1
}

src_install() {
	emake STRIP="true" COQINSTALLPREFIX="${D}" install VERBOSE=1
	dodoc README CREDITS CHANGES

	use gtk && make_desktop_entry "coqide" "Coq IDE" "${EPREFIX}/usr/share/coq/coq.png"
}