Skip to content

Commit

Permalink
dev-ml/ppx_sexp_message: fix build with ocaml 4.03
Browse files Browse the repository at this point in the history
Package-Manager: portage-2.2.28
Signed-off-by: Alexis Ballier <[email protected]>
  • Loading branch information
aballier committed May 3, 2016
1 parent 7aab055 commit 2775fe2
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
90 changes: 90 additions & 0 deletions dev-ml/ppx_sexp_message/files/oc43.patch
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
Copyrights: (C) 2015-2016 Jane Street Group LLC <[email protected]>
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
4 changes: 4 additions & 0 deletions dev-ml/ppx_sexp_message/ppx_sexp_message-113.33.00.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2775fe2

Please sign in to comment.