about summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/xmlm/default.nix
blob: 9d3a0b1bb4d02b7d61971458f7b21883cd5b96f4 (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, ocamlbuild, topkg }:
let
  pname = "xmlm";
  webpage = "http://erratique.ch/software/${pname}";
in

assert stdenv.lib.versionAtLeast ocaml.version "3.12";

let param =
  if stdenv.lib.versionAtLeast ocaml.version "4.02"
  then {
    version = "1.3.0";
    sha256 = "1rrdxg5kh9zaqmgapy9bhdqyxbbvxxib3bdfg1vhw4rrkp1z0x8n";
    buildInputs = [ topkg ];
    inherit (topkg) buildPhase;
  } else {
    version = "1.2.0";
    sha256 = "1jywcrwn5z3gkgvicr004cxmdaqfmq8wh72f81jqz56iyn5024nh";
    buildInputs = [];
    buildPhase = "./pkg/build true";
  };
in

stdenv.mkDerivation rec {
  name = "ocaml-${pname}-${version}";
  inherit (param) version;

  src = fetchurl {
    url = "${webpage}/releases/${pname}-${version}.tbz";
    inherit (param) sha256;
  };

  buildInputs = [ ocaml findlib ocamlbuild ] ++ param.buildInputs;

  unpackCmd = "tar xjf $src";

  inherit (param) buildPhase;
  inherit (topkg) installPhase;

  meta = with stdenv.lib; {
    description = "An OCaml streaming codec to decode and encode the XML data format";
    homepage = "${webpage}";
    platforms = ocaml.meta.platforms or [];
    maintainers = [ maintainers.vbgl ];
    license = licenses.bsd3;
  };
}