1{
2 lib,
3 buildDunePackage,
4 fetchFromGitHub,
5 ocaml,
6 cppo,
7}:
8
9buildDunePackage rec {
10 version = "1.2";
11 pname = "ocplib-endian";
12
13 src = fetchFromGitHub {
14 owner = "OCamlPro";
15 repo = "ocplib-endian";
16 rev = version;
17 sha256 = "sha256-THTlhOfXAPaqTt1qBkht+D67bw6M175QLvXoUMgjks4=";
18 };
19
20 postPatch = lib.optionalString (lib.versionAtLeast ocaml.version "5.0") ''
21 substituteInPlace src/dune \
22 --replace "(libraries bytes)" "" \
23 --replace "libraries ocplib_endian bigarray bytes" "libraries ocplib_endian"
24 '';
25
26 minimalOCamlVersion = "4.03";
27
28 nativeBuildInputs = [ cppo ];
29
30 meta = with lib; {
31 description = "Optimised functions to read and write int16/32/64";
32 homepage = "https://github.com/OCamlPro/ocplib-endian";
33 license = licenses.lgpl21;
34 maintainers = with maintainers; [ vbgl ];
35 };
36}