1{
2 stdenv,
3 lib,
4 darwin,
5 fetchFromGitHub,
6 buildDunePackage,
7 ocaml,
8 cppo,
9 camlp-streams,
10 dune-site,
11 version ? if lib.versionAtLeast ocaml.version "4.08" then "2.0.0" else "1.0.2",
12}:
13
14let
15 params = {
16 "1.0.2" =
17 lib.throwIf (lib.versionAtLeast ocaml.version "5.0")
18 "camomile 1 is not available for OCaml ${ocaml.version}"
19 {
20 src = fetchFromGitHub {
21 owner = "yoriyuki";
22 repo = "camomile";
23 rev = version;
24 sha256 = "00i910qjv6bpk0nkafp5fg97isqas0bwjf7m6rz11rsxilpalzad";
25 };
26
27 nativeBuildInputs = [ cppo ];
28
29 configurePhase = ''
30 runHook preConfigure
31 ocaml configure.ml --share $out/share/camomile
32 runHook postConfigure
33 '';
34
35 postInstall = ''
36 echo "version = \"${version}\"" >> $out/lib/ocaml/${ocaml.version}/site-lib/camomile/META
37 '';
38
39 };
40
41 "2.0.0" = {
42 src = fetchFromGitHub {
43 owner = "ocaml-community";
44 repo = "camomile";
45 rev = "v${version}";
46 hash = "sha256-HklX+VPD0Ta3Knv++dBT2rhsDSlDRH90k4Cj1YtWIa8=";
47 };
48
49 nativeBuildInputs = lib.optional stdenv.hostPlatform.isDarwin darwin.sigtool;
50
51 propagatedBuildInputs = [
52 camlp-streams
53 dune-site
54 ];
55 };
56 };
57in
58
59buildDunePackage (
60 params."${version}"
61 // {
62 pname = "camomile";
63 inherit version;
64
65 meta = {
66 homepage = "https://github.com/ocaml-community/Camomile";
67 maintainers = [ lib.maintainers.vbgl ];
68 license = lib.licenses.lgpl21;
69 description = "Unicode library for OCaml";
70 };
71 }
72)