@@ -1,51 +1,32 @@
1−{stdenv, fetchurl, ocaml, findlib, ounit, expat}:
2−
3−let
4− pname = "ocaml-expat";
5− testcase = fetchurl {
6− url = "http://www.w3.org/TR/1998/REC-xml-19980210.xml";
7− sha256 = "00a3gsfvlkdhmcbziqhvpvy1zmcgbcihfqwcvl6ay03zf7gvw0k1";
8− };
9−
10−in
1+{ stdenv, fetchFromGitHub, expat, ocaml, findlib, ounit }:
112
123stdenv.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− };
4+ name = "ocaml${ocaml.version}-expat-${version}";
5+ version = "1.0.0";
6+
7+ src = fetchFromGitHub {
8+ owner = "whitequark";
9+ repo = "ocaml-expat";
10+ rev = "v${version}";
11+ sha256 = "0rb47v08ra2hhh73p3d8sl4sizqwiwc37gnkl22b23sbwbjrpbz0";
12+ };
13+
14+ prePatch = ''
15+ substituteInPlace Makefile --replace "gcc" "\$(CC)"
16+ '';
17+
18+ buildInputs = [ ocaml findlib expat ounit ];
19+
20+ doCheck = !stdenv.lib.versionAtLeast ocaml.version "4.06";
21+ checkTarget = "testall";
22+
23+ createFindlibDestdir = true;
24+
25+ meta = {
26+ description = "OCaml wrapper for the Expat XML parsing library";
27+ license = stdenv.lib.licenses.mit;
28+ maintainers = [ stdenv.lib.maintainers.vbgl ];
29+ inherit (src.meta) homepage;
30+ inherit (ocaml.meta) platforms;
31+ };
5132}