[Pkg-ocaml-maint-commits] [cmigrep] 02/05: Port to OCaml >= 4

Stéphane Glondu glondu at alioth.debian.org
Sun Nov 10 15:41:35 UTC 2013


This is an automated email from the git hooks/post-receive script.

glondu pushed a commit to branch master
in repository cmigrep.

commit a19cd04b8cb90c157ed8499ed32645de47fec0da
Author: Stephane Glondu <steph at glondu.net>
Date:   Sun Nov 10 16:33:56 2013 +0100

    Port to OCaml >= 4
---
 debian/patches/0001-Compile-without-godi.patch     |   36 ------
 ...ivate-flag.patch => 0001-No-private-flag.patch} |    0
 .../0002-Adapt-to-Types-types-of-OCaml-4.patch     |  135 ++++++++++++++++++++
 .../0003-Adapt-build-system-to-OCaml-4.patch       |   53 ++++++++
 debian/patches/series                              |    5 +-
 5 files changed, 191 insertions(+), 38 deletions(-)

diff --git a/debian/patches/0001-Compile-without-godi.patch b/debian/patches/0001-Compile-without-godi.patch
deleted file mode 100644
index ba06769..0000000
--- a/debian/patches/0001-Compile-without-godi.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From: Ralf Treinen <treinen at debian.org>
-Date: Fri, 13 Nov 2009 20:11:48 +0100
-Subject: Compile without godi
-
-Provide directly the include directories for the compiler-libs.
----
- Makefile | 10 ++++------
- 1 file changed, 4 insertions(+), 6 deletions(-)
-
-diff --git a/Makefile b/Makefile
-index 546acc6..b3378fa 100644
---- a/Makefile
-+++ b/Makefile
-@@ -16,17 +16,15 @@ typedtree.cmo ctype.cmo printtyp.cmo includeclass.cmo mtype.cmo		\
- includecore.cmo includemod.cmo parmatch.cmo typetexp.cmo stypes.cmo	\
- typecore.cmo typedecl.cmo typeclass.cmo typemod.cmo cmigrep.ml
- 
--
--GODI_CONF=$(shell godi_confdir)
--GODI_BASE=$(shell cat $(GODI_CONF)/godi.conf | grep ^LOCALBASE | sed -e 's/LOCALBASE *= *//')
--GODI_LIB=$(GODI_BASE)/lib/ocaml/compiler-lib
-+COMPILERLIBFLAGS=-I +compiler-libs/parsing -I +compiler-libs/typing     \
-+-I +compiler-libs/utils
- 
- all:
--	ocamlfind ocamlopt -o cmigrep -I $(GODI_LIB) \
-+	ocamlfind ocamlopt -o cmigrep $(COMPILERLIBFLAGS) \
- 	-package pcre,findlib,unix -linkpkg $(SOURCES)
- 
- byte:
--	ocamlfind ocamlc -o cmigrep -I $(GODI_LIB) \
-+	ocamlfind ocamlc -o cmigrep $(COMPILERLIBFLAGS) \
- 	-package pcre,findlib,unix -linkpkg $(BYTESOURCES)
- 
- install:
--- 
diff --git a/debian/patches/0002-No-private-flag.patch b/debian/patches/0001-No-private-flag.patch
similarity index 100%
rename from debian/patches/0002-No-private-flag.patch
rename to debian/patches/0001-No-private-flag.patch
diff --git a/debian/patches/0002-Adapt-to-Types-types-of-OCaml-4.patch b/debian/patches/0002-Adapt-to-Types-types-of-OCaml-4.patch
new file mode 100644
index 0000000..6756a2c
--- /dev/null
+++ b/debian/patches/0002-Adapt-to-Types-types-of-OCaml-4.patch
@@ -0,0 +1,135 @@
+From: Stephane Glondu <steph at glondu.net>
+Date: Sun, 10 Nov 2013 16:29:20 +0100
+Subject: Adapt to Types types of OCaml >= 4
+
+---
+ cmigrep.ml | 44 +++++++++++++++++++++++---------------------
+ 1 file changed, 23 insertions(+), 21 deletions(-)
+
+diff --git a/cmigrep.ml b/cmigrep.ml
+index cdac8b3..dd162fa 100755
+--- a/cmigrep.ml
++++ b/cmigrep.ml
+@@ -285,7 +285,7 @@ let whsp = Pcre.regexp ~study:true "\\s+|$"
+ let print_type print_path path s exp =
+   List.iter
+     (function 
+-       | Tsig_type (id, type_decl, rec_status) ->
++       | Sig_type (id, type_decl, rec_status) ->
+            if match_ident exp id then begin
+              Printtyp.type_declaration id Format.std_formatter type_decl;
+              if print_path then
+@@ -302,11 +302,12 @@ let print_constructor print_path path s exp =
+   in
+   List.iter
+     (function
+-       | Tsig_type (id, type_decl, _rec_status) ->
++       | Sig_type (id, type_decl, _rec_status) ->
+            begin match type_decl.type_kind with
+            | Type_variant (constructors) ->
+                List.iter
+-                 (fun (name, type_exprs) ->
++                 (fun (name, type_exprs, _) ->
++                   let name = Ident.name name in
+                     if Pcre.pmatch ~rex:exp name then begin
+                       Format.print_string name;
+                       if type_exprs <> [] then begin
+@@ -369,7 +370,7 @@ let print_polymorphic_variant print_path path s expr =
+   in
+   List.iter
+     (function 
+-       | Tsig_type (id, type_decl, _rec_status) ->
++       | Sig_type (id, type_decl, _rec_status) ->
+            begin match type_decl.type_kind with
+            | Type_abstract -> print_if_polymorphic_variant id type_decl
+            | _ -> ()
+@@ -380,11 +381,12 @@ let print_polymorphic_variant print_path path s expr =
+ let print_record_label print_path path s exp =
+   List.iter
+     (function
+-       | Tsig_type (id, type_decl, _rec_status) ->
++       | Sig_type (id, type_decl, _rec_status) ->
+            begin match type_decl.type_kind with
+            | Type_record (labels, _) ->
+                List.iter
+                  (fun (name, mutable_flag, type_expr) ->
++                    let name = Ident.name name in
+                     if Pcre.pmatch ~rex:exp name then begin
+                       begin match mutable_flag with
+                       | Asttypes.Mutable -> Format.print_string "mutable "
+@@ -409,7 +411,7 @@ let print_record_label print_path path s exp =
+ let print_value print_path path s exp =
+   List.iter
+     (function
+-       | Tsig_value (id, desc) ->
++       | Sig_value (id, desc) ->
+            if match_ident exp id then begin
+              Printtyp.value_description id Format.str_formatter desc;
+              let s = 
+@@ -427,12 +429,12 @@ let print_value print_path path s exp =
+ let print_class print_path path s exp =
+   List.iter
+     (function
+-       | Tsig_class (id, cd, _) when match_ident exp id ->
++       | Sig_class (id, cd, _) when match_ident exp id ->
+            Printtyp.class_declaration id Format.std_formatter cd;
+            if print_path then
+              Format.print_string (Printf.sprintf " (* %s *)" path);
+            Format.print_newline ()
+-       | Tsig_cltype (id, ct, _) when match_ident exp id ->
++       | Sig_class_type (id, ct, _) when match_ident exp id ->
+            Printtyp.cltype_declaration id Format.std_formatter ct;
+            if print_path then
+              Format.print_string (Printf.sprintf " (* %s *)" path);
+@@ -444,13 +446,13 @@ let print_all print_path path s exp =
+   let new_s = 
+     List.filter 
+       (function
+-         | Tsig_value (id, _)
+-         | Tsig_type (id, _, _)
+-         | Tsig_exception (id, _)
+-         | Tsig_module (id, _, _)
+-         | Tsig_modtype (id, _)
+-         | Tsig_class (id, _, _)
+-         | Tsig_cltype (id, _, _) ->
++         | Sig_value (id, _)
++         | Sig_type (id, _, _)
++         | Sig_exception (id, _)
++         | Sig_module (id, _, _)
++         | Sig_modtype (id, _)
++         | Sig_class (id, _, _)
++         | Sig_class_type (id, _, _) ->
+              match_ident exp id)
+       s
+   in
+@@ -462,7 +464,7 @@ let print_all print_path path s exp =
+ let print_exception print_path path s exp = 
+   List.iter
+     (function 
+-       | Tsig_exception (id, exn) ->
++       | Sig_exception (id, exn) ->
+            if match_ident exp id then begin
+              Printtyp.exception_declaration id Format.std_formatter exn;
+              if print_path then
+@@ -526,15 +528,15 @@ let cmi_files args mod_expr =
+ 
+ let rec matching_submods mod_expr s =
+   match s with
+-  | Tsig_module (id, mt, _) :: tl when match_mod_expr mod_expr (Ident.name id) ->
++  | Sig_module (id, mt, _) :: tl when match_mod_expr mod_expr (Ident.name id) ->
+       begin match mt with
+-      | Tmty_signature sg -> (Ident.name id, sg) :: matching_submods mod_expr tl
+-      | Tmty_functor (_, mt, _) ->
++      | Mty_signature sg -> (Ident.name id, sg) :: matching_submods mod_expr tl
++      | Mty_functor (_, mt, _) ->
+           begin match mt with
+-          | Tmty_signature sg -> (Ident.name id, sg) :: matching_submods mod_expr tl
++          | Mty_signature sg -> (Ident.name id, sg) :: matching_submods mod_expr tl
+           | _ -> matching_submods mod_expr tl
+           end
+-      | Tmty_ident _ -> matching_submods mod_expr tl
++      | Mty_ident _ -> matching_submods mod_expr tl
+       end
+   | _ :: tl -> matching_submods mod_expr tl
+   | [] -> []
+-- 
diff --git a/debian/patches/0003-Adapt-build-system-to-OCaml-4.patch b/debian/patches/0003-Adapt-build-system-to-OCaml-4.patch
new file mode 100644
index 0000000..0496722
--- /dev/null
+++ b/debian/patches/0003-Adapt-build-system-to-OCaml-4.patch
@@ -0,0 +1,53 @@
+From: Stephane Glondu <steph at glondu.net>
+Date: Sun, 10 Nov 2013 16:33:15 +0100
+Subject: Adapt build system to OCaml >= 4
+
+---
+ Makefile | 31 ++++++-------------------------
+ 1 file changed, 6 insertions(+), 25 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 546acc6..67cc032 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,33 +1,14 @@
+-SOURCES=misc.cmx tbl.cmx config.cmx clflags.cmx terminfo.cmx ccomp.cmx	\
+-warnings.cmx consistbl.cmx linenum.cmx location.cmx longident.cmx	\
+-syntaxerr.cmx parser.cmx lexer.cmx parse.cmx printast.cmx		\
+-unused_var.cmx ident.cmx path.cmx primitive.cmx types.cmx btype.cmx	\
+-oprint.cmx subst.cmx predef.cmx datarepr.cmx env.cmx typedtree.cmx	\
+-ctype.cmx printtyp.cmx includeclass.cmx mtype.cmx includecore.cmx	\
+-includemod.cmx parmatch.cmx typetexp.cmx stypes.cmx typecore.cmx	\
+-typedecl.cmx typeclass.cmx typemod.cmx cmigrep.ml
++SOURCES=ocamlcommon.cmxa cmigrep.ml
+ 
+-BYTESOURCES=misc.cmo tbl.cmo config.cmo clflags.cmo terminfo.cmo	\
+-ccomp.cmo warnings.cmo consistbl.cmo linenum.cmo location.cmo		\
+-longident.cmo syntaxerr.cmo parser.cmo lexer.cmo parse.cmo		\
+-printast.cmo unused_var.cmo ident.cmo path.cmo primitive.cmo types.cmo	\
+-btype.cmo oprint.cmo subst.cmo predef.cmo datarepr.cmo env.cmo		\
+-typedtree.cmo ctype.cmo printtyp.cmo includeclass.cmo mtype.cmo		\
+-includecore.cmo includemod.cmo parmatch.cmo typetexp.cmo stypes.cmo	\
+-typecore.cmo typedecl.cmo typeclass.cmo typemod.cmo cmigrep.ml
+-
+-
+-GODI_CONF=$(shell godi_confdir)
+-GODI_BASE=$(shell cat $(GODI_CONF)/godi.conf | grep ^LOCALBASE | sed -e 's/LOCALBASE *= *//')
+-GODI_LIB=$(GODI_BASE)/lib/ocaml/compiler-lib
++BYTESOURCES=ocamlcommon.cma cmigrep.ml
+ 
+ all:
+-	ocamlfind ocamlopt -o cmigrep -I $(GODI_LIB) \
+-	-package pcre,findlib,unix -linkpkg $(SOURCES)
++	ocamlfind ocamlopt -o cmigrep \
++	-package pcre,findlib,unix,compiler-libs -linkpkg $(SOURCES)
+ 
+ byte:
+-	ocamlfind ocamlc -o cmigrep -I $(GODI_LIB) \
+-	-package pcre,findlib,unix -linkpkg $(BYTESOURCES)
++	ocamlfind ocamlc -o cmigrep \
++	-package pcre,findlib,unix,compiler-libs -linkpkg $(BYTESOURCES)
+ 
+ install:
+ 	cp cmigrep $(GODI_BASE)/bin
+-- 
diff --git a/debian/patches/series b/debian/patches/series
index dcce0c1..22ad952 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
-0001-Compile-without-godi.patch
-0002-No-private-flag.patch
+0001-No-private-flag.patch
+0002-Adapt-to-Types-types-of-OCaml-4.patch
+0003-Adapt-build-system-to-OCaml-4.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/cmigrep.git



More information about the Pkg-ocaml-maint-commits mailing list