dev-ml/ppx_sexp_message: fix build with ocaml 4.03
authorAlexis Ballier <aballier@gentoo.org>
Tue, 3 May 2016 15:46:48 +0000 (17:46 +0200)
committerAlexis Ballier <aballier@gentoo.org>
Tue, 3 May 2016 17:44:22 +0000 (19:44 +0200)
Package-Manager: portage-2.2.28
Signed-off-by: Alexis Ballier <aballier@gentoo.org>
dev-ml/ppx_sexp_message/files/oc43.patch [new file with mode: 0644]
dev-ml/ppx_sexp_message/ppx_sexp_message-113.33.00.ebuild

diff --git a/dev-ml/ppx_sexp_message/files/oc43.patch b/dev-ml/ppx_sexp_message/files/oc43.patch
new file mode 100644 (file)
index 0000000..d2d4e09
--- /dev/null
@@ -0,0 +1,90 @@
+diff -uNr ppx_sexp_message-113.33.00/_oasis ppx_sexp_message-113.33.00+4.03/_oasis
+--- ppx_sexp_message-113.33.00/_oasis  2016-03-09 16:44:54.000000000 +0100
++++ ppx_sexp_message-113.33.00+4.03/_oasis     2016-03-22 15:13:51.000000000 +0100
+@@ -1,8 +1,8 @@
+ OASISFormat:      0.4
+-OCamlVersion:     >= 4.02.3
++OCamlVersion:     >= 4.03.0
+ FindlibVersion:   >= 1.3.2
+ Name:             ppx_sexp_message
+-Version:          113.33.00
++Version:          113.33.00+4.03
+ Synopsis:         A ppx rewriter for easy construction of s-expressions
+ Authors:          Jane Street Group, LLC <opensource@janestreet.com>
+ Copyrights:       (C) 2015-2016 Jane Street Group LLC <opensource@janestreet.com>
+diff -uNr ppx_sexp_message-113.33.00/opam ppx_sexp_message-113.33.00+4.03/opam
+--- ppx_sexp_message-113.33.00/opam    2016-03-18 12:08:01.000000000 +0100
++++ ppx_sexp_message-113.33.00+4.03/opam       2016-03-22 17:51:37.000000000 +0100
+@@ -18,4 +18,4 @@
+   "ppx_sexp_conv"
+   "ppx_tools"     {>= "0.99.3"}
+ ]
+-available: [ ocaml-version >= "4.02.3" ]
++available: [ ocaml-version >= "4.03.0" ]
+diff -uNr ppx_sexp_message-113.33.00/src/ppx_sexp_message.ml ppx_sexp_message-113.33.00+4.03/src/ppx_sexp_message.ml
+--- ppx_sexp_message-113.33.00/src/ppx_sexp_message.ml 2016-03-09 16:44:54.000000000 +0100
++++ ppx_sexp_message-113.33.00+4.03/src/ppx_sexp_message.ml    2016-03-22 15:13:51.000000000 +0100
+@@ -42,13 +42,10 @@
+     eapply ~loc (evar ~loc ("Sexplib.Conv.sexp_of_" ^ typ)) [pexp_constant ~loc const]
+   in
+   match const with
+-  | Const_int       _ -> f "int"
+-  | Const_char      _ -> f "char"
+-  | Const_string    _ -> f "string"
+-  | Const_float     _ -> f "float"
+-  | Const_int32     _ -> f "int32"
+-  | Const_int64     _ -> f "int64"
+-  | Const_nativeint _ -> f "nativeint"
++  | Pconst_integer       _ -> f "int"
++  | Pconst_char      _ -> f "char"
++  | Pconst_string    _ -> f "string"
++  | Pconst_float     _ -> f "float"
+ ;;
+ let rewrite_here e =
+@@ -62,7 +59,7 @@
+   let e = rewrite_here e in
+   let loc = e.pexp_loc in
+   match e.pexp_desc with
+-  | Pexp_constant (Const_string ("", _)) ->
++  | Pexp_constant (Pconst_string ("", _)) ->
+     None
+   | Pexp_constant const ->
+     Some (sexp_of_constant ~loc const)
+@@ -71,18 +68,6 @@
+   | _ -> Some [%expr Sexplib.Conv.sexp_of_string [%e e]]
+ ;;
+-type arg_label =
+-  | Nolabel
+-  | Labelled of string
+-  | Optional
+-
+-(* Will help with the switch to 4.03 *)
+-let arg_label_of_string = function
+-  | "" -> Nolabel
+-  | s when s.[0] = '?' -> Optional
+-  | s -> Labelled s
+-;;
+-
+ let sexp_of_labelled_expr (label, e) =
+   let loc = e.pexp_loc in
+   match label, e.pexp_desc with
+@@ -97,7 +82,7 @@
+   | Labelled label, _ ->
+     Some (sexp_inline ~loc (sexp_atom ~loc (estring ~loc label)
+                             :: List.of_option (sexp_of_expr e)))
+-  | Optional, _ ->
++  | Optional _, _ ->
+     (* Could be used to encode sexp_option if that's ever needed. *)
+     Location.raise_errorf ~loc
+       "ppx_sexp_value: optional argument not allowed here"
+@@ -112,7 +97,7 @@
+   let labelled_exprs =
+     match e.pexp_desc with
+     | Pexp_apply (f, args) ->
+-      (Nolabel, f) :: List.map args ~f:(fun (label, e) -> arg_label_of_string label, e)
++      (Nolabel, f) :: args
+     | _ ->
+       (Nolabel, e) :: []
+   in
index 1c74f60de3ba6fc2c70417462684695f4abfb786..710c5fb1b17759147abbadd04d28948746578115 100644 (file)
@@ -24,6 +24,10 @@ DEPEND="dev-ml/ppx_tools:=
 RDEPEND="${DEPEND}"
 DEPEND="${DEPEND} dev-ml/opam"
 
+src_prepare() {
+       has_version '>=dev-lang/ocaml-4.03' && epatch "${FILESDIR}/oc43.patch"
+}
+
 src_configure() {
        emake setup.exe
        OASIS_SETUP_COMMAND="./setup.exe" oasis_src_configure