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 name = "ocaml${ocaml.version}-ocamlnet-${version}";
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 ];
19 buildInputs = [ ncurses ocaml findlib ocaml_pcre camlzip gnutls nettle ];
20
21 createFindlibDestdir = true;
22
23 dontAddPrefix = true;
24 dontAddStaticConfigureFlags = true;
25 configurePlatforms = [];
26
27 preConfigure = ''
28 configureFlagsArray=(
29 -bindir $out/bin
30 -enable-gnutls
31 -enable-zip
32 -enable-pcre
33 -disable-gtk2
34 -with-nethttpd
35 -datadir $out/lib/ocaml/${ocaml.version}/ocamlnet
36 )
37 '';
38
39 buildPhase = ''
40 make all
41 make opt
42 '';
43
44 meta = {
45 homepage = "http://projects.camlcity.org/projects/ocamlnet.html";
46 description = "A library implementing Internet protocols (http, cgi, email, etc.) for OCaml";
47 license = "Most Ocamlnet modules are released under the zlib/png license. The HTTP server module Nethttpd is, however, under the GPL.";
48 platforms = ocaml.meta.platforms or [];
49 maintainers = [
50 lib.maintainers.maggesi
51 ];
52 };
53}