ocamlPackages.jsont: flags to turn off optional dependencies

This commit is contained in:
·𐑑𐑴𐑕𐑑𐑩𐑤 2025-08-04 16:55:12 +07:00 committed by Vincent Laporte
parent 327e83ae65
commit 22ae0b20d0

View File

@ -1,9 +1,13 @@
{
lib,
fetchzip,
topkg,
buildTopkgPackage,
withBrr ? true,
brr,
withBytesrw ? true,
bytesrw,
withCmdliner ? true,
cmdliner,
}:
@ -18,17 +22,22 @@ buildTopkgPackage rec {
hash = "sha256-dXHl+bLuIrlrQ5Np37+uVuETFBb3j8XeDVEK9izoQFk=";
};
# docs say these dependendencies are optional, but buildTopkgPackage doesnt
# handle missing dependencies
buildInputs = lib.optional withCmdliner cmdliner;
buildInputs = [
cmdliner
];
propagatedBuildInputs = lib.optional withBrr brr ++ lib.optional withBytesrw bytesrw;
propagatedBuildInputs = [
brr
bytesrw
];
buildPhase = "${topkg.run} build ${
lib.escapeShellArgs [
"--with-brr"
(lib.boolToString withBrr)
"--with-bytesrw"
(lib.boolToString withBytesrw)
"--with-cmdliner"
(lib.boolToString withCmdliner)
]
}";
meta = {
description = "Declarative JSON data manipulation";