git.iko.soy/typeable/nixpkgs
on master help sign in
ocamlPackages.cppo: 1.6.{5,6} → 1.6.7

ocamlPackages.cppo_ocamlbuild: init at 1.6.7

commitac02f26980ffc6a84844943cb2c303662225543a authorVincent Laporte <Vincent.Laporte@gmail.com> dateTue 22 Dec 2020, 17:52 (6 years ago) parent2235f1b
3 files changed+72−44
pkgs/development/tools/ocaml/cppo/default.nix+53−44 pkgs/development/tools/ocaml/cppo/ocamlbuild.nix+17 pkgs/top-level/ocaml-packages.nix+2
pkgs/development/tools/ocaml/cppo/default.nix+53−44
@@ -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+}
pkgs/development/tools/ocaml/cppo/ocamlbuild.nixnew file+17
@@ -0,0 +1,17 @@
1+{ lib, buildDunePackage, cppo, ocamlbuild }:
2+
3+if !lib.versionAtLeast (lib.getVersion cppo) "1.6"
4+then cppo
5+else
6+
7+buildDunePackage rec {
8+ pname = "cppo_ocamlbuild";
9+
10+ inherit (cppo) version useDune2 src;
11+
12+ propagatedBuildInputs = [ ocamlbuild ];
13+
14+ meta = cppo.meta // {
15+ description = "Plugin to use cppo with ocamlbuild";
16+ };
17+}
pkgs/top-level/ocaml-packages.nix+2
@@ -161,6 +161,8 @@ let
161161
162162 cppo = callPackage ../development/tools/ocaml/cppo { };
163163
164+ cppo_ocamlbuild = callPackage ../development/tools/ocaml/cppo/ocamlbuild.nix { };
165+
164166 cpu = callPackage ../development/ocaml-modules/cpu { };
165167
166168 cpuid = callPackage ../development/ocaml-modules/cpuid { };