ocamlPackages.bytesrw: 0.2.0 → 0.3.0

This commit is contained in:
·𐑑𐑴𐑕𐑑𐑩𐑤
2026-05-08 01:05:27 +07:00
parent 1bec3cc3ad
commit 092dfcc0dd
@@ -1,35 +1,75 @@
{
lib,
fetchzip,
libblake3,
libmd,
xxhash,
zlib,
zstd,
topkg,
buildTopkgPackage,
withBlake3 ? true,
libblake3,
withLibmd ? true,
libmd,
withMbedtls ? true,
mbedtls_4,
withXxh ? true,
xxhash,
withZlib ? true,
zlib,
withZstd ? true,
zstd,
withCmdliner ? false,
cmdliner,
}:
buildTopkgPackage rec {
pname = "bytesrw";
version = "0.2.0";
version = "0.3.0";
minimalOCamlVersion = "4.14.0";
src = fetchzip {
url = "https://erratique.ch/software/bytesrw/releases/bytesrw-${version}.tbz";
hash = "sha256-DMQXclJV5uz/2a6XVHVnBkYgXpGRI83uzmzeed3fDxQ=";
hash = "sha256-EFdHKBH4VrWvOqs+I6tiRW9D2s6lY8Pol4YyuB7fqh8=";
};
# docs say these are optional, but buildTopkgPackage doesnt handle missing
# dependencies
buildInputs =
lib.optional withBlake3 libblake3
++ lib.optional withLibmd libmd
++ lib.optional withMbedtls mbedtls_4
++ lib.optional withXxh xxhash
++ lib.optional withZlib zlib
++ lib.optional withZstd zstd
++ lib.optional withCmdliner cmdliner;
buildInputs = [
libblake3
libmd
xxhash
zlib
zstd
];
# certown is a CA utility that uses missing b0 APIs (Os.name, Os.Name).
# …but this is only need if enabling Cmdliner
postPatch = lib.optionalString withCmdliner ''
substituteInPlace pkg/pkg.ml --replace-fail \
'Pkg.bin ~cond:(b0 && cmdliner && mbedtls) "test/certown";' ""
'';
buildPhase = "${topkg.run} build ${
lib.escapeShellArgs [
"--with-conf-libblake3"
(lib.boolToString withBlake3)
"--with-conf-libmd"
(lib.boolToString withLibmd)
"--with-conf-mbedtls"
(lib.boolToString withMbedtls)
"--with-conf-xxhash"
(lib.boolToString withXxh)
"--with-conf-zlib"
(lib.boolToString withZlib)
"--with-conf-zstd"
(lib.boolToString withZstd)
"--with-cmdliner"
(lib.boolToString withCmdliner)
]
}";
meta = {
description = "Composable, memory efficient, byte stream readers and writers compatible with effect-based concurrency";
@@ -37,8 +77,8 @@ buildTopkgPackage rec {
Bytesrw extends the OCaml Bytes module with composable, memory efficient,
byte stream readers and writers compatible with effect-based concurrency.
Except for byte slice life-times, these abstractions intentionnaly
separate away ressource management and the specifics of reading and
Except for byte slice life-times, these abstractions intentionally
separate away resource management and the specifics of reading and
writing bytes.
'';
homepage = "https://erratique.ch/software/bytesrw";