about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/ocaml-modules/odoc/default.nix
blob: 43ec9da288349dd19484925c5ef05a2ae75d87cb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{ lib, fetchurl, buildDunePackage, ocaml
, astring, cmdliner, cppo, fpath, result, tyxml
, markup, yojson, sexplib0, jq
, odoc-parser, ppx_expect, bash, fmt
}:

buildDunePackage rec {
  pname = "odoc";
  version = "2.2.1";

  src = fetchurl {
    url = "https://github.com/ocaml/odoc/releases/download/${version}/odoc-${version}.tbz";
    sha256 = "sha256-F4blO/CCT+HHx7gdKn2EaEal0RZ3lp5jljYfd6OBaAM=";
  };

  nativeBuildInputs = [ cppo ];
  buildInputs = [ astring cmdliner fpath result tyxml odoc-parser fmt ];

  nativeCheckInputs = [ bash jq ];
  checkInputs = [ markup yojson sexplib0 jq ppx_expect ];
  doCheck = lib.versionAtLeast ocaml.version "4.08"
    && lib.versionOlder yojson.version "2.0";

  preCheck = ''
    # some run.t files check the content of patchShebangs-ed scripts, so patch
    # them as well
    find test \( -name '*.sh' -o -name 'run.t' \)  -execdir sed 's@#!/bin/sh@#!${bash}/bin/sh@' -i '{}' \;
    patchShebangs test
  '';

  meta = {
    description = "A documentation generator for OCaml";
    license = lib.licenses.isc;
    maintainers = [ lib.maintainers.vbgl ];
    homepage = "https://github.com/ocaml/odoc";
    changelog = "https://github.com/ocaml/odoc/blob/${version}/CHANGES.md";
  };
}