@@ -1,56 +1,65 @@
1−{ stdenv, fetchFromGitHub, ocaml, findlib, ocamlbuild, dune }:
1+{ stdenv, fetchurl, fetchFromGitHub, ocaml, findlib, ocamlbuild
2+, buildDunePackage
3+}:
4+
25let
36 pname = "cppo";
4− webpage = "https://github.com/ocaml-community/${pname}";
7+
8+ meta = with stdenv.lib; {
9+ description = "The C preprocessor for OCaml";
10+ longDescription = ''
11+ Cppo is an equivalent of the C preprocessor targeted at the OCaml language and its variants.
12+ '';
13+ homepage = "https://github.com/ocaml-community/${pname}";
14+ maintainers = [ maintainers.vbgl ];
15+ license = licenses.bsd3;
16+ };
17+
518in
6−assert stdenv.lib.versionAtLeast ocaml.version "3.12";
7−
8−let param =
9− if stdenv.lib.versionAtLeast ocaml.version "4.02" then
10− (if stdenv.lib.versionAtLeast ocaml.version "4.03" then {
11− version = "1.6.6";
12− sha256 = "1smcc0l6fh2n0y6bp96c69j5nw755jja99w0b206wx3yb2m4w2hs";
13− } else {
14− version = "1.6.5";
15− sha256 = "03c0amszy28shinvz61hm340jz446zz5763a1pdqlza36kwcj0p0";
16− }) // {
17− buildInputs = [ dune ];
18− extra = {
19− inherit (dune) installPhase;
20− };
21− } else {
22− version = "1.5.0";
23− sha256 = "1xqldjz9risndnabvadw41fdbi5sa2hl4fnqls7j9xfbby1izbg8";
24− extra = {
25− createFindlibDestdir = true;
26− makeFlags = [ "PREFIX=$(out)" ];
27− preBuild = ''
28− mkdir $out/bin
29− '';
30− };
31− }
32−; in
3319
34−stdenv.mkDerivation ({
20+if stdenv.lib.versionAtLeast ocaml.version "4.02" then
21+
22+buildDunePackage rec {
23+ inherit pname;
24+ version = "1.6.7";
25+
26+ useDune2 = true;
27+
28+ src = fetchurl {
29+ url = "https://github.com/ocaml-community/cppo/releases/download/v${version}/cppo-v${version}.tbz";
30+ sha256 = "17ajdzrnmnyfig3s6hinb56mcmhywbssxhsq32dz0v90dhz3wmfv";
31+ };
32+
33+ doCheck = true;
3534
36− name = "${pname}-${param.version}";
35+ inherit meta;
36+}
37+
38+else
39+
40+let version = "1.5.0"; in
41+
42+stdenv.mkDerivation {
43+
44+ name = "${pname}-${version}";
3745
3846 src = fetchFromGitHub {
3947 owner = "mjambon";
4048 repo = pname;
41− rev = "v${param.version}";
42− inherit (param) sha256;
49+ rev = "v${version}";
50+ sha256 = "1xqldjz9risndnabvadw41fdbi5sa2hl4fnqls7j9xfbby1izbg8";
4351 };
4452
45− buildInputs = [ ocaml findlib ocamlbuild ] ++ (param.buildInputs or []);
53+ buildInputs = [ ocaml findlib ocamlbuild ];
4654
47− meta = with stdenv.lib; {
48− description = "The C preprocessor for OCaml";
49− longDescription = ''
50− Cppo is an equivalent of the C preprocessor targeted at the OCaml language and its variants.
51− '';
52− homepage = webpage;
53− maintainers = [ maintainers.vbgl ];
54− license = licenses.bsd3;
55− };
56−} // param.extra)
55+ inherit meta;
56+
57+ createFindlibDestdir = true;
58+
59+ makeFlags = [ "PREFIX=$(out)" ];
60+
61+ preBuild = ''
62+ mkdir $out/bin
63+ '';
64+
65+}