Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / ocaml-modules / camomile / default.nix
blobb1178a4e8dd8ab3f10a7be1d1fc71b1c93283997
1 { stdenv, lib, darwin, fetchFromGitHub, buildDunePackage, ocaml, cppo
2 , camlp-streams, dune-site
3 , version ? if lib.versionAtLeast ocaml.version "4.08" then "2.0.0" else "1.0.2"
4 }:
6 let params =
7   {
8     "1.0.2" = lib.throwIf (lib.versionAtLeast ocaml.version "5.0")
9       "camomile 1 is not available for OCaml ${ocaml.version}" {
10       src = fetchFromGitHub {
11         owner = "yoriyuki";
12         repo = "camomile";
13         rev = version;
14         sha256 = "00i910qjv6bpk0nkafp5fg97isqas0bwjf7m6rz11rsxilpalzad";
15       };
17       nativeBuildInputs = [ cppo ];
19       configurePhase = ''
20         runHook preConfigure
21         ocaml configure.ml --share $out/share/camomile
22         runHook postConfigure
23       '';
25       postInstall = ''
26         echo "version = \"${version}\"" >> $out/lib/ocaml/${ocaml.version}/site-lib/camomile/META
27       '';
29     };
31     "2.0.0" = {
32       src = fetchFromGitHub {
33         owner = "ocaml-community";
34         repo = "camomile";
35         rev = "v${version}";
36         hash = "sha256-HklX+VPD0Ta3Knv++dBT2rhsDSlDRH90k4Cj1YtWIa8=";
37       };
39       nativeBuildInputs = lib.optional stdenv.isDarwin darwin.sigtool;
41       propagatedBuildInputs = [ camlp-streams dune-site ];
42     };
43   }
44 ; in
47 buildDunePackage (params."${version}" // {
48   pname = "camomile";
49   inherit version;
51   meta = {
52     homepage = "https://github.com/ocaml-community/Camomile";
53     maintainers = [ lib.maintainers.vbgl ];
54     license = lib.licenses.lgpl21;
55     description = "A Unicode library for OCaml";
56   };