2019-10-22 05:47:54 +00:00
|
|
|
{ stdenv, fetchzip, ocaml, findlib, libffi, pkgconfig, ncurses, integers }:
|
2015-05-15 14:31:44 +00:00
|
|
|
|
2019-10-22 05:47:54 +00:00
|
|
|
if !stdenv.lib.versionAtLeast ocaml.version "4.02"
|
|
|
|
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}";
|
|
|
|
version = "0.15.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";
|
|
|
|
sha256 = "0adas974bwinn8jidb6chljkpd70s041h2a969dicsj0xsg6wys6";
|
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
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = https://github.com/ocamllabs/ocaml-ctypes;
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|