summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Ballier <aballier@gentoo.org>2016-05-03 16:57:24 +0200
committerAlexis Ballier <aballier@gentoo.org>2016-05-03 19:44:22 +0200
commitfca565081ff32059d122499399258832dffdf481 (patch)
tree147cfe7229a607d723f6527793add3d32706648f /dev-ml/ppx_bin_prot
parentdev-ml/ppx_variants_conv: fix build with ocaml 4.03 (diff)
downloadgentoo-fca565081ff32059d122499399258832dffdf481.tar.gz
gentoo-fca565081ff32059d122499399258832dffdf481.tar.bz2
gentoo-fca565081ff32059d122499399258832dffdf481.zip
dev-ml/ppx_bin_prot: fix build with ocaml 4.03
Package-Manager: portage-2.2.28 Signed-off-by: Alexis Ballier <aballier@gentoo.org>
Diffstat (limited to 'dev-ml/ppx_bin_prot')
-rw-r--r--dev-ml/ppx_bin_prot/files/oc43.patch113
-rw-r--r--dev-ml/ppx_bin_prot/ppx_bin_prot-113.33.00.ebuild4
2 files changed, 117 insertions, 0 deletions
diff --git a/dev-ml/ppx_bin_prot/files/oc43.patch b/dev-ml/ppx_bin_prot/files/oc43.patch
new file mode 100644
index 000000000000..d328d5bc55fa
--- /dev/null
+++ b/dev-ml/ppx_bin_prot/files/oc43.patch
@@ -0,0 +1,113 @@
+diff -uNr ppx_bin_prot-113.33.00/_oasis ppx_bin_prot-113.33.00+4.03/_oasis
+--- ppx_bin_prot-113.33.00/_oasis 2016-03-09 16:44:53.000000000 +0100
++++ ppx_bin_prot-113.33.00+4.03/_oasis 2016-03-22 15:13:49.000000000 +0100
+@@ -1,8 +1,8 @@
+ OASISFormat: 0.4
+-OCamlVersion: >= 4.02.3
++OCamlVersion: >= 4.03.0
+ FindlibVersion: >= 1.3.2
+ Name: ppx_bin_prot
+-Version: 113.33.00
++Version: 113.33.00+4.03
+ Synopsis: Generation of bin_prot readers and writers from types
+ Authors: Jane Street Group, LLC <opensource@janestreet.com>
+ Copyrights: (C) 2015-2016 Jane Street Group LLC <opensource@janestreet.com>
+diff -uNr ppx_bin_prot-113.33.00/opam ppx_bin_prot-113.33.00+4.03/opam
+--- ppx_bin_prot-113.33.00/opam 2016-03-18 12:08:01.000000000 +0100
++++ ppx_bin_prot-113.33.00+4.03/opam 2016-03-22 17:51:35.000000000 +0100
+@@ -17,4 +17,4 @@
+ "ppx_tools" {>= "0.99.3"}
+ "ppx_type_conv"
+ ]
+-available: [ ocaml-version >= "4.02.3" ]
++available: [ ocaml-version >= "4.03.0" ]
+diff -uNr ppx_bin_prot-113.33.00/src/ppx_bin_prot.ml ppx_bin_prot-113.33.00+4.03/src/ppx_bin_prot.ml
+--- ppx_bin_prot-113.33.00/src/ppx_bin_prot.ml 2016-03-09 16:44:53.000000000 +0100
++++ ppx_bin_prot-113.33.00+4.03/src/ppx_bin_prot.ml 2016-03-22 15:13:49.000000000 +0100
+@@ -37,7 +37,7 @@
+ ~init:result_type
+ ~f:(fun (tp, _variance) acc ->
+ let loc = tp.ptyp_loc in
+- ptyp_arrow ~loc "" (wrap_type ~loc tp) acc)
++ ptyp_arrow ~loc Nolabel (wrap_type ~loc tp) acc)
+ in
+ psig_value ~loc (value_description ~loc ~name ~type_:typ ~prim:[])
+
+@@ -72,7 +72,12 @@
+ | Rinherit _ -> false)
+ ;;
+
+-let atoms_in_variant cds = List.exists cds ~f:(fun cds -> cds.pcd_args = [])
++let atoms_in_variant cds =
++ List.exists cds ~f:(fun cds ->
++ match cds.pcd_args with
++ | Pcstr_tuple [] -> true
++ | Pcstr_tuple _ -> false
++ | Pcstr_record _ -> failwith "Pcstr_record not supported")
+
+ let let_ins loc bindings expr =
+ List.fold_right bindings ~init:expr ~f:(fun binding expr ->
+@@ -327,8 +332,8 @@
+ Location.raise_errorf ~loc:ty.ptyp_loc
+ "bin_size_sum: GADTs are not supported by bin_prot");
+ match cd.pcd_args with
+- | [] -> acc
+- | args ->
++ | Pcstr_tuple [] -> acc
++ | Pcstr_tuple args ->
+ let get_tp tp = tp in
+ let mk_patt loc v_name _ = pvar ~loc v_name in
+ let patts, size_args =
+@@ -344,7 +349,8 @@
+ let size = [%e size_tag] in
+ [%e size_args]
+ ]
+- :: acc)
++ :: acc
++ | Pcstr_record _ -> failwith "Pcstr_record not supported")
+ in
+ let matchings =
+ if atoms_in_variant alts then
+@@ -585,13 +591,13 @@
+ Location.raise_errorf ~loc:ty.ptyp_loc
+ "bin_write_sum: GADTs are not supported by bin_prot");
+ match cd.pcd_args with
+- | [] ->
++ | Pcstr_tuple [] ->
+ let loc = cd.pcd_loc in
+ case
+ ~lhs:(pconstruct cd None)
+ ~guard:None
+ ~rhs:(eapply ~loc write_tag [eint ~loc i])
+- | args ->
++ | Pcstr_tuple args ->
+ let get_tp tp = tp in
+ let mk_patt loc v_name _ = pvar ~loc v_name in
+ let patts, write_args =
+@@ -606,7 +612,8 @@
+ ~rhs:[%expr
+ let pos = [%e write_tag] [%e eint ~loc i] in
+ [%e write_args]
+- ])
++ ]
++ | Pcstr_record _ -> failwith "Pcstr_record not supported")
+ in
+ `Match matchings
+
+@@ -934,13 +941,14 @@
+ Location.raise_errorf ~loc:cd.pcd_loc
+ "bin_read_sum: GADTs are not supported by bin_prot");
+ match cd.pcd_args with
+- | [] ->
++ | Pcstr_tuple [] ->
+ let loc = cd.pcd_loc in
+ case ~lhs:(pint ~loc mi) ~guard:None ~rhs:(econstruct cd None)
+- | args ->
++ | Pcstr_tuple args ->
+ let bindings, args_expr = handle_arg_tp loc full_type_name args in
+ let rhs = let_ins loc bindings (econstruct cd (Some args_expr)) in
+ case ~lhs:(pint ~loc mi) ~guard:None ~rhs
++ | Pcstr_record _ -> failwith "Pcstr_record not supported"
+ in
+ let mcs = List.mapi alts ~f:map in
+ let n_alts = List.length alts in
diff --git a/dev-ml/ppx_bin_prot/ppx_bin_prot-113.33.00.ebuild b/dev-ml/ppx_bin_prot/ppx_bin_prot-113.33.00.ebuild
index 50cf6692c41d..88ae9f7aaa3d 100644
--- a/dev-ml/ppx_bin_prot/ppx_bin_prot-113.33.00.ebuild
+++ b/dev-ml/ppx_bin_prot/ppx_bin_prot-113.33.00.ebuild
@@ -27,6 +27,10 @@ DEPEND="${DEPEND} dev-ml/opam"
S="${WORKDIR}/${MY_P}"
+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