nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, fetchurl, fetchpatch, buildDunePackage, ocaml, qcheck }:
2
3buildDunePackage rec {
4 pname = "stdint";
5 version = "0.7.0";
6
7 useDune2 = true;
8
9 minimumOCamlVersion = "4.03";
10
11 src = fetchurl {
12 url = "https://github.com/andrenth/ocaml-stdint/releases/download/${version}/stdint-${version}.tbz";
13 sha256 = "4fcc66aef58e2b96e7af3bbca9d910aa239e045ba5fb2400aaef67d0041252dc";
14 };
15
16 patches = [
17 # fix test bug, remove at next release
18 (fetchpatch {
19 url = "https://github.com/andrenth/ocaml-stdint/commit/fc64293f99f597cdfd4470954da6fb323988e2af.patch";
20 sha256 = "0nxck14vfjfzldsf8cdj2jg1cvhnyh37hqnrcxbdkqmpx4rxkbxs";
21 })
22 ];
23
24 # 1. disable remaining broken tests, see
25 # https://github.com/andrenth/ocaml-stdint/issues/59
26 # 2. fix tests to liberal test range
27 # https://github.com/andrenth/ocaml-stdint/pull/61
28 postPatch = ''
29 substituteInPlace tests/stdint_test.ml \
30 --replace 'test "An integer should perform left-shifts correctly"' \
31 'skip "An integer should perform left-shifts correctly"' \
32 --replace 'test "Logical shifts must not sign-extend"' \
33 'skip "Logical shifts must not sign-extend"' \
34 --replace 'let pos_int = QCheck.map_same_type abs in_range' \
35 'let pos_int = QCheck.int_range 0 maxi'
36 '';
37
38 doCheck = lib.versionAtLeast ocaml.version "4.08";
39 checkInputs = [ qcheck ];
40
41 meta = {
42 description = "Various signed and unsigned integers for OCaml";
43 homepage = "https://github.com/andrenth/ocaml-stdint";
44 license = lib.licenses.mit;
45 maintainers = [ lib.maintainers.gebner ];
46 };
47}