1{
2 lib,
3 fetchurl,
4 version ? "0.27.0",
5 astring,
6 base,
7 camlp-streams,
8 cmdliner_1_0,
9 cmdliner_1_1,
10 csexp,
11 dune-build-info,
12 either,
13 fix,
14 fpath,
15 menhirLib,
16 menhirSdk,
17 ocaml-version,
18 ocp-indent,
19 odoc-parser,
20 result,
21 stdio,
22 uuseg,
23 uutf,
24 ...
25}:
26
27# The ocamlformat package have been split into two in version 0.25.1:
28# one for the library and one for the executable.
29# Both have the same sources and very similar dependencies.
30
31rec {
32 tarballName = "ocamlformat-${version}.tbz";
33
34 src = fetchurl {
35 url = "https://github.com/ocaml-ppx/ocamlformat/releases/download/${version}/${tarballName}";
36 sha256 =
37 {
38 "0.19.0" = "0ihgwl7d489g938m1jvgx8azdgq9f5np5mzqwwya797hx2m4dz32";
39 "0.20.0" = "sha256-JtmNCgwjbCyUE4bWqdH5Nc2YSit+rekwS43DcviIfgk=";
40 "0.20.1" = "sha256-fTpRZFQW+ngoc0T6A69reEUAZ6GmHkeQvxspd5zRAjU=";
41 "0.21.0" = "sha256-KhgX9rxYH/DM6fCqloe4l7AnJuKrdXSe6Y1XY3BXMy0=";
42 "0.22.4" = "sha256-61TeK4GsfMLmjYGn3ICzkagbc3/Po++Wnqkb2tbJwGA=";
43 "0.23.0" = "sha256-m9Pjz7DaGy917M1GjyfqG5Lm5ne7YSlJF2SVcDHe3+0=";
44 "0.24.0" = "sha256-Zil0wceeXmq2xy0OVLxa/Ujl4Dtsmc4COyv6Jo7rVaM=";
45 "0.24.1" = "sha256-AjQl6YGPgOpQU3sjcaSnZsFJqZV9BYB+iKAE0tX0Qc4=";
46 "0.25.1" = "sha256-3I8qMwyjkws2yssmI7s2Dti99uSorNKT29niJBpv0z0=";
47 "0.26.0" = "sha256-AxSUq3cM7xCo9qocvrVmDkbDqmwM1FexEP7IWadeh30=";
48 "0.26.1" = "sha256-2gBuQn8VuexhL7gI1EZZm9m3w+4lq+s9VVdHpw10xtc=";
49 "0.26.2" = "sha256-Lk9Za/eqNnqET+g7oPawvxSyplF53cCCNj/peT0DdcU=";
50 "0.27.0" = "sha256-3b9ITAdtCPmUAO6Et5DsIx9cj8vV0zJKZADVOI6EbRU=";
51 }
52 ."${version}";
53 };
54
55 inherit version;
56
57 odoc-parser_v = odoc-parser.override {
58 version =
59 if lib.versionAtLeast version "0.24.0" then
60 "2.0.0"
61 else if lib.versionAtLeast version "0.20.1" then
62 "1.0.1"
63 else
64 "0.9.0";
65 };
66
67 cmdliner_v = if lib.versionAtLeast version "0.21.0" then cmdliner_1_1 else cmdliner_1_0;
68
69 library_deps = [
70 base
71 cmdliner_v
72 dune-build-info
73 fix
74 fpath
75 menhirLib
76 menhirSdk
77 ocp-indent
78 stdio
79 uuseg
80 uutf
81 ]
82 ++ lib.optionals (lib.versionAtLeast version "0.20.0") [
83 either
84 ocaml-version
85 ]
86 ++ lib.optionals (lib.versionAtLeast version "0.22.4") [ csexp ]
87 ++ (
88 if lib.versionOlder version "0.25.1" then
89 [ odoc-parser_v ]
90 else
91 [
92 camlp-streams
93 result
94 astring
95 ]
96 );
97}