1{
2 lib,
3 fetchurl,
4 buildDunePackage,
5 ocaml,
6 version ?
7 if lib.versionAtLeast ocaml.version "4.07" then
8 if lib.versionAtLeast ocaml.version "4.08" then
9 if lib.versionAtLeast ocaml.version "4.11" then "0.33.0" else "0.24.0"
10 else
11 "0.15.0"
12 else
13 "0.13.0",
14 ocaml-compiler-libs,
15 ocaml-migrate-parsetree,
16 ppx_derivers,
17 stdio,
18 stdlib-shims,
19 ocaml-migrate-parsetree-2,
20}:
21
22let
23 param =
24 {
25 "0.8.1" = {
26 sha256 = "sha256-pct57oO7qAMEtlvEfymFOCvviWaLG0b5/7NzTC8vdSE=";
27 max_version = "4.10";
28 OMP = [ ocaml-migrate-parsetree ];
29 };
30 "0.13.0" = {
31 sha256 = "sha256-geHz0whQDg5/YQjVsN2iuHlkClwh7z3Eqb2QOBzuOdk=";
32 min_version = "4.07";
33 max_version = "4.11";
34 OMP = [ ocaml-migrate-parsetree ];
35 };
36 "0.15.0" = {
37 sha256 = "sha256-C2MNf410qJmlXMJxiLXOA+c1qT8H6gwt5WUy2P2TszA=";
38 min_version = "4.07";
39 max_version = "4.12";
40 OMP = [ ocaml-migrate-parsetree ];
41 };
42 "0.18.0" = {
43 sha256 = "sha256-nUg8NkZ64GHHDfcWbtFGXq3MNEKu+nYPtcVDm/gEfcM=";
44 min_version = "4.07";
45 max_version = "4.12";
46 OMP = [ ocaml-migrate-parsetree-2 ];
47 };
48 "0.22.0" = {
49 sha256 = "sha256-PuuR4DlmZiKEoyIuYS3uf0+it2N8U9lXLSp0E0u5bXo=";
50 min_version = "4.07";
51 max_version = "4.13";
52 OMP = [ ocaml-migrate-parsetree-2 ];
53 };
54 "0.22.2" = {
55 sha256 = "sha256-0Oih69xiILFXTXqSbwCEYMURjM73m/mgzgJC80z/Ilo=";
56 min_version = "4.07";
57 max_version = "4.14";
58 OMP = [ ocaml-migrate-parsetree-2 ];
59 };
60 "0.23.0" = {
61 sha256 = "sha256-G1g2wYa51aFqz0falPOWj08ItRm3cpzYao/TmXH+EuU=";
62 min_version = "4.07";
63 max_version = "4.14";
64 };
65 "0.24.0" = {
66 sha256 = "sha256-d2YCfC7ND1s7Rg6SEqcHCcZ0QngRPrkfMXxWxB56kMg=";
67 min_version = "4.07";
68 max_version = "5.1";
69 };
70 "0.28.0" = {
71 sha256 = "sha256-2Hrl+aCBIGMIypZICbUKZq646D0lSAHouWdUSLYM83c=";
72 min_version = "4.07";
73 max_version = "5.1";
74 };
75 "0.30.0" = {
76 sha256 = "sha256-3UpjvenSm0mBDgTXZTk3yTLxd6lByg4ZgratU6xEIRA=";
77 min_version = "4.07";
78 };
79 "0.32.1" = {
80 sha256 = "sha256-nbrYvLHItPPfP1i8pgpe0j2GUx8No0tBlshr1YXAnX8=";
81 min_version = "4.07";
82 };
83 "0.33.0" = {
84 sha256 = "sha256-/6RO9VHyO3XiHb1pijAxBDE4Gq8UC5/kuBwucKLSxjo=";
85 min_version = "4.07";
86 };
87 }
88 ."${version}";
89in
90
91if
92 param ? max_version && lib.versionAtLeast ocaml.version param.max_version
93 || param ? min_version && lib.versionOlder ocaml.version param.min_version
94then
95 throw "ppxlib-${version} is not available for OCaml ${ocaml.version}"
96else
97
98 buildDunePackage rec {
99 pname = "ppxlib";
100 inherit version;
101
102 src = fetchurl {
103 url = "https://github.com/ocaml-ppx/ppxlib/releases/download/${version}/ppxlib-${version}.tbz";
104 inherit (param) sha256;
105 };
106
107 propagatedBuildInputs = [
108 ocaml-compiler-libs
109 ]
110 ++ (param.OMP or [ ])
111 ++ [
112 ppx_derivers
113 stdio
114 stdlib-shims
115 ];
116
117 meta = {
118 description = "Comprehensive ppx tool set";
119 license = lib.licenses.mit;
120 maintainers = [ lib.maintainers.vbgl ];
121 homepage = "https://github.com/ocaml-ppx/ppxlib";
122 };
123 }