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

EAPI=6

DESCRIPTION="Websocket library for OCaml"
HOMEPAGE="https://github.com/vbmithr/ocaml-websocket"
SRC_URI="https://github.com/vbmithr/ocaml-websocket/archive/${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="ISC"
SLOT="0/${PV}"
KEYWORDS="~amd64"
IUSE="+ocamlopt async +ssl lwt"

DEPEND="
	dev-lang/ocaml:=[ocamlopt?]
	dev-ml/astring:=[ocamlopt(+)?]
	dev-ml/ocaml-cohttp:=[ocamlopt(+)?,async?,lwt?]
	dev-ml/cppo:=[ocamlopt(+)?]
	dev-ml/ocplib-endian:=[ocamlopt(+)?]
	async? (
		dev-ml/async:=[ocamlopt(+)?]
		ssl? ( dev-ml/async_ssl:=[ocamlopt(+)?] )
	)
	lwt? ( dev-ml/lwt:=[ocamlopt(+)?] )
	ssl? ( dev-ml/cryptokit:=[ocamlopt(+)?] )

"
RDEPEND="${DEPEND}"
DEPEND="${DEPEND}
	dev-ml/opam
	dev-ml/ocamlbuild"

src_compile() {
	ocaml pkg/build.ml \
		native=$(usex ocamlopt true false) \
		native-dynlink=$(usex ocamlopt true false) \
		lwt=$(usex lwt true false) \
		async=$(usex async true false) \
		async_ssl=$(usex async "$(usex ssl true false)" false) \
		nocrypto=false \
		cryptokit=$(usex ssl true false) \
		test=false \
		|| die
}

src_install() {
	opam-installer -i \
		--prefix="${ED}/usr" \
		--libdir="${D}/$(ocamlc -where)" \
		--docdir="${ED}/usr/share/doc/${PF}" \
		websocket.install || die
	dodoc README CHANGES
}