Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchFromGitHub, ocaml, findlib, ocamlbuild
2, buildDunePackage
3}:
4
5let
6 pname = "cppo";
7
8 meta = with 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
18in
19
20if lib.versionAtLeast ocaml.version "4.02" then
21
22buildDunePackage rec {
23 inherit pname;
24 version = "1.6.9";
25
26 duneVersion = "3";
27
28 src = fetchFromGitHub {
29 owner = "ocaml-community";
30 repo = pname;
31 rev = "v${version}";
32 sha256 = "sha256-NdN2QnVRfRq9hEcSAnO2Wha7icDlf2Zg4JQqoEWmErE=";
33 };
34
35 doCheck = true;
36
37 inherit meta;
38}
39
40else
41
42let version = "1.5.0"; in
43
44stdenv.mkDerivation {
45
46 name = "${pname}-${version}";
47
48 src = fetchFromGitHub {
49 owner = "mjambon";
50 repo = pname;
51 rev = "v${version}";
52 sha256 = "1xqldjz9risndnabvadw41fdbi5sa2hl4fnqls7j9xfbby1izbg8";
53 };
54
55 strictDeps = true;
56
57 nativeBuildInputs = [ ocaml findlib ocamlbuild ];
58
59 inherit meta;
60
61 createFindlibDestdir = true;
62
63 makeFlags = [ "PREFIX=$(out)" ];
64
65 preBuild = ''
66 mkdir -p $out/bin
67 '';
68
69}