summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Ballier <aballier@gentoo.org>2016-05-03 16:17:16 +0200
committerAlexis Ballier <aballier@gentoo.org>2016-05-03 16:17:38 +0200
commit128a1b8f637967b5e9cd2e22d9e2e2b399e66c82 (patch)
tree9039388a12bececb1cbb68585fa445254091b3e7 /dev-ml/ppx_compare
parentdev-ml/ppx_custom_printf: fix build with ocaml 4.03 (diff)
downloadgentoo-128a1b8f637967b5e9cd2e22d9e2e2b399e66c82.tar.gz
gentoo-128a1b8f637967b5e9cd2e22d9e2e2b399e66c82.tar.bz2
gentoo-128a1b8f637967b5e9cd2e22d9e2e2b399e66c82.zip
dev-ml/ppx_compare: 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_compare')
-rw-r--r--dev-ml/ppx_compare/files/oc43.patch126
-rw-r--r--dev-ml/ppx_compare/ppx_compare-113.33.00.ebuild4
2 files changed, 130 insertions, 0 deletions
diff --git a/dev-ml/ppx_compare/files/oc43.patch b/dev-ml/ppx_compare/files/oc43.patch
new file mode 100644
index 000000000000..d346f7b4380e
--- /dev/null
+++ b/dev-ml/ppx_compare/files/oc43.patch
@@ -0,0 +1,126 @@
+diff -uNr ppx_compare-113.33.00/expander/ppx_compare_expander.ml ppx_compare-113.33.00+4.03/expander/ppx_compare_expander.ml
+--- ppx_compare-113.33.00/expander/ppx_compare_expander.ml 2016-03-09 16:44:53.000000000 +0100
++++ ppx_compare-113.33.00+4.03/expander/ppx_compare_expander.ml 2016-03-22 15:13:50.000000000 +0100
+@@ -219,53 +219,56 @@
+ if cd.pcd_res <> None then
+ Location.raise_errorf ~loc "GADTs are not supported by comparelib";
+ match cd.pcd_args with
+- | [] ->
+- let pcnstr = pconstruct cd None in
+- let pany = ppat_any ~loc in
+- let case l r n =
+- case ~guard:None ~lhs:(ppat_tuple ~loc [l; r]) ~rhs:(eint ~loc n)
+- in
+- if rightmost then
+- [ case pcnstr pcnstr 0 ]
+- else
+- [ case pcnstr pcnstr 0
+- ; case pcnstr pany (-1)
+- ; case pany pcnstr 1
+- ]
+- | tps ->
+- let ids_ty =
+- List.map tps
+- ~f:(fun ty ->
+- (gen_symbol ~prefix:"_a" (),
+- gen_symbol ~prefix:"_b" (),
+- ty))
+- in
+- let lpatt = List.map ids_ty ~f:(fun (l,_r,_ty) -> pvar ~loc l) |> ppat_tuple ~loc
+- and rpatt = List.map ids_ty ~f:(fun (_l,r,_ty) -> pvar ~loc r) |> ppat_tuple ~loc
+- and body =
+- List.map ids_ty ~f:(fun (l,r,ty) ->
+- compare_of_ty ty (evar ~loc l) (evar ~loc r))
+- |> chain_if
+- in
+- let res =
+- case ~guard:None
+- ~lhs:(ppat_tuple ~loc [ pconstruct cd (Some lpatt)
+- ; pconstruct cd (Some rpatt)
+- ])
+- ~rhs:body
+- in
+- if rightmost then
+- [ res ]
+- else
++ | Pcstr_record _ -> failwith "Pcstr_record not supported"
++ | Pcstr_tuple pcd_args ->
++ match pcd_args with
++ | [] ->
++ let pcnstr = pconstruct cd None in
+ let pany = ppat_any ~loc in
+- let pcnstr = pconstruct cd (Some pany) in
+ let case l r n =
+ case ~guard:None ~lhs:(ppat_tuple ~loc [l; r]) ~rhs:(eint ~loc n)
+ in
+- [ res
+- ; case pcnstr pany (-1)
+- ; case pany pcnstr 1
+- ])
++ if rightmost then
++ [ case pcnstr pcnstr 0 ]
++ else
++ [ case pcnstr pcnstr 0
++ ; case pcnstr pany (-1)
++ ; case pany pcnstr 1
++ ]
++ | tps ->
++ let ids_ty =
++ List.map tps
++ ~f:(fun ty ->
++ (gen_symbol ~prefix:"_a" (),
++ gen_symbol ~prefix:"_b" (),
++ ty))
++ in
++ let lpatt = List.map ids_ty ~f:(fun (l,_r,_ty) -> pvar ~loc l) |> ppat_tuple ~loc
++ and rpatt = List.map ids_ty ~f:(fun (_l,r,_ty) -> pvar ~loc r) |> ppat_tuple ~loc
++ and body =
++ List.map ids_ty ~f:(fun (l,r,ty) ->
++ compare_of_ty ty (evar ~loc l) (evar ~loc r))
++ |> chain_if
++ in
++ let res =
++ case ~guard:None
++ ~lhs:(ppat_tuple ~loc [ pconstruct cd (Some lpatt)
++ ; pconstruct cd (Some rpatt)
++ ])
++ ~rhs:body
++ in
++ if rightmost then
++ [ res ]
++ else
++ let pany = ppat_any ~loc in
++ let pcnstr = pconstruct cd (Some pany) in
++ let case l r n =
++ case ~guard:None ~lhs:(ppat_tuple ~loc [l; r]) ~rhs:(eint ~loc n)
++ in
++ [ res
++ ; case pcnstr pany (-1)
++ ; case pany pcnstr 1
++ ])
+ |> List.map ~f:List.rev
+ |> List.concat
+ |> List.rev
+diff -uNr ppx_compare-113.33.00/_oasis ppx_compare-113.33.00+4.03/_oasis
+--- ppx_compare-113.33.00/_oasis 2016-03-09 16:44:53.000000000 +0100
++++ ppx_compare-113.33.00+4.03/_oasis 2016-03-22 15:13:50.000000000 +0100
+@@ -1,8 +1,8 @@
+ OASISFormat: 0.4
+-OCamlVersion: >= 4.02.3
++OCamlVersion: >= 4.03.0
+ FindlibVersion: >= 1.3.2
+ Name: ppx_compare
+-Version: 113.33.00
++Version: 113.33.00+4.03
+ Synopsis: Generation of comparison functions from types
+ Authors: Jane Street Group, LLC <opensource@janestreet.com>
+ Copyrights: (C) 2015-2016 Jane Street Group LLC <opensource@janestreet.com>
+diff -uNr ppx_compare-113.33.00/opam ppx_compare-113.33.00+4.03/opam
+--- ppx_compare-113.33.00/opam 2016-03-18 12:08:01.000000000 +0100
++++ ppx_compare-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 --git a/dev-ml/ppx_compare/ppx_compare-113.33.00.ebuild b/dev-ml/ppx_compare/ppx_compare-113.33.00.ebuild
index 7b95ef5ae2dc..fe7683e32bae 100644
--- a/dev-ml/ppx_compare/ppx_compare-113.33.00.ebuild
+++ b/dev-ml/ppx_compare/ppx_compare-113.33.00.ebuild
@@ -24,6 +24,10 @@ DEPEND="
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