1{ stdenv, lib, fetchurl, pkg-config, which, ncurses, ocaml, findlib, ocaml_pcre, camlzip
2, gnutls, nettle
3}:
4
5if lib.versionOlder ocaml.version "4.02"
6then throw "ocamlnet is not available for OCaml ${ocaml.version}"
7else
8
9stdenv.mkDerivation rec {
10 pname = "ocaml${ocaml.version}-ocamlnet";
11 version = "4.1.9";
12
13 src = fetchurl {
14 url = "http://download.camlcity.org/download/ocamlnet-${version}.tar.gz";
15 sha256 = "1vlwxjxr946gdl61a1d7yk859cijq45f60dhn54ik3w4g6cx33pr";
16 };
17
18 nativeBuildInputs = [ pkg-config which ocaml findlib ];
19 buildInputs = [ ncurses ocaml_pcre camlzip gnutls nettle ];
20
21 strictDeps = true;
22
23 createFindlibDestdir = true;
24
25 dontAddPrefix = true;
26 dontAddStaticConfigureFlags = true;
27 configurePlatforms = [];
28
29 preConfigure = ''
30 configureFlagsArray=(
31 -bindir $out/bin
32 -enable-gnutls
33 -enable-zip
34 -enable-pcre
35 -disable-gtk2
36 -with-nethttpd
37 -datadir $out/lib/ocaml/${ocaml.version}/ocamlnet
38 )
39 '';
40
41 buildPhase = ''
42 make all
43 make opt
44 '';
45
46 meta = {
47 homepage = "http://projects.camlcity.org/projects/ocamlnet.html";
48 description = "A library implementing Internet protocols (http, cgi, email, etc.) for OCaml";
49 license = "Most Ocamlnet modules are released under the zlib/png license. The HTTP server module Nethttpd is, however, under the GPL.";
50 inherit (ocaml.meta) platforms;
51 maintainers = [
52 lib.maintainers.maggesi
53 ];
54 };
55}