2021-01-23 12:26:19 +00:00
|
|
|
{ lib, stdenv, fetchurl, fetchFromGitHub, ocaml, findlib, ocamlbuild
|
2020-12-22 16:52:15 +00:00
|
|
|
, buildDunePackage
|
|
|
|
}:
|
|
|
|
|
2014-06-25 09:25:14 +01:00
|
|
|
let
|
|
|
|
pname = "cppo";
|
2020-12-22 16:52:15 +00:00
|
|
|
|
2021-01-23 12:26:19 +00:00
|
|
|
meta = with lib; {
|
2020-12-22 16:52:15 +00:00
|
|
|
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
|
2018-06-24 23:47:53 +01:00
|
|
|
|
2021-01-23 12:26:19 +00:00
|
|
|
if lib.versionAtLeast ocaml.version "4.02" then
|
2020-12-22 16:52:15 +00:00
|
|
|
|
|
|
|
buildDunePackage rec {
|
|
|
|
inherit pname;
|
|
|
|
version = "1.6.7";
|
|
|
|
|
|
|
|
useDune2 = true;
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/ocaml-community/cppo/releases/download/v${version}/cppo-v${version}.tbz";
|
|
|
|
sha256 = "17ajdzrnmnyfig3s6hinb56mcmhywbssxhsq32dz0v90dhz3wmfv";
|
|
|
|
};
|
|
|
|
|
|
|
|
doCheck = true;
|
2018-06-24 23:47:53 +01:00
|
|
|
|
2020-12-22 16:52:15 +00:00
|
|
|
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 {
|
2020-01-04 14:00:00 +00:00
|
|
|
owner = "mjambon";
|
2016-05-22 16:22:25 +01:00
|
|
|
repo = pname;
|
2020-12-22 16:52:15 +00:00
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "1xqldjz9risndnabvadw41fdbi5sa2hl4fnqls7j9xfbby1izbg8";
|
2014-06-25 09:25:14 +01:00
|
|
|
};
|
|
|
|
|
2020-12-22 16:52:15 +00:00
|
|
|
buildInputs = [ ocaml findlib ocamlbuild ];
|
2014-06-25 09:25:14 +01:00
|
|
|
|
2020-12-22 16:52:15 +00:00
|
|
|
inherit meta;
|
|
|
|
|
|
|
|
createFindlibDestdir = true;
|
|
|
|
|
|
|
|
makeFlags = [ "PREFIX=$(out)" ];
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
mkdir $out/bin
|
|
|
|
'';
|
|
|
|
|
|
|
|
}
|