dev-ml/llvm-ocaml: Bump to 10.0.0
[gentoo.git] / dev-ml / uutf / uutf-1.0.1.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 findlib
7
8 DESCRIPTION="Non-blocking streaming Unicode codec for OCaml"
9 HOMEPAGE="http://erratique.ch/software/uutf"
10 SRC_URI="http://erratique.ch/software/uutf/releases/${P}.tbz"
11
12 LICENSE="ISC"
13 SLOT="0/${PV}"
14 KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~x86"
15 IUSE="doc utftrip +ocamlopt test"
16 RESTRICT="!test? ( test )"
17
18 RDEPEND=">=dev-lang/ocaml-3.12:=[ocamlopt?]
19         dev-ml/uchar:=
20         utftrip? ( dev-ml/cmdliner:= )"
21 DEPEND="${RDEPEND}
22         dev-ml/ocamlbuild
23         dev-ml/topkg
24         test? ( dev-ml/cmdliner )"
25
26 src_compile() {
27         ocaml pkg/pkg.ml build \
28                 --with-cmdliner "$(usex utftrip true false)" \
29                 || die
30 }
31
32 src_test() {
33         if use ocamlopt ; then
34                 ocamlbuild -use-ocamlfind tests.otarget || die
35                 pushd _build/test || die
36                 ./test.native || die
37                 #Rebuild to avoid mismatches between installed files, bug #604674
38                 popd || die
39                 ocaml pkg/pkg.ml build \
40                         --with-cmdliner "$(usex utftrip true false)" \
41                         || die
42         else
43                 ewarn "Sorry, ${PN} tests require native support (ocamlopt)"
44         fi
45 }
46
47 src_install() {
48         # Can't use opam-installer here as it is an opam dep...
49         findlib_src_preinst
50         local nativelibs=""
51         use ocamlopt && nativelibs="$(echo _build/src/uutf.cm{x,xa,xs} _build/src/uutf.a)"
52         ocamlfind install uutf _build/pkg/META _build/src/uutf.mli _build/src/uutf.cm{a,i} ${nativelibs} || die
53         use utftrip && newbin utftrip.$(usex ocamlopt native byte) utftrip
54         dodoc CHANGES.md README.md
55         use doc && dohtml -r doc/*
56 }