ocamlPackages.checkseum: init at 0.0.3

Chekseum is an OCaml library which implements ADLER-32 and CRC32C Cyclic
Redundancy Check. It provides 2 implementation, the first in C and the
second in OCaml.

Homepage: https://github.com/mirage/checkseum
This commit is contained in:
Vincent Laporte 2018-11-04 06:49:33 +00:00 committed by Vincent Laporte
parent e9b43adab7
commit 1a04bd4414
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,39 @@
{ stdenv, fetchurl, ocaml, findlib, dune, alcotest, cmdliner, fmt, optint, rresult }:
if !stdenv.lib.versionAtLeast ocaml.version "4.03"
then throw "checkseum is not available for OCaml ${ocaml.version}"
else
# The C implementation is not portable: x86 only
let hasC = stdenv.isi686 || stdenv.isx86_64; in
stdenv.mkDerivation rec {
version = "0.0.3";
name = "ocaml${ocaml.version}-checkseum-${version}";
src = fetchurl {
url = "https://github.com/mirage/checkseum/releases/download/v0.0.3/checkseum-v0.0.3.tbz";
sha256 = "12j45zsvil1ynwx1x8fbddhqacc8r1zf7f6h576y3f3yvbg7l1fm";
};
postPatch = stdenv.lib.optionalString (!hasC) ''
rm -r bin src-c
'';
buildInputs = [ ocaml findlib dune alcotest cmdliner fmt rresult ];
propagatedBuildInputs = [ optint ];
buildPhase = "dune build";
doCheck = hasC;
checkPhase = "dune runtest";
inherit (dune) installPhase;
meta = {
homepage = "https://github.com/mirage/checkseum";
description = "ADLER-32 and CRC32C Cyclic Redundancy Check";
license = stdenv.lib.licenses.mit;
maintainers = [ stdenv.lib.maintainers.vbgl ];
inherit (ocaml.meta) platforms;
};
}

View File

@ -138,6 +138,8 @@ let
cairo2 = callPackage ../development/ocaml-modules/cairo2 { };
checkseum = callPackage ../development/ocaml-modules/checkseum { };
cil = callPackage ../development/ocaml-modules/cil { };
cmdliner = callPackage ../development/ocaml-modules/cmdliner { };