about summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/cstruct
diff options
context:
space:
mode:
authorVincent Laporte <Vincent.Laporte@gmail.com>2017-11-27 19:08:40 +0000
committerVincent Laporte <Vincent.Laporte@gmail.com>2017-11-27 20:49:18 +0000
commitbfc0959511519af01c9f04ff171fd188f81d731d (patch)
tree98f0202acacf6f6e8841e483df51e09c4fcf7091 /pkgs/development/ocaml-modules/cstruct
parente7f4979270fc5a1ca02c398eece1d88c36758e04 (diff)
downloadnixlib-bfc0959511519af01c9f04ff171fd188f81d731d.tar
nixlib-bfc0959511519af01c9f04ff171fd188f81d731d.tar.gz
nixlib-bfc0959511519af01c9f04ff171fd188f81d731d.tar.bz2
nixlib-bfc0959511519af01c9f04ff171fd188f81d731d.tar.lz
nixlib-bfc0959511519af01c9f04ff171fd188f81d731d.tar.xz
nixlib-bfc0959511519af01c9f04ff171fd188f81d731d.tar.zst
nixlib-bfc0959511519af01c9f04ff171fd188f81d731d.zip
ocamlPackages.cstruct: 2.3.2 -> 3.0.2
Diffstat (limited to 'pkgs/development/ocaml-modules/cstruct')
-rw-r--r--pkgs/development/ocaml-modules/cstruct/1.9.0.nix36
-rw-r--r--pkgs/development/ocaml-modules/cstruct/default.nix52
-rw-r--r--pkgs/development/ocaml-modules/cstruct/lwt.nix12
-rw-r--r--pkgs/development/ocaml-modules/cstruct/ppx.nix13
-rw-r--r--pkgs/development/ocaml-modules/cstruct/unix.nix12
5 files changed, 93 insertions, 32 deletions
diff --git a/pkgs/development/ocaml-modules/cstruct/1.9.0.nix b/pkgs/development/ocaml-modules/cstruct/1.9.0.nix
new file mode 100644
index 000000000000..25f84826ec18
--- /dev/null
+++ b/pkgs/development/ocaml-modules/cstruct/1.9.0.nix
@@ -0,0 +1,36 @@
+{ stdenv, writeText, fetchFromGitHub, ocaml, ocamlbuild, ocplib-endian, sexplib, findlib, ppx_tools
+, async ? null, lwt ? null
+}:
+
+assert stdenv.lib.versionAtLeast ocaml.version "4.01";
+
+let version = "1.9.0"; in
+
+let opt = b: "--${if b != null then "en" else "dis"}able"; in
+
+stdenv.mkDerivation {
+  name = "ocaml${ocaml.version}-cstruct-${version}";
+
+  src = fetchFromGitHub {
+    owner = "mirage";
+    repo = "ocaml-cstruct";
+    rev = "v${version}";
+    sha256 = "1c1j21zgmxi9spq23imy7byn50qr7hlds1cfpzxlsx9dp309jngy";
+  };
+
+  configureFlags = [ "${opt lwt}-lwt" "${opt async}-async" "${opt ppx_tools}-ppx" ];
+
+  buildInputs = [ ocaml findlib ocamlbuild ppx_tools lwt async ];
+  propagatedBuildInputs = [ ocplib-endian sexplib ];
+
+  createFindlibDestdir = true;
+  dontStrip = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/mirage/ocaml-cstruct;
+    description = "Map OCaml arrays onto C-like structs";
+    license = stdenv.lib.licenses.isc;
+    maintainers = [ maintainers.vbgl maintainers.ericbmerritt ];
+    platforms = ocaml.meta.platforms or [];
+  };
+}
diff --git a/pkgs/development/ocaml-modules/cstruct/default.nix b/pkgs/development/ocaml-modules/cstruct/default.nix
index 0278b0f26558..ad24415f1609 100644
--- a/pkgs/development/ocaml-modules/cstruct/default.nix
+++ b/pkgs/development/ocaml-modules/cstruct/default.nix
@@ -1,40 +1,28 @@
-{ stdenv, writeText, fetchFromGitHub, ocaml, ocamlbuild, ocplib-endian, sexplib, findlib, ppx_tools
-, async ? null, lwt ? null
-}:
+{ stdenv, fetchurl, ocaml, jbuilder, findlib, sexplib, ocplib-endian }:
 
-assert stdenv.lib.versionAtLeast ocaml.version "4.01";
+stdenv.mkDerivation rec {
+	name = "ocaml${ocaml.version}-cstruct-${version}";
+	version = "3.0.2";
+	src = fetchurl {
+		url = "https://github.com/mirage/ocaml-cstruct/releases/download/v${version}/cstruct-${version}.tbz";
+		sha256 = "03caxcyzfjmbnnwa15zy9s1ckkl4sc834d1qkgi4jcs3zqchvd8z";
+	};
 
-let param =
-  if stdenv.lib.versionAtLeast ocaml.version "4.02"
-  then { version = "2.3.2"; sha256 = "1fykack86hvvqhwngddyxxqlwm3xjljfaszsjbdrvjlrd1nlg079"; }
-  else { version = "1.9.0"; sha256 = "1c1j21zgmxi9spq23imy7byn50qr7hlds1cfpzxlsx9dp309jngy"; };
-in
+	unpackCmd = "tar -xjf $curSrc";
 
-let opt = b: "--${if b != null then "en" else "dis"}able"; in
+	buildInputs = [ ocaml jbuilder findlib ];
 
-stdenv.mkDerivation {
-  name = "ocaml${ocaml.version}-cstruct-${param.version}";
+	propagatedBuildInputs = [ sexplib ocplib-endian ];
 
-  src = fetchFromGitHub {
-    owner = "mirage";
-    repo = "ocaml-cstruct";
-    rev = "v${param.version}";
-    inherit (param) sha256;
-  };
+	buildPhase = "jbuilder build -p cstruct";
 
-  configureFlags = [ "${opt lwt}-lwt" "${opt async}-async" "${opt ppx_tools}-ppx" ];
+	inherit (jbuilder) installPhase;
 
-  buildInputs = [ ocaml findlib ocamlbuild ppx_tools lwt async ];
-  propagatedBuildInputs = [ ocplib-endian sexplib ];
-
-  createFindlibDestdir = true;
-  dontStrip = true;
-
-  meta = with stdenv.lib; {
-    homepage = https://github.com/mirage/ocaml-cstruct;
-    description = "Map OCaml arrays onto C-like structs";
-    license = stdenv.lib.licenses.isc;
-    maintainers = [ maintainers.vbgl maintainers.ericbmerritt ];
-    platforms = ocaml.meta.platforms or [];
-  };
+	meta = {
+		description = "Access C-like structures directly from OCaml";
+		license = stdenv.lib.licenses.isc;
+		maintainers = [ stdenv.lib.maintainers.vbgl ];
+		inherit (src.meta) homepage;
+		inherit (ocaml.meta) platforms;
+	};
 }
diff --git a/pkgs/development/ocaml-modules/cstruct/lwt.nix b/pkgs/development/ocaml-modules/cstruct/lwt.nix
new file mode 100644
index 000000000000..065716e68529
--- /dev/null
+++ b/pkgs/development/ocaml-modules/cstruct/lwt.nix
@@ -0,0 +1,12 @@
+{ stdenv, ocaml, cstruct, lwt }:
+
+assert stdenv.lib.versionAtLeast ocaml.version "4.02";
+
+stdenv.mkDerivation rec {
+	name = "ocaml${ocaml.version}-cstruct-lwt-${version}";
+	inherit (cstruct) version src unpackCmd buildInputs installPhase meta;
+
+	propagatedBuildInputs = [ cstruct lwt ];
+
+	buildPhase = "${cstruct.buildPhase}-lwt";
+}
diff --git a/pkgs/development/ocaml-modules/cstruct/ppx.nix b/pkgs/development/ocaml-modules/cstruct/ppx.nix
new file mode 100644
index 000000000000..9d19e1751e23
--- /dev/null
+++ b/pkgs/development/ocaml-modules/cstruct/ppx.nix
@@ -0,0 +1,13 @@
+{ stdenv, ocaml, cstruct, ppx_tools_versioned }:
+
+assert stdenv.lib.versionAtLeast ocaml.version "4.02";
+
+stdenv.mkDerivation rec {
+	name = "ocaml${ocaml.version}-ppx_cstruct-${version}";
+	inherit (cstruct) version src unpackCmd installPhase meta;
+
+	buildInputs = cstruct.buildInputs ++ [ ppx_tools_versioned ];
+	propagatedBuildInputs = [ cstruct ];
+
+	buildPhase = "jbuilder build -p ppx_cstruct";
+}
diff --git a/pkgs/development/ocaml-modules/cstruct/unix.nix b/pkgs/development/ocaml-modules/cstruct/unix.nix
new file mode 100644
index 000000000000..2a614579fccc
--- /dev/null
+++ b/pkgs/development/ocaml-modules/cstruct/unix.nix
@@ -0,0 +1,12 @@
+{ stdenv, ocaml, cstruct }:
+
+assert stdenv.lib.versionAtLeast ocaml.version "4.02";
+
+stdenv.mkDerivation rec {
+	name = "ocaml${ocaml.version}-cstruct-unix-${version}";
+	inherit (cstruct) version src unpackCmd buildInputs installPhase meta;
+
+	propagatedBuildInputs = [ cstruct ];
+
+	buildPhase = "${cstruct.buildPhase}-unix";
+}