commit:     844662b66f65e88ea8bce1d33108599f4fe6a7e4
Author:     Alexis Ballier <aballier <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 13 22:22:57 2017 +0000
Commit:     Alexis Ballier <aballier <AT> gentoo <DOT> org>
CommitDate: Thu Jul 13 22:26:19 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=844662b6

dev-ml/ppx_deriving_yojson: fix build with ocaml 4.05

Package-Manager: Portage-2.3.6, Repoman-2.3.2

 dev-ml/ppx_deriving_yojson/files/ocaml405.patch    | 76 ++++++++++++++++++++++
 .../ppx_deriving_yojson-3.0.ebuild                 |  8 ++-
 2 files changed, 83 insertions(+), 1 deletion(-)

diff --git a/dev-ml/ppx_deriving_yojson/files/ocaml405.patch 
b/dev-ml/ppx_deriving_yojson/files/ocaml405.patch
new file mode 100644
index 00000000000..33440fabdd1
--- /dev/null
+++ b/dev-ml/ppx_deriving_yojson/files/ocaml405.patch
@@ -0,0 +1,76 @@
+Index: ppx_deriving_yojson-3.0/src/ppx_deriving_yojson.cppo.ml
+===================================================================
+--- ppx_deriving_yojson-3.0.orig/src/ppx_deriving_yojson.cppo.ml
++++ ppx_deriving_yojson-3.0/src/ppx_deriving_yojson.cppo.ml
+@@ -260,7 +260,7 @@ let ser_str_of_type ~options ~path ({ pt
+       let polymorphize_ser  = Ppx_deriving.poly_arrow_of_type_decl
+         (fun var -> [%type: [%t var] -> Yojson.Safe.json]) type_decl
+       in
+-      let ty = Typ.poly poly_vars (polymorphize_ser [%type: [%t typ] -> 
Yojson.Safe.json]) in
++      let ty = Typ.poly (List.map Location.mknoloc poly_vars) 
(polymorphize_ser [%type: [%t typ] -> Yojson.Safe.json]) in
+       let default_fun =
+         let type_path = String.concat "." (path @ [type_decl.ptype_name.txt]) 
in
+         let e_type_path = Exp.constant (Pconst_string (type_path, None)) in
+@@ -270,7 +270,7 @@ let ser_str_of_type ~options ~path ({ pt
+       in
+       let poly_fun = polymorphize default_fun in
+       let poly_fun =
+-        (Ppx_deriving.fold_left_type_decl (fun exp name -> Exp.newtype name 
exp) poly_fun type_decl)
++        (Ppx_deriving.fold_left_type_decl (fun exp name -> Exp.newtype 
(Location.mknoloc name) exp) poly_fun type_decl)
+       in
+       let mod_name = "M_"^to_yojson_name in
+       let typ = Type.mk ~kind:(Ptype_record [Type.field ~mut:Mutable (mknoloc 
"f") ty])
+@@ -337,7 +337,7 @@ let ser_str_of_type ~options ~path ({ pt
+         raise_errorf ~loc "%s cannot be derived for fully abstract types" 
deriver
+     in
+     let ty = ser_type_of_decl ~options ~path type_decl in
+-    let fv = Ppx_deriving.free_vars_in_core_type ty in
++    let fv = List.map Location.mknoloc (Ppx_deriving.free_vars_in_core_type 
ty) in
+     let poly_type = Typ.force_poly @@ Typ.poly fv @@ ty in
+     let var = pvar (Ppx_deriving.mangle_type_decl (`Suffix "to_yojson") 
type_decl) in
+     ([],
+@@ -431,7 +431,7 @@ let desu_str_of_type ~options ~path ({ p
+       raise_errorf ~loc "%s: extensible type manifest should be a type name" 
deriver
+     | None ->
+       let poly_vars = List.rev
+-        (Ppx_deriving.fold_left_type_decl (fun acc name -> name :: acc) [] 
type_decl)
++        (List.map Location.mknoloc (Ppx_deriving.fold_left_type_decl (fun acc 
name -> name :: acc) [] type_decl))
+       in
+       let polymorphize_desu = Ppx_deriving.poly_arrow_of_type_decl
+         (fun var -> [%type: Yojson.Safe.json -> [%t error_or var]]) type_decl 
in
+@@ -441,7 +441,7 @@ let desu_str_of_type ~options ~path ({ p
+       let default_fun = Exp.function_ [Exp.case [%pat? _] top_error] in
+       let poly_fun = polymorphize default_fun in
+       let poly_fun =
+-        (Ppx_deriving.fold_left_type_decl (fun exp name -> Exp.newtype name 
exp) poly_fun type_decl)
++        (Ppx_deriving.fold_left_type_decl (fun exp name -> Exp.newtype 
(Location.mknoloc name) exp) poly_fun type_decl)
+       in
+       let mod_name = "M_"^of_yojson_name in
+       let typ = Type.mk ~kind:(Ptype_record [Type.field ~mut:Mutable (mknoloc 
"f") ty])
+@@ -514,7 +514,7 @@ let desu_str_of_type ~options ~path ({ p
+         raise_errorf ~loc "%s cannot be derived for fully abstract types" 
deriver
+     in
+     let ty = desu_type_of_decl ~options ~path type_decl in
+-    let fv = Ppx_deriving.free_vars_in_core_type ty in
++    let fv = List.map Location.mknoloc (Ppx_deriving.free_vars_in_core_type 
ty) in
+     let poly_type = Typ.force_poly @@ Typ.poly fv @@ ty in
+     let var = pvar (Ppx_deriving.mangle_type_decl (`Suffix "of_yojson") 
type_decl) in
+     ([],
+@@ -579,7 +579,7 @@ let ser_sig_of_type ~options ~path type_
+       (`PrefixSuffix ("M", "to_yojson")) type_decl
+     in
+     let poly_vars = List.rev
+-      (Ppx_deriving.fold_left_type_decl (fun acc name -> name :: acc) [] 
type_decl)
++      (List.map Location.mknoloc (Ppx_deriving.fold_left_type_decl (fun acc 
name -> name :: acc) [] type_decl))
+     in
+     let typ = Ppx_deriving.core_type_of_type_decl type_decl in
+     let polymorphize_ser  = Ppx_deriving.poly_arrow_of_type_decl
+@@ -614,7 +614,7 @@ let desu_sig_of_type ~options ~path type
+       (`PrefixSuffix ("M", "of_yojson")) type_decl
+     in
+     let poly_vars = List.rev
+-      (Ppx_deriving.fold_left_type_decl (fun acc name -> name :: acc) [] 
type_decl)
++      (List.map Location.mknoloc (Ppx_deriving.fold_left_type_decl (fun acc 
name -> name :: acc) [] type_decl))
+     in
+     let typ = Ppx_deriving.core_type_of_type_decl type_decl in
+     let polymorphize_desu = Ppx_deriving.poly_arrow_of_type_decl

diff --git a/dev-ml/ppx_deriving_yojson/ppx_deriving_yojson-3.0.ebuild 
b/dev-ml/ppx_deriving_yojson/ppx_deriving_yojson-3.0.ebuild
index c6b55db684d..f2a359e3470 100644
--- a/dev-ml/ppx_deriving_yojson/ppx_deriving_yojson-3.0.ebuild
+++ b/dev-ml/ppx_deriving_yojson/ppx_deriving_yojson-3.0.ebuild
@@ -1,8 +1,10 @@
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=5
 
+inherit eutils
+
 DESCRIPTION="A Yojson codec generator for OCaml"
 HOMEPAGE="https://github.com/whitequark/ppx_deriving_yojson/";
 
SRC_URI="https://github.com/whitequark/ppx_deriving_yojson/archive/v${PV}.tar.gz
 -> ${P}.tar.gz"
@@ -25,6 +27,10 @@ DEPEND="${DEPEND}
        dev-ml/ocamlbuild
        test? ( dev-ml/ounit dev-ml/ppx_import )"
 
+src_prepare() {
+       has_version '>=dev-lang/ocaml-4.05_rc' && epatch 
"${FILESDIR}/ocaml405.patch"
+}
+
 src_compile() {
        cp pkg/META.in pkg/META
        ocaml pkg/build.ml \

Reply via email to