1{stdenv, fetchurl, ocaml, findlib, ounit, expat}:
2
3let
4 ocaml_version = (builtins.parseDrvName ocaml.name).version;
5 version = "0.9.1";
6 pname = "ocaml-expat";
7 testcase = fetchurl {
8 url = "http://www.w3.org/TR/1998/REC-xml-19980210.xml";
9 sha256 = "00a3gsfvlkdhmcbziqhvpvy1zmcgbcihfqwcvl6ay03zf7gvw0k1";
10 };
11
12in
13
14stdenv.mkDerivation {
15 name = "${pname}-${version}";
16
17 src = fetchurl {
18 url = "http://www.xs4all.nl/~mmzeeman/ocaml/${pname}-${version}.tar.gz";
19 sha256 = "16n2j3y0jc9xgqyshw9plrwqnjiz30vnpbhahmgxlidbycw8rgjz";
20 };
21
22 buildInputs = [ocaml findlib ounit expat];
23
24 createFindlibDestdir = true;
25
26 patches = [ ./unittest.patch ];
27
28 postPatch = ''
29 substituteInPlace "unittest.ml" \
30 --replace "/home/maas/xml-samples/REC-xml-19980210.xml.txt" "${testcase}"
31 substituteInPlace Makefile --replace "EXPAT_LIBDIR=/usr/local/lib" "EXPAT_LIBDIR=${expat}/lib" \
32 substituteInPlace Makefile --replace "EXPAT_INCDIR=/usr/local/include" "EXPAT_INCDIR=${expat}/include" \
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}