about summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/cryptokit/default.nix
blob: 1c7e361f3fc304aa01cf3c424bdaf46bf107f767 (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
39
40
41
42
43
{stdenv, fetchurl, zlib, ocaml}:

let
  ocaml_version = (builtins.parseDrvName ocaml.name).version;
  version = "1.3";
in

stdenv.mkDerivation {
  name = "cryptokit-${version}";

  src = fetchurl {
    url = "http://forge.ocamlcore.org/frs/download.php/326/" +
          "cryptokit-${version}.tar.gz";
    sha256 = "0kqrlxkpzrj2qpniy6mhn7gx3n29s86vk4q0im2hqpxi9knkkwwy";
  };

  buildInputs = [zlib ocaml];

  patches = [ ./makefile.patch ];

  configurePhase = ''
    export INSTALLDIR="$out/lib/ocaml/${ocaml_version}/site-lib/cryptokit"
    substituteInPlace Makefile \
      --subst-var-by ZLIB_LIBDIR "${zlib}/lib" \
      --subst-var-by ZLIB_INCLUDE "${zlib}/include" \
      --subst-var INSTALLDIR 
  '';

  buildFlags = "all allopt";

  doCheck = true;
  
  checkTarget = "test";

  preInstall = "ensureDir $INSTALLDIR";

  postInstall = "cp -a ${./META} $INSTALLDIR/META";

  meta = {
    homepage = "http://pauillac.inria.fr/~xleroy/software.html";
    description = "A library of cryptographic primitives for OCaml";
  };
}