2021-02-25 08:12:26 +01:00
|
|
|
{ lib, stdenv, fetchzip, ocaml, findlib, dune_2, cppo, easy-format, biniou }:
|
2014-07-05 08:50:47 +02:00
|
|
|
let
|
|
|
|
pname = "yojson";
|
2017-10-22 08:18:32 +02:00
|
|
|
param =
|
2021-01-11 13:49:15 +01:00
|
|
|
if lib.versionAtLeast ocaml.version "4.02" then rec {
|
2019-03-11 07:21:09 +01:00
|
|
|
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";
|
2019-03-11 07:21:09 +01:00
|
|
|
sha256 = "08llz96if8bcgnaishf18si76cv11zbkni0aldb54k3cn7ipiqvd";
|
2021-02-25 08:12:26 +01:00
|
|
|
nativeBuildInputs = [ dune_2 ];
|
2021-01-12 20:37:25 +01:00
|
|
|
extra = {
|
|
|
|
installPhase = ''
|
|
|
|
dune install --prefix $out --libdir $OCAMLFIND_DESTDIR ${pname}
|
|
|
|
'';
|
|
|
|
};
|
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;
|
|
|
|
|
2019-10-27 14:03:25 +01:00
|
|
|
makeFlags = [ "PREFIX=$(out)" ];
|
2017-10-22 08:29:13 +02:00
|
|
|
|
|
|
|
preBuild = "mkdir $out/bin";
|
|
|
|
};
|
2017-10-22 08:18:32 +02:00
|
|
|
};
|
2014-07-05 08:50:47 +02:00
|
|
|
in
|
2017-10-22 08:29:13 +02:00
|
|
|
stdenv.mkDerivation ({
|
2014-07-05 08:50:47 +02:00
|
|
|
|
2017-10-22 08:18:32 +02:00
|
|
|
name = "ocaml${ocaml.version}-${pname}-${param.version}";
|
2014-07-05 08:50:47 +02:00
|
|
|
|
2015-11-30 18:07:36 +01:00
|
|
|
src = fetchzip {
|
2019-02-13 11:53:48 +01:00
|
|
|
inherit (param) url sha256;
|
2014-07-05 08:50:47 +02:00
|
|
|
};
|
|
|
|
|
2019-10-31 11:16:15 +01:00
|
|
|
nativeBuildInputs = [ ocaml findlib ] ++ (param.nativeBuildInputs or []);
|
|
|
|
propagatedNativeBuildInputs = [ cppo ];
|
|
|
|
propagatedBuildInputs = [ easy-format biniou ];
|
|
|
|
configurePlatforms = [];
|
2014-07-05 08:50:47 +02:00
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2014-07-05 08:50:47 +02:00
|
|
|
description = "An optimized parsing and printing library for the JSON format";
|
2019-11-16 01:41:23 +01:00
|
|
|
homepage = "https://github.com/ocaml-community/${pname}";
|
2014-09-21 12:02:55 +02:00
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = [ maintainers.vbgl ];
|
2015-12-24 18:49:07 +01:00
|
|
|
platforms = ocaml.meta.platforms or [];
|
2014-07-05 08:50:47 +02:00
|
|
|
};
|
2017-10-22 08:29:13 +02:00
|
|
|
} // param.extra)
|