about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/ocaml-modules/ctypes/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/ocaml-modules/ctypes/default.nix')
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ctypes/default.nix50
1 files changed, 18 insertions, 32 deletions
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ctypes/default.nix b/nixpkgs/pkgs/development/ocaml-modules/ctypes/default.nix
index fa9cde044e8a..fa7bf6a587f0 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/ctypes/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/ctypes/default.nix
@@ -1,49 +1,35 @@
-{ lib, stdenv, fetchFromGitHub, ocaml, findlib, libffi, pkg-config, ncurses, integers, bigarray-compat }:
-
-if lib.versionOlder ocaml.version "4.02"
-then throw "ctypes is not available for OCaml ${ocaml.version}"
-else
-
-stdenv.mkDerivation rec {
-  pname = "ocaml${ocaml.version}-ctypes";
-  version = "0.20.2";
+{ lib
+, ocaml
+, fetchFromGitHub
+, buildDunePackage
+, dune-configurator
+, integers
+, bigarray-compat
+, ounit2
+}:
+
+buildDunePackage rec {
+  pname = "ctypes";
+  version = "0.22.0";
 
   src = fetchFromGitHub {
     owner = "ocamllabs";
     repo = "ocaml-ctypes";
     rev = version;
-    hash = "sha256-LzUrR8K88CjY/R5yUK3y6KG85hUMjbzuebHGqI8KhhM=";
+    hash = "sha256-xgDKupQuakjHTbjoap/r2aAjNQUpH9K4HmeLbbgw1x4=";
   };
 
-  nativeBuildInputs = [ pkg-config ocaml findlib ];
-  buildInputs = [ ncurses ];
-  propagatedBuildInputs = [ integers libffi bigarray-compat ];
-
-  strictDeps = true;
-
-  preConfigure = ''
-    substituteInPlace META --replace ' bytes ' ' '
-  '';
+  buildInputs = [ dune-configurator ];
 
-  buildPhase = ''
-    runHook preBuild
-    make XEN=false libffi.config ctypes-base ctypes-stubs
-    make XEN=false ctypes-foreign
-    runHook postBuild
-  '';
+  propagatedBuildInputs = [ integers bigarray-compat ];
 
-  installPhase = ''
-    runHook preInstall
-    mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/stublibs
-    make install XEN=false
-    runHook postInstall
-  '';
+  doCheck = lib.versionAtLeast ocaml.version "4.08";
+  checkInputs = [ ounit2 ];
 
   meta = with lib; {
     homepage = "https://github.com/ocamllabs/ocaml-ctypes";
     description = "Library for binding to C libraries using pure OCaml";
     license = licenses.mit;
     maintainers = [ maintainers.ericbmerritt ];
-    inherit (ocaml.meta) platforms;
   };
 }