about summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/ulex
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/ocaml-modules/ulex')
-rw-r--r--pkgs/development/ocaml-modules/ulex/0.8/camlp5.patch72
-rw-r--r--pkgs/development/ocaml-modules/ulex/0.8/default.nix32
-rw-r--r--pkgs/development/ocaml-modules/ulex/0.8/meta_version.patch10
-rw-r--r--pkgs/development/ocaml-modules/ulex/default.nix28
4 files changed, 142 insertions, 0 deletions
diff --git a/pkgs/development/ocaml-modules/ulex/0.8/camlp5.patch b/pkgs/development/ocaml-modules/ulex/0.8/camlp5.patch
new file mode 100644
index 000000000000..2fa92527035e
--- /dev/null
+++ b/pkgs/development/ocaml-modules/ulex/0.8/camlp5.patch
@@ -0,0 +1,72 @@
+Author: Stefano Zacchiroli <zack@debian.org>
+Description: build (and install) using camlp5 instead of camlp4
+--- ulex0.8.orig/META
++++ ulex0.8/META
+@@ -1,5 +1,5 @@
+ version = "0.8"
+-requires = "camlp4"
++requires = "camlp5"
+ description = "Runtime support for ulex"
+ archive(byte) = "ulexing.cma"
+ archive(native) = "ulexing.cmxa"
+--- ulex0.8.orig/Makefile
++++ ulex0.8/Makefile
+@@ -20,7 +20,7 @@
+ 	ocamlopt -a -o ulexing.cmxa $(ULEXING)
+ 
+ pa_ulex.cma: $(ULEX)
+-	ocamlc -a -o pa_ulex.cma -pp 'camlp4o pa_extend.cmo q_MLast.cmo' -I +camlp4 $(ULEX)
++	ocamlc -a -o pa_ulex.cma -pp 'camlp5o pa_extend.cmo q_MLast.cmo' -I `camlp5 -where` $(ULEX)
+ 
+ pa_ulex.ml: pa_ulex.ml.src
+ 	ocaml mk_pa_ulex.ml
+@@ -29,14 +29,14 @@
+ 	rm -f *.cm* *~ test custom_ulexing *.o *.a *.html *.css pa_ulex.ml
+ 
+ view_test: pa_ulex.cma
+-	camlp4o ./pa_ulex.cma pr_o.cmo -sep "\n" test.ml
++	camlp5o ./pa_ulex.cma pr_o.cmo -sep "\n" test.ml
+ 
+ run_test: ulexing.cma pa_ulex.cma
+-	ocamlc -o test -pp 'camlp4o ./pa_ulex.cma' ulexing.cma test.ml
++	ocamlc -o test -pp 'camlp5o ./pa_ulex.cma' ulexing.cma test.ml
+ 	./test
+ 
+ custom_ulexing: ulexing.cma pa_ulex.cma
+-	ocamlc -o custom_ulexing -pp 'camlp4o ./pa_ulex.cma' ulexing.cma custom_ulexing.ml
++	ocamlc -o custom_ulexing -pp 'camlp5o ./pa_ulex.cma' ulexing.cma custom_ulexing.ml
+ 
+ 
+ doc:
+--- ulex0.8.orig/README
++++ ulex0.8/README
+@@ -142,7 +142,7 @@
+ 
+ Compilation of OCaml files with lexer specifications:
+ 
+-  ocamlfind ocamlc -c -package ulex -syntax camlp4o my_file.ml
++  ocamlfind ocamlc -c -package ulex -syntax camlp5o my_file.ml
+ 
+ When linking, you must also include the ulex package:
+   ocamlfind ocamlc -o my_prog -linkpkg -package ulex my_file.cmo
+--- ulex0.8.orig/mk_pa_ulex.ml
++++ ulex0.8/mk_pa_ulex.ml
+@@ -1,10 +1,4 @@
+ let s = float_of_string (String.sub (Sys.ocaml_version) 0 4) in
+-if (s < 3.09) then (
+   print_endline "Old camlp4 (loc)";
+   Sys.command "sed s/_loc/loc/ < pa_ulex.ml.src > pa_ulex.ml"
+-)
+-else  (
+-  print_endline "New camlp4 (_loc)";
+-  Sys.command "cp pa_ulex.ml.src pa_ulex.ml"
+-)
+ 
+--- ulex0.8.orig/pa_ulex.ml.src
++++ ulex0.8/pa_ulex.ml.src
+@@ -1,4 +1,4 @@
+-let _loc = (Lexing.dummy_pos,Lexing.dummy_pos)
++let _loc = Stdpp.dummy_loc
+ 
+ (* Named regexp *)
+ 
diff --git a/pkgs/development/ocaml-modules/ulex/0.8/default.nix b/pkgs/development/ocaml-modules/ulex/0.8/default.nix
new file mode 100644
index 000000000000..169f3bfad8c2
--- /dev/null
+++ b/pkgs/development/ocaml-modules/ulex/0.8/default.nix
@@ -0,0 +1,32 @@
+{stdenv, fetchurl, ocaml, findlib, camlp5 }:
+
+let
+  ocaml_version = (builtins.parseDrvName ocaml.name).version;
+  version = "0.8";
+  pname = "ulex";
+
+in
+
+stdenv.mkDerivation {
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "http://www.cduce.org/download/old/${pname}-${version}.tar.gz";
+    sha256 = "19faabg8hzz155xlzmjwsl59d7slahb5m1l9zh1fqvvpp81r26cp";
+  };
+
+  buildInputs = [ocaml findlib camlp5];
+
+  createFindlibDestdir = true;
+
+  patches = [ ./meta_version.patch ./camlp5.patch ];
+
+  buildFlags = "all all.opt";
+
+  meta = {
+    homepage = http://www.cduce.org/download.html;
+    description = "ulex is a lexer generator for Unicode and OCaml";
+    license = "MIT";
+    maintainers = [ stdenv.lib.maintainers.roconnor ];
+  };
+}
diff --git a/pkgs/development/ocaml-modules/ulex/0.8/meta_version.patch b/pkgs/development/ocaml-modules/ulex/0.8/meta_version.patch
new file mode 100644
index 000000000000..7a39510cf0b4
--- /dev/null
+++ b/pkgs/development/ocaml-modules/ulex/0.8/meta_version.patch
@@ -0,0 +1,10 @@
+Author: Stefano Zacchiroli <zack@debian.org>
+Description: fix a typo in the findlib package version number specified in META
+--- ulex0.8.orig/META
++++ ulex0.8/META
+@@ -1,4 +1,4 @@
+-version = "0.7"
++version = "0.8"
+ requires = "camlp4"
+ description = "Runtime support for ulex"
+ archive(byte) = "ulexing.cma"
diff --git a/pkgs/development/ocaml-modules/ulex/default.nix b/pkgs/development/ocaml-modules/ulex/default.nix
new file mode 100644
index 000000000000..aee65a6e2ee8
--- /dev/null
+++ b/pkgs/development/ocaml-modules/ulex/default.nix
@@ -0,0 +1,28 @@
+{stdenv, fetchurl, ocaml, findlib }:
+
+let
+  ocaml_version = (builtins.parseDrvName ocaml.name).version;
+  version = "1.1";
+  pname = "ulex";
+
+in
+
+stdenv.mkDerivation {
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "http://www.cduce.org/download/${pname}-${version}.tar.gz";
+    sha256 = "0fjlkwps14adfgxdrbb4yg65fhyimplvjjs1xqj5np197cig67x0";
+  };
+
+  buildInputs = [ocaml findlib];
+
+  buildFlags = "all all.opt";
+
+  meta = {
+    homepage = http://www.cduce.org/download.html;
+    description = "ulex is a lexer generator for Unicode and OCaml";
+    license = "MIT";
+    maintainers = [ stdenv.lib.maintainers.roconnor ];
+  };
+}