1{stdenv, fetchurl, ocaml, findlib, ounit, expat}:
2
3let
4 pname = "ocaml-expat";
5 testcase = fetchurl {
6 url = "http://www.w3.org/TR/1998/REC-xml-19980210.xml";
7 sha256 = "00a3gsfvlkdhmcbziqhvpvy1zmcgbcihfqwcvl6ay03zf7gvw0k1";
8 };
9
10in
11
12stdenv.mkDerivation rec {
13 name = "${pname}-${version}";
14 version = "0.9.1";
15
16 src = fetchurl {
17 url = "http://www.xs4all.nl/~mmzeeman/ocaml/${pname}-${version}.tar.gz";
18 sha256 = "16n2j3y0jc9xgqyshw9plrwqnjiz30vnpbhahmgxlidbycw8rgjz";
19 };
20
21 buildInputs = [ocaml findlib ounit expat];
22
23 createFindlibDestdir = true;
24
25 patches = [ ./unittest.patch ];
26
27 postPatch = ''
28 substituteInPlace "unittest.ml" \
29 --replace "/home/maas/xml-samples/REC-xml-19980210.xml.txt" "${testcase}"
30 substituteInPlace Makefile --replace "EXPAT_LIBDIR=/usr/local/lib" "EXPAT_LIBDIR=${expat.out}/lib" \
31 --replace "EXPAT_INCDIR=/usr/local/include" "EXPAT_INCDIR=${expat.dev}/include" \
32 --replace "gcc" "\$(CC)"
33 '';
34
35 configurePhase = "true"; # Skip configure
36
37 buildPhase = ''
38 make all allopt
39 '';
40
41 doCheck = true;
42
43 checkTarget = "testall";
44
45 meta = {
46 homepage = http://www.xs4all.nl/~mmzeeman/ocaml/;
47 description = "An ocaml wrapper for the Expat XML parsing library";
48 license = stdenv.lib.licenses.mit;
49 maintainers = [ stdenv.lib.maintainers.roconnor ];
50 };
51}