summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/expat/default.nix
blob: b2702a5cade6f63a0ae05fd4cbc00d3809f7074d (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
48
49
50
51
{stdenv, fetchurl, ocaml, findlib, ounit, expat}:

let
  ocaml_version = (builtins.parseDrvName ocaml.name).version;
  version = "0.9.1";
  pname = "ocaml-expat";
  testcase = fetchurl {
    url = "http://www.w3.org/TR/1998/REC-xml-19980210.xml";
    sha256 = "00a3gsfvlkdhmcbziqhvpvy1zmcgbcihfqwcvl6ay03zf7gvw0k1";
  };

in

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

  src = fetchurl {
    url = "http://www.xs4all.nl/~mmzeeman/ocaml/${pname}-${version}.tar.gz";
    sha256 = "16n2j3y0jc9xgqyshw9plrwqnjiz30vnpbhahmgxlidbycw8rgjz";
  };

  buildInputs = [ocaml findlib ounit expat];

  createFindlibDestdir = true;

  patches = [ ./unittest.patch ];

  postPatch = ''
    substituteInPlace "unittest.ml" \
      --replace "/home/maas/xml-samples/REC-xml-19980210.xml.txt" "${testcase}"
    substituteInPlace Makefile --replace "EXPAT_LIBDIR=/usr/local/lib" "EXPAT_LIBDIR=${expat}/lib" \
    substituteInPlace Makefile --replace "EXPAT_INCDIR=/usr/local/include" "EXPAT_INCDIR=${expat}/include" \
  '';

  configurePhase = "true";  	# Skip configure

  buildPhase = ''
    make all allopt
  '';

  doCheck = true;

  checkTarget = "testall";

  meta = {
    homepage = http://www.xs4all.nl/~mmzeeman/ocaml/;
    description = "An ocaml wrapper for the Expat XML parsing library";
    license = "MIT/X11";
    maintainers = [ stdenv.lib.maintainers.roconnor ];
  };
}