summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorvbgl <vbgl@users.noreply.github.com>2015-11-12 01:15:26 +0100
committervbgl <vbgl@users.noreply.github.com>2015-11-12 01:15:26 +0100
commitb3d2a2874af5740f8394035650d3fa53a2f39d52 (patch)
treebffce0aedc1c4d737702957f64a6ea203d46d644 /pkgs
parent6de80cb21bc5d3011876be9236aadf625b86af6a (diff)
parent6cc033b99e607a753d274ce084095a2a7bfb82e8 (diff)
downloadnixlib-b3d2a2874af5740f8394035650d3fa53a2f39d52.tar
nixlib-b3d2a2874af5740f8394035650d3fa53a2f39d52.tar.gz
nixlib-b3d2a2874af5740f8394035650d3fa53a2f39d52.tar.bz2
nixlib-b3d2a2874af5740f8394035650d3fa53a2f39d52.tar.lz
nixlib-b3d2a2874af5740f8394035650d3fa53a2f39d52.tar.xz
nixlib-b3d2a2874af5740f8394035650d3fa53a2f39d52.tar.zst
nixlib-b3d2a2874af5740f8394035650d3fa53a2f39d52.zip
Merge pull request #10964 from vbgl/master
menhir: refactor to generic; init at 20151110 for OCaml >= 4.02
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/ocaml-modules/menhir/default.nix55
-rw-r--r--pkgs/development/ocaml-modules/menhir/generic.nix47
2 files changed, 55 insertions, 47 deletions
diff --git a/pkgs/development/ocaml-modules/menhir/default.nix b/pkgs/development/ocaml-modules/menhir/default.nix
index 5cf2f97e4b74..c8243f326715 100644
--- a/pkgs/development/ocaml-modules/menhir/default.nix
+++ b/pkgs/development/ocaml-modules/menhir/default.nix
@@ -1,51 +1,12 @@
-{stdenv, fetchurl, ocaml, findlib}:
+{ stdenv, fetchurl, ocaml, findlib
+, version ? if stdenv.lib.versionAtLeast (stdenv.lib.getVersion ocaml) "4.02" then "20151110" else "20140422"
+}@args:
 
 let
-  ocaml_version = (builtins.parseDrvName ocaml.name).version;
+  sha256 =
+  if version == "20140422" then "1ki1f2id6a14h9xpv2k8yb6px7dyw8cvwh39csyzj4qpzx7wia0d"
+  else if version == "20151110" then "12ijr1gd808f79d7k7ji9zg23xr4szayfgvm6njqamh0jnspq70r"
+  else throw ("menhir: unknown version " ++ version);
 in
 
-stdenv.mkDerivation {
-  name = "menhir-20140422";
-
-  src = fetchurl {
-    url = http://pauillac.inria.fr/~fpottier/menhir/menhir-20140422.tar.gz;
-    sha256 = "1ki1f2id6a14h9xpv2k8yb6px7dyw8cvwh39csyzj4qpzx7wia0d";
-  };
-
-  buildInputs = [ocaml findlib];
-
-  createFindlibDestdir = true;
-
-  preBuild = ''
-    #Fix makefiles.
-    RM=$(type -p rm)
-    CHMOD=$(type -p chmod)
-    ENV=$(type -p env)
-    for f in src/Makefile demos/OMakefile* demos/Makefile* demos/ocamldep.wrapper
-    do
-      substituteInPlace $f \
-        --replace /bin/rm $RM \
-	--replace /bin/chmod $CHMOD \
-	--replace /usr/bin/env $ENV
-    done
-
-    export PREFIX=$out
-  '';
-
-  meta = with stdenv.lib; {
-    homepage = http://pauillac.inria.fr/~fpottier/menhir/;
-    description = "A LR(1) parser generator for OCaml";
-    longDescription = ''
-      Menhir is a LR(1) parser generator for the Objective Caml programming
-      language.  That is, Menhir compiles LR(1) grammar specifications down
-      to OCaml code.  Menhir was designed and implemented by François Pottier
-      and Yann Régis-Gianas.
-    '';
-    license = with licenses; [
-      qpl /* generator */
-      lgpl2 /* library */
-    ];
-    platforms = ocaml.meta.platforms;
-    maintainers = with maintainers; [ z77z ];
-  };
-}
+import ./generic.nix (args // { inherit version sha256; })
diff --git a/pkgs/development/ocaml-modules/menhir/generic.nix b/pkgs/development/ocaml-modules/menhir/generic.nix
new file mode 100644
index 000000000000..8758ff3cffbc
--- /dev/null
+++ b/pkgs/development/ocaml-modules/menhir/generic.nix
@@ -0,0 +1,47 @@
+{ version, sha256, stdenv, fetchurl, ocaml, findlib }:
+
+stdenv.mkDerivation {
+  name = "menhir-${version}";
+
+  src = fetchurl {
+    url = "http://pauillac.inria.fr/~fpottier/menhir/menhir-${version}.tar.gz";
+    inherit sha256;
+  };
+
+  buildInputs = [ ocaml findlib ];
+
+  createFindlibDestdir = true;
+
+  preBuild = ''
+    #Fix makefiles.
+    RM=$(type -p rm)
+    CHMOD=$(type -p chmod)
+    ENV=$(type -p env)
+    for f in src/Makefile demos/OMakefile* demos/Makefile* demos/ocamldep.wrapper
+    do
+      substituteInPlace $f \
+        --replace /bin/rm $RM \
+	--replace /bin/chmod $CHMOD \
+	--replace /usr/bin/env $ENV
+    done
+
+    export PREFIX=$out
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://pauillac.inria.fr/~fpottier/menhir/;
+    description = "A LR(1) parser generator for OCaml";
+    longDescription = ''
+      Menhir is a LR(1) parser generator for the Objective Caml programming
+      language.  That is, Menhir compiles LR(1) grammar specifications down
+      to OCaml code.  Menhir was designed and implemented by François Pottier
+      and Yann Régis-Gianas.
+    '';
+    license = with licenses; [
+      qpl /* generator */
+      lgpl2 /* library */
+    ];
+    platforms = ocaml.meta.platforms;
+    maintainers = with maintainers; [ z77z ];
+  };
+}