2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, fetchzip, ocaml, findlib, libffi, pkgconfig, ncurses, integers }:
|
2015-05-15 14:31:44 +00:00
|
|
|
|
2021-01-11 12:49:15 +00:00
|
|
|
if !lib.versionAtLeast ocaml.version "4.02"
|
2019-10-22 05:47:54 +00:00
|
|
|
then throw "ctypes is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
2015-05-15 14:31:44 +00:00
|
|
|
|
2019-10-22 05:47:54 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "ocaml${ocaml.version}-ctypes-${version}";
|
2020-11-28 21:13:34 +00:00
|
|
|
version = "0.17.1";
|
2015-10-16 10:30:18 +00:00
|
|
|
|
2018-02-23 17:19:25 +00:00
|
|
|
src = fetchzip {
|
2019-10-22 05:47:54 +00:00
|
|
|
url = "https://github.com/ocamllabs/ocaml-ctypes/archive/${version}.tar.gz";
|
2020-11-28 21:13:34 +00:00
|
|
|
sha256 = "16brmdnz7wi2z25qqhd5s5blyq4app6jbv6g9pa4vyg6h0nzbcys";
|
2015-05-15 14:31:44 +00:00
|
|
|
};
|
|
|
|
|
2017-09-05 21:26:13 +00:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
2019-10-22 05:47:54 +00:00
|
|
|
buildInputs = [ ocaml findlib ncurses ];
|
2018-02-23 17:19:25 +00:00
|
|
|
propagatedBuildInputs = [ integers libffi ];
|
2015-05-15 14:31:44 +00:00
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
make XEN=false libffi.config ctypes-base ctypes-stubs
|
|
|
|
make XEN=false ctypes-foreign
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2019-10-22 05:47:54 +00:00
|
|
|
mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/stublibs
|
2015-05-15 14:31:44 +00:00
|
|
|
make install XEN=false
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-04-10 05:30:20 +00:00
|
|
|
homepage = "https://github.com/ocamllabs/ocaml-ctypes";
|
2015-05-15 14:31:44 +00:00
|
|
|
description = "Library for binding to C libraries using pure OCaml";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = [ maintainers.ericbmerritt ];
|
2019-10-22 05:47:54 +00:00
|
|
|
inherit (ocaml.meta) platforms;
|
2015-05-15 14:31:44 +00:00
|
|
|
};
|
|
|
|
}
|