2021-09-20 17:14:35 +01:00
|
|
|
{ lib, fetchurl, fetchpatch, buildDunePackage, ocaml, qcheck }:
|
2017-10-02 11:18:35 +01:00
|
|
|
|
2019-12-18 09:20:00 +00:00
|
|
|
buildDunePackage rec {
|
2019-03-26 10:04:59 +00:00
|
|
|
pname = "stdint";
|
2021-01-21 19:26:23 +00:00
|
|
|
version = "0.7.0";
|
2019-12-18 09:20:00 +00:00
|
|
|
|
2021-01-21 19:26:23 +00:00
|
|
|
useDune2 = true;
|
2020-01-14 08:30:23 +00:00
|
|
|
|
2021-01-21 19:26:23 +00:00
|
|
|
minimumOCamlVersion = "4.03";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/andrenth/ocaml-stdint/releases/download/${version}/stdint-${version}.tbz";
|
|
|
|
sha256 = "4fcc66aef58e2b96e7af3bbca9d910aa239e045ba5fb2400aaef67d0041252dc";
|
2017-10-02 11:18:35 +01:00
|
|
|
};
|
|
|
|
|
2021-01-21 19:26:23 +00:00
|
|
|
patches = [
|
|
|
|
# fix test bug, remove at next release
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/andrenth/ocaml-stdint/commit/fc64293f99f597cdfd4470954da6fb323988e2af.patch";
|
|
|
|
sha256 = "0nxck14vfjfzldsf8cdj2jg1cvhnyh37hqnrcxbdkqmpx4rxkbxs";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-02-20 14:57:09 +00:00
|
|
|
# 1. disable remaining broken tests, see
|
|
|
|
# https://github.com/andrenth/ocaml-stdint/issues/59
|
|
|
|
# 2. fix tests to liberal test range
|
|
|
|
# https://github.com/andrenth/ocaml-stdint/pull/61
|
2021-01-21 19:26:23 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace tests/stdint_test.ml \
|
|
|
|
--replace 'test "An integer should perform left-shifts correctly"' \
|
|
|
|
'skip "An integer should perform left-shifts correctly"' \
|
|
|
|
--replace 'test "Logical shifts must not sign-extend"' \
|
2021-02-20 14:57:09 +00:00
|
|
|
'skip "Logical shifts must not sign-extend"' \
|
|
|
|
--replace 'let pos_int = QCheck.map_same_type abs in_range' \
|
|
|
|
'let pos_int = QCheck.int_range 0 maxi'
|
2021-01-21 19:26:23 +00:00
|
|
|
'';
|
|
|
|
|
2021-09-20 17:14:35 +01:00
|
|
|
doCheck = lib.versionAtLeast ocaml.version "4.08";
|
2021-01-21 19:26:23 +00:00
|
|
|
checkInputs = [ qcheck ];
|
|
|
|
|
2017-10-02 11:18:35 +01:00
|
|
|
meta = {
|
|
|
|
description = "Various signed and unsigned integers for OCaml";
|
2019-12-18 09:20:00 +00:00
|
|
|
homepage = "https://github.com/andrenth/ocaml-stdint";
|
2020-01-14 08:30:23 +00:00
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = [ lib.maintainers.gebner ];
|
2017-10-02 11:18:35 +01:00
|
|
|
};
|
|
|
|
}
|