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