2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, which, ocaml, findlib }:
|
2019-09-23 19:55:47 +00:00
|
|
|
|
2021-01-11 12:49:15 +00:00
|
|
|
if !lib.versionAtLeast ocaml.version "4.02"
|
2019-09-23 19:55:47 +00:00
|
|
|
then throw "camlpdf is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
2014-11-16 08:42:55 +00:00
|
|
|
|
2014-12-31 11:21:55 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-08-20 05:17:45 +00:00
|
|
|
version = "2.3.1";
|
2017-01-20 06:36:44 +00:00
|
|
|
name = "ocaml${ocaml.version}-camlpdf-${version}";
|
2019-09-23 19:55:47 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "johnwhitington";
|
|
|
|
repo = "camlpdf";
|
|
|
|
rev = "v${version}";
|
2020-08-20 05:17:45 +00:00
|
|
|
sha256 = "1q69hhk63z836jbkv4wsng27w35w0qpz01c7ax0mqm8d8kmnr0v4";
|
2014-11-16 08:42:55 +00:00
|
|
|
};
|
|
|
|
|
2020-08-20 05:17:40 +00:00
|
|
|
buildInputs = [ which ocaml findlib ];
|
2014-11-16 08:42:55 +00:00
|
|
|
|
|
|
|
# Version number in META file is wrong
|
|
|
|
patchPhase = ''
|
|
|
|
patch -p 0 META <<EOF
|
|
|
|
3c3
|
|
|
|
< version="1.7.1"
|
|
|
|
---
|
2014-12-31 11:21:55 +00:00
|
|
|
> version="${version}"
|
2014-11-16 08:42:55 +00:00
|
|
|
EOF
|
|
|
|
'';
|
|
|
|
|
2020-08-20 05:17:40 +00:00
|
|
|
preInstall = ''
|
|
|
|
mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/stublibs
|
|
|
|
'';
|
2014-11-16 08:42:55 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2014-11-16 08:42:55 +00:00
|
|
|
description = "An OCaml library for reading, writing and modifying PDF files";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/johnwhitington/camlpdf";
|
2014-11-16 08:42:55 +00:00
|
|
|
license = licenses.lgpl21Plus;
|
|
|
|
maintainers = with maintainers; [vbgl];
|
|
|
|
};
|
|
|
|
}
|