1 |
commit: 596ea1e96d7378bc8ea31648d882a0bceefec14e |
2 |
Author: Alexis Ballier <aballier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun May 1 18:10:24 2016 +0000 |
4 |
Commit: Alexis Ballier <aballier <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue May 3 09:13:52 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=596ea1e9 |
7 |
|
8 |
dev-ml/ppx_sexp_conv: fix build with ocaml 4.03 |
9 |
|
10 |
Package-Manager: portage-2.2.28 |
11 |
Signed-off-by: Alexis Ballier <aballier <AT> gentoo.org> |
12 |
|
13 |
dev-ml/ppx_sexp_conv/files/oc43.patch | 145 +++++++++++++++++++++ |
14 |
.../ppx_sexp_conv/ppx_sexp_conv-113.33.00.ebuild | 6 +- |
15 |
2 files changed, 150 insertions(+), 1 deletion(-) |
16 |
|
17 |
diff --git a/dev-ml/ppx_sexp_conv/files/oc43.patch b/dev-ml/ppx_sexp_conv/files/oc43.patch |
18 |
new file mode 100644 |
19 |
index 0000000..d95c46c |
20 |
--- /dev/null |
21 |
+++ b/dev-ml/ppx_sexp_conv/files/oc43.patch |
22 |
@@ -0,0 +1,145 @@ |
23 |
+diff -uNr ppx_sexp_conv-113.33.00/expander/ppx_sexp_conv_expander.ml ppx_sexp_conv-113.33.00+4.03/expander/ppx_sexp_conv_expander.ml |
24 |
+--- ppx_sexp_conv-113.33.00/expander/ppx_sexp_conv_expander.ml 2016-03-09 16:44:54.000000000 +0100 |
25 |
++++ ppx_sexp_conv-113.33.00+4.03/expander/ppx_sexp_conv_expander.ml 2016-03-22 15:13:51.000000000 +0100 |
26 |
+@@ -491,30 +491,33 @@ |
27 |
+ let lid = Located.map lident cnstr in |
28 |
+ let str = estring ~loc cnstr.txt in |
29 |
+ match cd.pcd_args with |
30 |
+- | [] -> |
31 |
+- ppat_construct ~loc lid None --> [%expr Sexplib.Sexp.Atom [%e str]] |
32 |
+- | args -> |
33 |
+- match args with |
34 |
+- | [ [%type: [%t? tp] sexp_list ] ] -> |
35 |
+- let cnv_expr = Fun_or_match.expr ~loc (sexp_of_type renaming tp) in |
36 |
+- ppat_construct ~loc lid (Some [%pat? l]) --> |
37 |
+- [%expr |
38 |
+- Sexplib.Sexp.List |
39 |
+- (Sexplib.Sexp.Atom [%e str] :: |
40 |
+- Sexplib.Conv.list_map [%e cnv_expr] l)] |
41 |
+- | _ -> |
42 |
+- let sexp_of_args = List.map ~f:(sexp_of_type renaming) args in |
43 |
+- let cnstr_expr = [%expr Sexplib.Sexp.Atom [%e str] ] in |
44 |
+- let bindings, patts, vars = Fun_or_match.map_tmp_vars ~loc sexp_of_args in |
45 |
+- let patt = |
46 |
+- match patts with |
47 |
+- | [patt] -> patt |
48 |
+- | _ -> ppat_tuple ~loc patts |
49 |
+- in |
50 |
+- ppat_construct ~loc lid (Some patt) --> |
51 |
+- pexp_let ~loc Nonrecursive bindings |
52 |
+- [%expr Sexplib.Sexp.List [%e elist ~loc (cnstr_expr :: vars)]] |
53 |
+- ) |
54 |
++ | Pcstr_record _ -> failwith "Pcstr_record unsupported" |
55 |
++ | Pcstr_tuple pcd_args -> |
56 |
++ match pcd_args with |
57 |
++ | [] -> |
58 |
++ ppat_construct ~loc lid None --> [%expr Sexplib.Sexp.Atom [%e str]] |
59 |
++ | args -> |
60 |
++ match args with |
61 |
++ | [ [%type: [%t? tp] sexp_list ] ] -> |
62 |
++ let cnv_expr = Fun_or_match.expr ~loc (sexp_of_type renaming tp) in |
63 |
++ ppat_construct ~loc lid (Some [%pat? l]) --> |
64 |
++ [%expr |
65 |
++ Sexplib.Sexp.List |
66 |
++ (Sexplib.Sexp.Atom [%e str] :: |
67 |
++ Sexplib.Conv.list_map [%e cnv_expr] l)] |
68 |
++ | _ -> |
69 |
++ let sexp_of_args = List.map ~f:(sexp_of_type renaming) args in |
70 |
++ let cnstr_expr = [%expr Sexplib.Sexp.Atom [%e str] ] in |
71 |
++ let bindings, patts, vars = Fun_or_match.map_tmp_vars ~loc sexp_of_args in |
72 |
++ let patt = |
73 |
++ match patts with |
74 |
++ | [patt] -> patt |
75 |
++ | _ -> ppat_tuple ~loc patts |
76 |
++ in |
77 |
++ ppat_construct ~loc lid (Some patt) --> |
78 |
++ pexp_let ~loc Nonrecursive bindings |
79 |
++ [%expr Sexplib.Sexp.List [%e elist ~loc (cnstr_expr :: vars)]] |
80 |
++ ) |
81 |
+ |
82 |
+ let sexp_of_sum tps cds = Fun_or_match.Match (branch_sum tps cds) |
83 |
+ |
84 |
+@@ -730,14 +733,14 @@ |
85 |
+ let expr = |
86 |
+ match ec with |
87 |
+ | {pext_name = {loc; txt = cnstr}; |
88 |
+- pext_kind = Pext_decl ([], None); _;} -> |
89 |
++ pext_kind = Pext_decl (Pcstr_tuple [], None); _;} -> |
90 |
+ [%expr |
91 |
+ Sexplib.Exn_magic.register [%e pexp_construct ~loc |
92 |
+ (Located.lident ~loc cnstr) None] |
93 |
+ [%e estring ~loc (get_full_cnstr cnstr)] |
94 |
+ ] |
95 |
+ | {pext_name = {loc; txt = cnstr}; |
96 |
+- pext_kind = Pext_decl (_::_ as tps, None); _;} -> |
97 |
++ pext_kind = Pext_decl (Pcstr_tuple ((_::_) as tps), None); _;} -> |
98 |
+ let fps = List.map ~f:(fun tp -> sexp_of_type renaming tp) tps in |
99 |
+ let sexp_converters = List.map fps ~f:Fun_or_match.(expr ~loc) in |
100 |
+ let _, patts, vars = Fun_or_match.map_tmp_vars ~loc fps in |
101 |
+@@ -761,6 +764,8 @@ |
102 |
+ eapply ~loc partial sexp_converters |
103 |
+ in |
104 |
+ [%expr [%e call] ] |
105 |
++ | { pext_kind = Pext_decl (Pcstr_record _, _); _;} -> |
106 |
++ failwith "Pcstr_record not supported" |
107 |
+ | { pext_kind = Pext_decl (_, Some _); _} -> |
108 |
+ Location.raise_errorf ~loc "sexp_of_exn/:" |
109 |
+ | { pext_kind = Pext_rebind _; _} -> |
110 |
+@@ -1089,13 +1094,14 @@ |
111 |
+ (* Generate matching code for well-formed S-expressions wrt. sum types *) |
112 |
+ let mk_good_sum_matches (loc,cds) = |
113 |
+ List.map cds ~f:(function |
114 |
+- | { pcd_name = cnstr; pcd_args = []; _} -> |
115 |
++ | { pcd_args = Pcstr_record _; _} -> failwith "Pcstr_record unsupported" |
116 |
++ | { pcd_name = cnstr; pcd_args = Pcstr_tuple []; _} -> |
117 |
+ let lcstr = pstring ~loc (String.uncapitalize cnstr.txt) in |
118 |
+ let str = pstring ~loc cnstr.txt in |
119 |
+ [%pat? Sexplib.Sexp.Atom ([%p lcstr] | [%p str])] --> |
120 |
+ pexp_construct ~loc (Located.lident ~loc cnstr.txt) None |
121 |
+ |
122 |
+- | { pcd_name = cnstr; pcd_args = (_::_ as tps); _} -> |
123 |
++ | { pcd_name = cnstr; pcd_args = Pcstr_tuple (_::_ as tps); _} -> |
124 |
+ let lcstr = pstring ~loc (String.uncapitalize cnstr.txt) in |
125 |
+ let str = pstring ~loc cnstr.txt in |
126 |
+ [%pat? (Sexplib.Sexp.List |
127 |
+@@ -1109,14 +1115,15 @@ |
128 |
+ wrt. sum types *) |
129 |
+ let mk_bad_sum_matches (loc,cds) = |
130 |
+ List.map cds ~f:(function |
131 |
+- | { pcd_name = cnstr; pcd_args = []; _} -> |
132 |
++ | { pcd_args = Pcstr_record _; _} -> failwith "Pcstr_record unsupported" |
133 |
++ | { pcd_name = cnstr; pcd_args = Pcstr_tuple []; _} -> |
134 |
+ let lcstr = pstring ~loc (String.uncapitalize cnstr.txt) in |
135 |
+ let str = pstring ~loc cnstr.txt in |
136 |
+ [%pat? Sexplib.Sexp.List |
137 |
+ (Sexplib.Sexp.Atom ([%p lcstr] | [%p str]) :: _) as sexp |
138 |
+ ] --> |
139 |
+ [%expr Sexplib.Conv_error.stag_no_args _tp_loc sexp] |
140 |
+- | { pcd_name = cnstr; pcd_args = _::_; _} -> |
141 |
++ | { pcd_name = cnstr; pcd_args = Pcstr_tuple (_::_); _} -> |
142 |
+ let lcstr = pstring ~loc (String.uncapitalize cnstr.txt) in |
143 |
+ let str = pstring ~loc cnstr.txt in |
144 |
+ [%pat? Sexplib.Sexp.Atom ([%p lcstr] | [%p str]) as sexp] --> |
145 |
+diff -uNr ppx_sexp_conv-113.33.00/_oasis ppx_sexp_conv-113.33.00+4.03/_oasis |
146 |
+--- ppx_sexp_conv-113.33.00/_oasis 2016-03-09 16:44:54.000000000 +0100 |
147 |
++++ ppx_sexp_conv-113.33.00+4.03/_oasis 2016-03-22 15:13:51.000000000 +0100 |
148 |
+@@ -1,8 +1,8 @@ |
149 |
+ OASISFormat: 0.4 |
150 |
+-OCamlVersion: >= 4.02.3 |
151 |
++OCamlVersion: >= 4.03.0 |
152 |
+ FindlibVersion: >= 1.3.2 |
153 |
+ Name: ppx_sexp_conv |
154 |
+-Version: 113.33.00 |
155 |
++Version: 113.33.00+4.03 |
156 |
+ Synopsis: Generation of S-expression conversion functions from type definitions |
157 |
+ Authors: Jane Street Group, LLC <opensource@××××××××××.com> |
158 |
+ Copyrights: (C) 2015-2016 Jane Street Group LLC <opensource@××××××××××.com> |
159 |
+diff -uNr ppx_sexp_conv-113.33.00/opam ppx_sexp_conv-113.33.00+4.03/opam |
160 |
+--- ppx_sexp_conv-113.33.00/opam 2016-03-18 12:08:01.000000000 +0100 |
161 |
++++ ppx_sexp_conv-113.33.00+4.03/opam 2016-03-22 17:51:37.000000000 +0100 |
162 |
+@@ -17,4 +17,4 @@ |
163 |
+ "ppx_type_conv" |
164 |
+ "sexplib" |
165 |
+ ] |
166 |
+-available: [ ocaml-version >= "4.02.3" ] |
167 |
++available: [ ocaml-version >= "4.03.0" ] |
168 |
|
169 |
diff --git a/dev-ml/ppx_sexp_conv/ppx_sexp_conv-113.33.00.ebuild b/dev-ml/ppx_sexp_conv/ppx_sexp_conv-113.33.00.ebuild |
170 |
index c94e89c..b3c3907 100644 |
171 |
--- a/dev-ml/ppx_sexp_conv/ppx_sexp_conv-113.33.00.ebuild |
172 |
+++ b/dev-ml/ppx_sexp_conv/ppx_sexp_conv-113.33.00.ebuild |
173 |
@@ -4,7 +4,7 @@ |
174 |
|
175 |
EAPI="5" |
176 |
|
177 |
-inherit oasis |
178 |
+inherit oasis eutils |
179 |
|
180 |
DESCRIPTION="Support Library for type-driven code generators" |
181 |
HOMEPAGE="http://www.janestreet.com/ocaml" |
182 |
@@ -24,6 +24,10 @@ DEPEND="dev-ml/ppx_tools:= |
183 |
RDEPEND="${DEPEND}" |
184 |
DEPEND="${DEPEND} dev-ml/opam" |
185 |
|
186 |
+src_prepare() { |
187 |
+ has_version '>=dev-lang/ocaml-4.03' && epatch "${FILESDIR}/oc43.patch" |
188 |
+} |
189 |
+ |
190 |
src_configure() { |
191 |
emake setup.exe |
192 |
OASIS_SETUP_COMMAND="./setup.exe" oasis_src_configure |