summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/camlpdf/default.nix
blob: e1e213eca788ecdef6360e81d7e8514fdcf68fe7 (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
{ stdenv, fetchFromGitHub, ocaml, findlib }:

if !stdenv.lib.versionAtLeast ocaml.version "4.02"
then throw "camlpdf is not available for OCaml ${ocaml.version}"
else

stdenv.mkDerivation rec {
  version = "2.3";
  name = "ocaml${ocaml.version}-camlpdf-${version}";
  src = fetchFromGitHub {
    owner = "johnwhitington";
    repo = "camlpdf";
    rev = "v${version}";
    sha256 = "1z8h6bjzmlscr6h6kdvzj8kspifb4n9dg7zi54z1cv2qi03kr8dk";
  };

  buildInputs = [ ocaml findlib ];

  # Version number in META file is wrong
  patchPhase = ''
    patch -p 0 META <<EOF
    3c3
    < version="1.7.1"
    ---
    > version="${version}"
    EOF
  '';

  createFindlibDestdir = true;

  meta = with stdenv.lib; {
    description = "An OCaml library for reading, writing and modifying PDF files";
    homepage = https://github.com/johnwhitington/camlpdf;
    license = licenses.lgpl21Plus;
    maintainers = with maintainers; [vbgl];
  };
}