summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/mysql/default.nix
blob: 4ffef60c4bfcd8e5435dde20dc3c96548651cbb9 (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
44
45
46
47
{stdenv, fetchurl, ocaml, findlib, mysql}:

# TODO: la versione stabile da' un errore di compilazione dovuto a
# qualche cambiamento negli header .h
# TODO: compilazione di moduli dipendenti da zip, ssl, tcl, gtk, gtk2

let
  ocaml_version = (builtins.parseDrvName ocaml.name).version;
  pname = "ocaml-mysql";
  version = "1.1.1";
in

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

  src = fetchurl {
    url = "https://forge.ocamlcore.org/frs/download.php/870/${pname}-${version}.tar.gz";
    sha256 = "f896fa101a05d81b85af8122fe1c2809008a5e5fdca00f9ceeb7eec356369e3a";
  };

  configureFlags = [ 
     "--prefix=$out" 
     "--libdir=$out/lib/ocaml/${ocaml_version}/site-lib/mysql"
  ];

  buildInputs = [ocaml findlib mysql.lib ];

  createFindlibDestdir = true;

  propagatedbuildInputs = [ mysql.lib ];

  preConfigure = ''
    export LDFLAGS="-L${mysql.lib}/lib/mysql"
  '';

  buildPhase = ''
    make
    make opt
  '';

  meta = {
    homepage = http://ocaml-mysql.forge.ocamlcore.org;
    description = "Bindings for interacting with MySQL databases from ocaml";
    license = stdenv.lib.licenses.lgpl21Plus;
    maintainers = [ stdenv.lib.maintainers.roconnor ];
  };
}