summaryrefslogtreecommitdiffstats
path: root/pkgs/development/ocaml-modules/ulex/default.nix
blob: d6f3781fe588f361985e76f5c487c7a5261e03b2 (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
55
56
57
58
59
60
61
{
  stdenv,
  lib,
  fetchFromGitHub,
  ocaml,
  findlib,
  ocamlbuild,
  camlp4,
}:

let
  pname = "ulex";
  param =
    if lib.versionAtLeast ocaml.version "4.02" then
      {
        version = "1.2";
        sha256 = "08yf2x9a52l2y4savjqfjd2xy4pjd1rpla2ylrr9qrz1drpfw4ic";
      }
    else
      {
        version = "1.1";
        sha256 = "0cmscxcmcxhlshh4jd0lzw5ffzns12x3bj7h27smbc8waxkwffhl";
      };
in
stdenv.mkDerivation {
  pname = "ocaml${ocaml.version}-${pname}";
  inherit (param) version;

  src = fetchFromGitHub {
    owner = "ocaml-community";
    repo = pname;
    rev = "v${param.version}";
    inherit (param) sha256;
  };

  createFindlibDestdir = true;

  nativeBuildInputs = [
    ocaml
    findlib
    ocamlbuild
    camlp4
  ];
  propagatedBuildInputs = [ camlp4 ];

  strictDeps = true;

  buildFlags = [
    "all"
    "all.opt"
  ];

  meta = {
    homepage = "https://opam.ocaml.org/packages/ulex/";
    description = "Lexer generator for Unicode and OCaml";
    license = lib.licenses.mit;
    inherit (ocaml.meta) platforms;
    maintainers = [ lib.maintainers.roconnor ];
    broken = lib.versionAtLeast ocaml.version "5.0";
  };
}