1{ stdenv, fetchurl, ocaml, findlib, opam, uucp, uutf, cmdliner }:
2
3let
4 inherit (stdenv.lib) getVersion versionAtLeast;
5
6 pname = "uuseg";
7 version = "0.8.0";
8 webpage = "http://erratique.ch/software/${pname}";
9in
10
11assert versionAtLeast (getVersion ocaml) "4.01";
12
13stdenv.mkDerivation {
14
15 name = "ocaml-${pname}-${version}";
16
17 src = fetchurl {
18 url = "${webpage}/releases/${pname}-${version}.tbz";
19 sha256 = "00n4zi8dyw2yzi4nr2agcrr33b0q4dr9mgnkczipf4c0gm5cm50h";
20 };
21
22 buildInputs = [ ocaml findlib opam cmdliner ];
23 propagatedBuildInputs = [ uucp uutf ];
24
25 createFindlibDestdir = true;
26
27 unpackCmd = "tar xjf $src";
28
29 buildPhase = ''
30 ocaml pkg/build.ml \
31 native=true native-dynlink=true \
32 uutf=true cmdliner=true
33 '';
34
35 installPhase = ''
36 opam-installer --script --prefix=$out ${pname}.install | sh
37 ln -s $out/lib/${pname} $out/lib/ocaml/${getVersion ocaml}/site-lib/${pname}
38 '';
39
40 meta = with stdenv.lib; {
41 description = "An OCaml library for segmenting Unicode text";
42 homepage = "${webpage}";
43 platforms = ocaml.meta.platforms;
44 license = licenses.bsd3;
45 maintainers = [ maintainers.vbgl ];
46 };
47}