nixpkgs-suyu/pkgs/development/ocaml-modules/yojson/default.nix

44 lines
1.3 KiB
Nix
Raw Normal View History

2018-09-05 18:11:47 +02:00
{ stdenv, fetchzip, ocaml, findlib, dune, cppo, easy-format, biniou }:
let
pname = "yojson";
2017-10-22 08:18:32 +02:00
param =
2019-02-13 11:53:48 +01:00
if stdenv.lib.versionAtLeast ocaml.version "4.02" then rec {
version = "1.7.0";
2019-02-13 11:53:48 +01:00
url = "https://github.com/ocaml-community/yojson/releases/download/${version}/yojson-${version}.tbz";
sha256 = "08llz96if8bcgnaishf18si76cv11zbkni0aldb54k3cn7ipiqvd";
2018-09-05 18:11:47 +02:00
buildInputs = [ dune ];
extra = { inherit (dune) installPhase; };
2019-02-13 11:53:48 +01:00
} else rec {
2017-10-22 08:18:32 +02:00
version = "1.2.3";
2019-02-13 11:53:48 +01:00
url = "https://github.com/ocaml-community/yojson/archive/v${version}.tar.gz";
2017-10-22 08:18:32 +02:00
sha256 = "10dvkndgwanvw4agbjln7kgb1n9s6lii7jw82kwxczl5rd1sgmvl";
2017-10-22 08:29:13 +02:00
extra = {
createFindlibDestdir = true;
makeFlags = "PREFIX=$(out)";
preBuild = "mkdir $out/bin";
};
2017-10-22 08:18:32 +02:00
};
in
2017-10-22 08:29:13 +02:00
stdenv.mkDerivation ({
2017-10-22 08:18:32 +02:00
name = "ocaml${ocaml.version}-${pname}-${param.version}";
2015-11-30 18:07:36 +01:00
src = fetchzip {
2019-02-13 11:53:48 +01:00
inherit (param) url sha256;
};
2019-02-13 11:53:48 +01:00
buildInputs = [ ocaml findlib ] ++ (param.buildInputs or []);
propagatedBuildInputs = [ cppo easy-format biniou ];
meta = with stdenv.lib; {
description = "An optimized parsing and printing library for the JSON format";
2015-11-30 18:07:36 +01:00
homepage = "http://mjambon.com/${pname}.html";
license = licenses.bsd3;
maintainers = [ maintainers.vbgl ];
platforms = ocaml.meta.platforms or [];
};
2017-10-22 08:29:13 +02:00
} // param.extra)