nixpkgs/pkgs/development/tools/ocaml/cppo/default.nix

68 lines
1.2 KiB
Nix
Raw Normal View History

2021-10-20 14:40:02 +01:00
{ lib, stdenv, fetchFromGitHub, ocaml, findlib, ocamlbuild
, buildDunePackage
}:
2014-06-25 09:25:14 +01:00
let
pname = "cppo";
meta = with lib; {
description = "The C preprocessor for OCaml";
longDescription = ''
Cppo is an equivalent of the C preprocessor targeted at the OCaml language and its variants.
'';
homepage = "https://github.com/ocaml-community/${pname}";
maintainers = [ maintainers.vbgl ];
license = licenses.bsd3;
};
2014-06-25 09:25:14 +01:00
in
if lib.versionAtLeast ocaml.version "4.02" then
buildDunePackage rec {
inherit pname;
2021-10-20 14:40:02 +01:00
version = "1.6.8";
useDune2 = true;
2021-10-20 14:40:02 +01:00
src = fetchFromGitHub {
owner = "ocaml-community";
repo = pname;
rev = "v${version}";
sha256 = "sha256:0xjb1dnj8lvdcccskrhrakknd9q4vfy5330sjbqpf4h95dsz90k9";
};
doCheck = true;
inherit meta;
}
else
let version = "1.5.0"; in
stdenv.mkDerivation {
name = "${pname}-${version}";
2014-06-25 09:25:14 +01:00
2016-05-22 16:22:25 +01:00
src = fetchFromGitHub {
owner = "mjambon";
2016-05-22 16:22:25 +01:00
repo = pname;
rev = "v${version}";
sha256 = "1xqldjz9risndnabvadw41fdbi5sa2hl4fnqls7j9xfbby1izbg8";
2014-06-25 09:25:14 +01:00
};
buildInputs = [ ocaml findlib ocamlbuild ];
2014-06-25 09:25:14 +01:00
inherit meta;
createFindlibDestdir = true;
makeFlags = [ "PREFIX=$(out)" ];
preBuild = ''
mkdir $out/bin
'';
}