Merge pull request #119126 from fabaff/pycomfoconnect
[NixPkgs.git] / pkgs / development / ocaml-modules / bolt / default.nix
blob54bc28697ec47c73292bc43565130fb43b97ab3b
1 { lib, stdenv, fetchurl, fetchpatch, ocaml, findlib, ocamlbuild, which, camlp4 }:
3 let inherit (lib) getVersion versionAtLeast; in
5 assert versionAtLeast (getVersion ocaml) "4.00.0";
6 assert versionAtLeast (getVersion findlib) "1.3.3";
8 if versionAtLeast ocaml.version "4.06"
9 then throw "bolt is not available for OCaml ${ocaml.version}"
10 else
12 stdenv.mkDerivation rec {
14   name = "bolt-1.4";
16   src = fetchurl {
17     url = "https://forge.ocamlcore.org/frs/download.php/1043/${name}.tar.gz";
18     sha256 = "1c807wrpxra9sbb34lajhimwra28ldxv04m570567lh2b04n38zy";
19   };
21   buildInputs = [ ocaml findlib ocamlbuild which camlp4 ];
23   patches = [ (fetchpatch {
24       url = "https://raw.githubusercontent.com/ocaml/opam-repository/master/packages/bolt/bolt.1.4/files/opam.patch";
25       sha256 = "08cl39r98w312sw23cskd5wian6zg20isn9ki41hnbcgkazhi7pb";
26     })
27   ];
29   postPatch = ''
30     patch myocamlbuild.ml <<EOF
31 70,74c70
32 <         let camlp4of =
33 <           try
34 <             let path_bin = Filename.concat (Sys.getenv "PATH_OCAML_PREFIX") "bin" in
35 <             Filename.concat path_bin "camlp4of"
36 <           with _ -> "camlp4of" in
37 ---
38 >         let camlp4of = "camlp4of" in
39 EOF
40   '';
42   # The custom `configure` script does not expect the --prefix
43   # option. Installation is handled by ocamlfind.
44   dontAddPrefix = true;
46   createFindlibDestdir = true;
48   buildFlags = [ "all" ];
50   doCheck = true;
51   checkTarget = "tests";
53   meta = with lib; {
54     homepage = "http://bolt.x9c.fr";
55     description = "A logging tool for the OCaml language";
56     longDescription = ''
57       Bolt is a logging tool for the OCaml language. It is inspired by and
58       modeled after the famous log4j logging framework for Java.
59     '';
60     license = licenses.lgpl3;
61     platforms = ocaml.meta.platforms or [];
62     maintainers = [ maintainers.jirkamarsik ];
63   };