summaryrefslogtreecommitdiff
blob: 9fe8dff84edd1bd8e3594178be6eebbc0378667e (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
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=5

inherit findlib eutils

DESCRIPTION="A compiler from OCaml bytecode to javascript"
HOMEPAGE="http://ocsigen.org/js_of_ocaml/"

if [ "${PV#9999}" != "${PV}" ] ; then
	inherit git-r3
	SRC_URI=""
	EGIT_REPO_URI="https://github.com/ocsigen/js_of_ocaml"
	KEYWORDS=""
else
	SRC_URI="https://github.com/ocsigen/js_of_ocaml/archive/${PV}.tar.gz -> ${P}.tar.gz"
	KEYWORDS="~amd64"
fi

LICENSE="LGPL-2.1-with-linking-exception"
SLOT="0/${PV}"
IUSE="+ocamlopt +camlp4 +lwt doc +deriving +ppx +xml test"

RDEPEND="
	>=dev-lang/ocaml-3.12:=[ocamlopt?]

	camlp4? ( dev-ml/camlp4:= )

	dev-ml/cmdliner:=
	dev-ml/cppo:=

	lwt? ( >=dev-ml/lwt-2.4.4:= )

	dev-ml/ocamlbuild:=

	dev-ml/ocaml-migrate-parsetree:=
	dev-ml/ppx_tools_versioned:=
	dev-ml/uchar:=

	ppx? ( dev-ml/ppx_tools:= dev-ml/ppx_deriving:= )

	xml? ( >=dev-ml/tyxml-4:= dev-ml/reactiveData:= )
"
DEPEND="${RDEPEND}
	dev-ml/jbuilder
	dev-ml/opam
	test? ( dev-util/patdiff )
"
REQUIRED_USE="xml? ( ppx )"

src_compile() {
	emake
	use doc && emake doc
}

oinstall() {
	opam-installer -i \
		--prefix="${ED}/usr" \
		--libdir="${D}/$(ocamlc -where)" \
		--docdir="${ED}/usr/share/doc/${PF}" \
		--mandir="${ED}/usr/share/man" \
		${1}.install || die
}

src_install() {
	use camlp4 && oinstall js_of_ocaml-camlp4
	oinstall js_of_ocaml-compiler
	use lwt && oinstall js_of_ocaml-lwt
	oinstall js_of_ocaml-ocamlbuild
	oinstall js_of_ocaml
	use ppx && oinstall js_of_ocaml-ppx
	use ppx && oinstall js_of_ocaml-toplevel
	use xml && oinstall js_of_ocaml-tyxml
}