1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-14 16:46:09 +00:00
nixpkgs/pkgs/development/ocaml-modules/yojson/default.nix

49 lines
1.5 KiB
Nix
Raw Normal View History

2021-02-25 07:12:26 +00:00
{ lib, stdenv, fetchzip, ocaml, findlib, dune_2, cppo, easy-format, biniou }:
let
pname = "yojson";
2017-10-22 07:18:32 +01:00
param =
if lib.versionAtLeast ocaml.version "4.02" then rec {
version = "1.7.0";
2019-02-13 10:53:48 +00:00
url = "https://github.com/ocaml-community/yojson/releases/download/${version}/yojson-${version}.tbz";
sha256 = "08llz96if8bcgnaishf18si76cv11zbkni0aldb54k3cn7ipiqvd";
2021-02-25 07:12:26 +00:00
nativeBuildInputs = [ dune_2 ];
extra = {
installPhase = ''
dune install --prefix $out --libdir $OCAMLFIND_DESTDIR ${pname}
'';
};
2019-02-13 10:53:48 +00:00
} else rec {
2017-10-22 07:18:32 +01:00
version = "1.2.3";
2019-02-13 10:53:48 +00:00
url = "https://github.com/ocaml-community/yojson/archive/v${version}.tar.gz";
2017-10-22 07:18:32 +01:00
sha256 = "10dvkndgwanvw4agbjln7kgb1n9s6lii7jw82kwxczl5rd1sgmvl";
2017-10-22 07:29:13 +01:00
extra = {
createFindlibDestdir = true;
makeFlags = [ "PREFIX=$(out)" ];
2017-10-22 07:29:13 +01:00
preBuild = "mkdir $out/bin";
};
2017-10-22 07:18:32 +01:00
};
in
2017-10-22 07:29:13 +01:00
stdenv.mkDerivation ({
2017-10-22 07:18:32 +01:00
name = "ocaml${ocaml.version}-${pname}-${param.version}";
2015-11-30 17:07:36 +00:00
src = fetchzip {
2019-02-13 10:53:48 +00:00
inherit (param) url sha256;
};
nativeBuildInputs = [ ocaml findlib ] ++ (param.nativeBuildInputs or []);
propagatedNativeBuildInputs = [ cppo ];
propagatedBuildInputs = [ easy-format biniou ];
configurePlatforms = [];
meta = with lib; {
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 [];
};
2017-10-22 07:29:13 +01:00
} // param.extra)