2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, fetchzip, ocaml, findlib, dune, cppo, easy-format, biniou }:
|
2020-04-24 23:36:52 +00:00
|
|
|
let
|
|
|
|
pname = "yojson";
|
|
|
|
param =
|
2021-01-15 22:18:51 +00:00
|
|
|
if lib.versionAtLeast ocaml.version "4.02" then rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
version = "1.7.0";
|
|
|
|
url = "https://github.com/ocaml-community/yojson/releases/download/${version}/yojson-${version}.tbz";
|
|
|
|
sha256 = "08llz96if8bcgnaishf18si76cv11zbkni0aldb54k3cn7ipiqvd";
|
|
|
|
nativeBuildInputs = [ dune ];
|
2021-02-05 17:12:51 +00:00
|
|
|
extra = {
|
|
|
|
installPhase = ''
|
|
|
|
dune install --prefix $out --libdir $OCAMLFIND_DESTDIR ${pname}
|
|
|
|
'';
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
} else rec {
|
|
|
|
version = "1.2.3";
|
|
|
|
url = "https://github.com/ocaml-community/yojson/archive/v${version}.tar.gz";
|
|
|
|
sha256 = "10dvkndgwanvw4agbjln7kgb1n9s6lii7jw82kwxczl5rd1sgmvl";
|
|
|
|
extra = {
|
|
|
|
createFindlibDestdir = true;
|
|
|
|
|
|
|
|
makeFlags = [ "PREFIX=$(out)" ];
|
|
|
|
|
|
|
|
preBuild = "mkdir $out/bin";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation ({
|
|
|
|
|
|
|
|
name = "ocaml${ocaml.version}-${pname}-${param.version}";
|
|
|
|
|
|
|
|
src = fetchzip {
|
|
|
|
inherit (param) url sha256;
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ ocaml findlib ] ++ (param.nativeBuildInputs or []);
|
|
|
|
propagatedNativeBuildInputs = [ cppo ];
|
|
|
|
propagatedBuildInputs = [ easy-format biniou ];
|
|
|
|
configurePlatforms = [];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "An optimized parsing and printing library for the JSON format";
|
|
|
|
homepage = "https://github.com/ocaml-community/${pname}";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = [ maintainers.vbgl ];
|
|
|
|
platforms = ocaml.meta.platforms or [];
|
|
|
|
};
|
|
|
|
} // param.extra)
|