1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 ocaml,
7 findlib,
8 ncurses,
9 cmdliner_1_0,
10 re,
11}:
12
13lib.throwIf (lib.versionAtLeast ocaml.version "5.0")
14 "ocp-build is not available for OCaml ${ocaml.version}"
15
16 stdenv.mkDerivation
17 rec {
18 pname = "ocaml${ocaml.version}-ocp-build";
19 version = "1.99.21";
20
21 src = fetchFromGitHub {
22 owner = "OCamlPro";
23 repo = "ocp-build";
24 rev = "v${version}";
25 sha256 = "1641xzik98c7xnjwxpacijd6d9jzx340fmdn6i372z8h554jjlg9";
26 };
27
28 patches = [
29 # Fix compilation with OCaml 4.12
30 (fetchpatch {
31 url = "https://github.com/OCamlPro/ocp-build/commit/104e4656ca6dba9edb03b62539c9f1e10abcaae8.patch";
32 sha256 = "0sbyi4acig9q8x1ky4hckfg5pm2nad6zasi51ravaf1spgl148c2";
33 })
34 ];
35
36 strictDeps = true;
37
38 nativeBuildInputs = [
39 ocaml
40 findlib
41 ];
42 buildInputs = [
43 cmdliner_1_0
44 re
45 ];
46 propagatedBuildInputs = [ ncurses ];
47 preInstall = "mkdir -p $out/bin";
48
49 meta = with lib; {
50 description = "Build tool for OCaml";
51 longDescription = ''
52 ocp-build is a build system for OCaml application, based on simple
53 descriptions of packages. ocp-build combines the descriptions of
54 packages, and optimize the parallel compilation of files depending on
55 the number of cores and the automatically-inferred dependencies
56 between source files.
57 '';
58 homepage = "https://www.typerex.org/ocp-build.html";
59 license = licenses.gpl3;
60 maintainers = [ maintainers.jirkamarsik ];
61 mainProgram = "ocp-build";
62 inherit (ocaml.meta) platforms;
63 };
64 }