Gentoo Archives: gentoo-commits

From: Alexis Ballier <aballier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-ml/capnp-ocaml/, dev-ml/capnp-ocaml/files/
Date: Sun, 02 Apr 2017 08:39:08
Message-Id: 1491122283.d0f61ab11df63dfbe0465529b841ccc36c5f5c7f.aballier@gentoo
1 commit: d0f61ab11df63dfbe0465529b841ccc36c5f5c7f
2 Author: Alexis Ballier <aballier <AT> gentoo <DOT> org>
3 AuthorDate: Sat Apr 1 22:25:29 2017 +0000
4 Commit: Alexis Ballier <aballier <AT> gentoo <DOT> org>
5 CommitDate: Sun Apr 2 08:38:03 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d0f61ab1
7
8 dev-ml/capnp-ocaml: Fix build with latest core_kernel.
9
10 Package-Manager: Portage-2.3.5, Repoman-2.3.2
11
12 dev-ml/capnp-ocaml/capnp-ocaml-2.1.1.ebuild | 5 +-
13 dev-ml/capnp-ocaml/files/core.patch | 366 ++++++++++++++++++++++++++++
14 2 files changed, 369 insertions(+), 2 deletions(-)
15
16 diff --git a/dev-ml/capnp-ocaml/capnp-ocaml-2.1.1.ebuild b/dev-ml/capnp-ocaml/capnp-ocaml-2.1.1.ebuild
17 index 56c646f2fed..8d43761a660 100644
18 --- a/dev-ml/capnp-ocaml/capnp-ocaml-2.1.1.ebuild
19 +++ b/dev-ml/capnp-ocaml/capnp-ocaml-2.1.1.ebuild
20 @@ -1,4 +1,4 @@
21 -# Copyright 1999-2016 Gentoo Foundation
22 +# Copyright 1999-2017 Gentoo Foundation
23 # Distributed under the terms of the GNU General Public License v2
24
25 EAPI=5
26 @@ -28,7 +28,8 @@ DEPEND="${RDEPEND}
27 "
28
29 src_prepare() {
30 - epatch "${FILESDIR}/mi.patch"
31 + epatch "${FILESDIR}/mi.patch" \
32 + "${FILESDIR}/core.patch"
33 }
34
35 src_compile() {
36
37 diff --git a/dev-ml/capnp-ocaml/files/core.patch b/dev-ml/capnp-ocaml/files/core.patch
38 new file mode 100644
39 index 00000000000..72265c63887
40 --- /dev/null
41 +++ b/dev-ml/capnp-ocaml/files/core.patch
42 @@ -0,0 +1,366 @@
43 +Index: capnp-ocaml-2.1.1/src/compiler/genCommon.ml
44 +===================================================================
45 +--- capnp-ocaml-2.1.1.orig/src/compiler/genCommon.ml
46 ++++ capnp-ocaml-2.1.1/src/compiler/genCommon.ml
47 +@@ -77,7 +77,7 @@ let apply_indent ~(indent : string) (lin
48 + (* Mangle a name so that it doesn't collide with any of the names in the list. *)
49 + let mangle_ident (ident : string) (idents : string list) =
50 + let rec loop mangled =
51 +- if List.mem idents mangled then
52 ++ if List.mem idents mangled String.equal then
53 + loop (mangled ^ "_")
54 + else
55 + mangled
56 +@@ -516,7 +516,7 @@ let filter_interesting_imports ~context
57 + let make_disambiguated_type_name ~context ~(mode : Mode.t) ~(scope_mode : Mode.t)
58 + ~scope ~tp node =
59 + let node_id = PS.Node.id_get node in
60 +- if List.mem scope node_id then
61 ++ if List.mem scope node_id uint64_equal then
62 + (* The node of interest is a parent node of the node being generated.
63 + this is a case where an unambiguous type is emitted. *)
64 + make_unique_typename ~context ~mode node
65 +Index: capnp-ocaml-2.1.1/src/compiler/make_includes.ml
66 +===================================================================
67 +--- capnp-ocaml-2.1.1.orig/src/compiler/make_includes.ml
68 ++++ capnp-ocaml-2.1.1/src/compiler/make_includes.ml
69 +@@ -2,29 +2,26 @@
70 + as a list of lines. This is used to perform an ocaml source inclusion,
71 + providing functor-like capability without the performance hit. *)
72 +
73 +-open Core_kernel
74 +-
75 +-
76 + let make_inclusion oc variable_name filename =
77 +- Out_channel.output_string oc ("let " ^ variable_name ^ " = [\n");
78 +- In_channel.with_file filename ~f:(fun ic ->
79 +- In_channel.iter_lines ic ~f:(fun line ->
80 ++ Core_kernel.Out_channel.output_string oc ("let " ^ variable_name ^ " = [\n");
81 ++ Core_kernel.In_channel.with_file filename ~f:(fun ic ->
82 ++ Core_kernel.In_channel.iter_lines ic ~f:(fun line ->
83 + if String.trim line = "INCLUDE \"common-inc.ml\"" then
84 +- In_channel.with_file "../runtime/common-inc.ml" ~f:(fun ic ->
85 +- In_channel.iter_lines ic ~f:(fun line ->
86 +- Out_channel.output_string oc " \" ";
87 +- Out_channel.output_string oc (String.escaped line);
88 +- Out_channel.output_string oc "\";\n"))
89 ++ Core_kernel.In_channel.with_file "../runtime/common-inc.ml" ~f:(fun ic ->
90 ++ Core_kernel.In_channel.iter_lines ic ~f:(fun line ->
91 ++ Core_kernel.Out_channel.output_string oc " \" ";
92 ++ Core_kernel.Out_channel.output_string oc (String.escaped line);
93 ++ Core_kernel.Out_channel.output_string oc "\";\n"))
94 + else begin
95 +- Out_channel.output_string oc " \"";
96 +- Out_channel.output_string oc (String.escaped line);
97 +- Out_channel.output_string oc "\";\n"
98 ++ Core_kernel.Out_channel.output_string oc " \"";
99 ++ Core_kernel.Out_channel.output_string oc (String.escaped line);
100 ++ Core_kernel.Out_channel.output_string oc "\";\n"
101 + end));
102 +- Out_channel.output_string oc "]\n\n"
103 ++ Core_kernel.Out_channel.output_string oc "]\n\n"
104 +
105 +
106 + let () =
107 +- Out_channel.with_file "includes.ml" ~f:(fun oc ->
108 ++ Core_kernel.Out_channel.with_file "includes.ml" ~f:(fun oc ->
109 + make_inclusion oc "reader_api" "../runtime/reader-inc.ml";
110 + make_inclusion oc "builder_api" "../runtime/builder-inc.ml")
111 +
112 +Index: capnp-ocaml-2.1.1/src/compiler/topsort.ml
113 +===================================================================
114 +--- capnp-ocaml-2.1.1.orig/src/compiler/topsort.ml
115 ++++ capnp-ocaml-2.1.1/src/compiler/topsort.ml
116 +@@ -83,7 +83,7 @@ let register_reference ~parentage_table
117 + else
118 + begin match Hashtbl.find edges parent_referee with
119 + | Some referrer_list ->
120 +- if List.mem referrer_list referrer then
121 ++ if List.mem referrer_list referrer uint64_equal then
122 + (* This reference is already present *)
123 + ()
124 + else
125 +@@ -199,7 +199,7 @@ let build_reference_graph
126 +
127 + let dump_reference_graph reference_graph =
128 + let () = Printf.printf "reference graph:\n" in
129 +- Hashtbl.iter reference_graph ~f:(fun ~key ~data ->
130 ++ Hashtbl.iteri reference_graph ~f:(fun ~key ~data ->
131 + let () = Printf.printf " key: %s\n" (Uint64.to_string key) in
132 + List.iter data
133 + ~f:(fun x -> Printf.printf " data: %s\n" (Uint64.to_string x)))
134 +Index: capnp-ocaml-2.1.1/src/runtime/farPointer.ml
135 +===================================================================
136 +--- capnp-ocaml-2.1.1.orig/src/runtime/farPointer.ml
137 ++++ capnp-ocaml-2.1.1/src/runtime/farPointer.ml
138 +@@ -28,7 +28,6 @@
139 + ******************************************************************************)
140 +
141 +
142 +-module Int64 = Core_kernel.Core_int64
143 + module Caml = Core_kernel.Caml
144 +
145 + type landing_pad_t =
146 +@@ -94,14 +93,14 @@ let decode (pointer64 : Int64.t) : t =
147 + Caml.Int64.to_int id64
148 + in
149 + let landing_pad =
150 +- let masked = Int64.bit_and pointer64 landing_pad_type_mask in
151 ++ let masked = Int64.logand pointer64 landing_pad_type_mask in
152 + if Int64.compare masked Int64.zero = 0 then
153 + NormalPointer
154 + else
155 + TaggedFarPointer
156 + in
157 + let offset =
158 +- let masked = Int64.bit_and pointer64 offset_mask in
159 ++ let masked = Int64.logand pointer64 offset_mask in
160 + let offset64 = Int64.shift_right_logical masked offset_shift in
161 + Caml.Int64.to_int offset64
162 + in {
163 +@@ -137,8 +136,8 @@ let encode (storage_descr : t) : Int64.t
164 + let offset64 = Int64.of_int storage_descr.offset in
165 + let segment64 = Int64.of_int storage_descr.segment_id in
166 + tag_val_far |>
167 +- Int64.bit_or (Int64.shift_left type64 landing_pad_type_shift) |>
168 +- Int64.bit_or (Int64.shift_left offset64 offset_shift) |>
169 +- Int64.bit_or (Int64.shift_left segment64 segment_shift)
170 ++ Int64.logor (Int64.shift_left type64 landing_pad_type_shift) |>
171 ++ Int64.logor (Int64.shift_left offset64 offset_shift) |>
172 ++ Int64.logor (Int64.shift_left segment64 segment_shift)
173 +
174 +
175 +Index: capnp-ocaml-2.1.1/src/runtime/fragmentBuffer.ml
176 +===================================================================
177 +--- capnp-ocaml-2.1.1.orig/src/runtime/fragmentBuffer.ml
178 ++++ capnp-ocaml-2.1.1/src/runtime/fragmentBuffer.ml
179 +@@ -36,14 +36,14 @@ module Bytes = CamlBytes
180 +
181 + type t = {
182 + (** String fragments stored in FIFO order *)
183 +- fragments : string Dequeue.t;
184 ++ fragments : string Deque.t;
185 +
186 + (** Total byte count of the fragments *)
187 + mutable fragments_size : int;
188 + }
189 +
190 + let empty () = {
191 +- fragments = Dequeue.create ();
192 ++ fragments = Deque.create ();
193 + fragments_size = 0;
194 + }
195 +
196 +@@ -52,7 +52,7 @@ let add_fragment stream fragment =
197 + if len = 0 then
198 + ()
199 + else
200 +- let () = Dequeue.enqueue_back stream.fragments fragment in
201 ++ let () = Deque.enqueue_back stream.fragments fragment in
202 + stream.fragments_size <- stream.fragments_size + len
203 +
204 + let of_string s =
205 +@@ -71,7 +71,7 @@ let remove_exact stream size =
206 + let ofs = ref 0 in
207 + while !ofs < size do
208 + let bytes_remaining = size - !ofs in
209 +- let fragment = Dequeue.dequeue_front_exn stream.fragments in
210 ++ let fragment = Deque.dequeue_front_exn stream.fragments in
211 + let bytes_from_fragment = min bytes_remaining (String.length fragment) in
212 + Bytes.blit
213 + (Bytes.unsafe_of_string fragment) 0
214 +@@ -79,7 +79,7 @@ let remove_exact stream size =
215 + bytes_from_fragment;
216 + begin if bytes_from_fragment < String.length fragment then
217 + let remainder = Util.str_slice ~start:bytes_from_fragment fragment in
218 +- Dequeue.enqueue_front stream.fragments remainder
219 ++ Deque.enqueue_front stream.fragments remainder
220 + end;
221 + ofs := !ofs + bytes_from_fragment;
222 + done;
223 +@@ -93,7 +93,7 @@ let remove_at_least stream size =
224 + else begin
225 + let buffer = Buffer.create size in
226 + while Buffer.length buffer < size do
227 +- Buffer.add_string buffer (Dequeue.dequeue_front_exn stream.fragments)
228 ++ Buffer.add_string buffer (Deque.dequeue_front_exn stream.fragments)
229 + done;
230 + stream.fragments_size <- stream.fragments_size - (Buffer.length buffer);
231 + Some (Buffer.contents buffer)
232 +@@ -102,7 +102,7 @@ let remove_at_least stream size =
233 + let peek_exact stream size =
234 + match remove_exact stream size with
235 + | Some bytes ->
236 +- let () = Dequeue.enqueue_front stream.fragments bytes in
237 ++ let () = Deque.enqueue_front stream.fragments bytes in
238 + let () = stream.fragments_size <- stream.fragments_size + size in
239 + Some bytes
240 + | None ->
241 +@@ -113,7 +113,7 @@ let unremove stream bytes =
242 + if len = 0 then
243 + ()
244 + else
245 +- let () = Dequeue.enqueue_front stream.fragments bytes in
246 ++ let () = Deque.enqueue_front stream.fragments bytes in
247 + stream.fragments_size <- stream.fragments_size + len
248 +
249 +
250 +Index: capnp-ocaml-2.1.1/src/runtime/iO.ml
251 +===================================================================
252 +--- capnp-ocaml-2.1.1.orig/src/runtime/iO.ml
253 ++++ capnp-ocaml-2.1.1/src/runtime/iO.ml
254 +@@ -49,7 +49,7 @@ module WriteContext = struct
255 + write : 'a -> buf:string -> pos:int -> len:int -> int;
256 +
257 + (** Data remaining to write to the descriptor *)
258 +- fragments : string Dequeue.t;
259 ++ fragments : string Deque.t;
260 +
261 + (** Total number of bytes stored in [fragments] *)
262 + mutable fragments_size : int;
263 +@@ -62,23 +62,23 @@ module WriteContext = struct
264 + fd;
265 + comp = compression;
266 + write;
267 +- fragments = Dequeue.create ();
268 ++ fragments = Deque.create ();
269 + fragments_size = 0;
270 + first_fragment_pos = 0;
271 + }
272 +
273 + let enqueue_message context message =
274 + Codecs.serialize_iter message ~compression:context.comp ~f:(fun buf ->
275 +- Dequeue.enqueue_back context.fragments buf;
276 ++ Deque.enqueue_back context.fragments buf;
277 + context.fragments_size <- context.fragments_size + (String.length buf))
278 +
279 + let bytes_remaining context = context.fragments_size - context.first_fragment_pos
280 +
281 + let write context =
282 +- if Dequeue.is_empty context.fragments then
283 ++ if Deque.is_empty context.fragments then
284 + 0
285 + else
286 +- let first_fragment = Dequeue.peek_front_exn context.fragments in
287 ++ let first_fragment = Deque.peek_front_exn context.fragments in
288 + let first_fragment_remaining =
289 + String.length first_fragment - context.first_fragment_pos
290 + in
291 +@@ -88,7 +88,7 @@ module WriteContext = struct
292 + in
293 + let () =
294 + if bytes_written = first_fragment_remaining then
295 +- let (_ : string) = Dequeue.dequeue_front_exn context.fragments in
296 ++ let (_ : string) = Deque.dequeue_front_exn context.fragments in
297 + let () = context.fragments_size <-
298 + context.fragments_size - (String.length first_fragment)
299 + in
300 +Index: capnp-ocaml-2.1.1/src/runtime/listPointer.ml
301 +===================================================================
302 +--- capnp-ocaml-2.1.1.orig/src/runtime/listPointer.ml
303 ++++ capnp-ocaml-2.1.1/src/runtime/listPointer.ml
304 +@@ -1,5 +1,4 @@
305 +
306 +-module Int64 = Core_kernel.Core_int64;;
307 + module Caml = Core_kernel.Caml
308 +
309 + type element_type_t =
310 +@@ -73,13 +72,13 @@ let decode (pointer64 : Int64.t) : t =
311 + }
312 + else
313 + let offset =
314 +- let masked = Int64.bit_and pointer64 offset_mask in
315 ++ let masked = Int64.logand pointer64 offset_mask in
316 + let offset64 = Int64.shift_right_logical masked offset_shift in
317 + let offset_int = Caml.Int64.to_int offset64 in
318 + Util.decode_signed 30 offset_int
319 + in
320 + let element_type =
321 +- let masked = Int64.bit_and pointer64 type_mask in
322 ++ let masked = Int64.logand pointer64 type_mask in
323 + let tp64 = Int64.shift_right_logical masked type_shift in
324 + match Caml.Int64.to_int tp64 with
325 + | 0 -> Void
326 +@@ -136,8 +135,8 @@ let encode (storage_descr : t) : Int64.t
327 + Int64.of_int type_id
328 + in
329 + tag_val_list |>
330 +- Int64.bit_or (Int64.shift_left offset64 offset_shift) |>
331 +- Int64.bit_or (Int64.shift_left type64 type_shift) |>
332 +- Int64.bit_or (Int64.shift_left (Int64.of_int storage_descr.num_elements) count_shift)
333 ++ Int64.logor (Int64.shift_left offset64 offset_shift) |>
334 ++ Int64.logor (Int64.shift_left type64 type_shift) |>
335 ++ Int64.logor (Int64.shift_left (Int64.of_int storage_descr.num_elements) count_shift)
336 +
337 +
338 +Index: capnp-ocaml-2.1.1/src/runtime/otherPointer.ml
339 +===================================================================
340 +--- capnp-ocaml-2.1.1.orig/src/runtime/otherPointer.ml
341 ++++ capnp-ocaml-2.1.1/src/runtime/otherPointer.ml
342 +@@ -28,7 +28,6 @@
343 + ******************************************************************************)
344 +
345 +
346 +-module Int64 = Core_kernel.Core_int64
347 + module Caml = Core_kernel.Caml
348 +
349 + type t =
350 +@@ -43,8 +42,8 @@ let index_shift = 32
351 + let index_mask = Int64.shift_left 0xffffffffL index_shift
352 +
353 + let decode (pointer64 : Int64.t) : t =
354 +- if Int64.compare (Int64.bit_and pointer64 b_mask) Int64.zero = 0 then
355 +- let shifted_index = Int64.bit_and pointer64 index_mask in
356 ++ if Int64.compare (Int64.logand pointer64 b_mask) Int64.zero = 0 then
357 ++ let shifted_index = Int64.logand pointer64 index_mask in
358 + let index64 = Int64.shift_right_logical shifted_index index_shift in
359 + let index32 = Caml.Int64.to_int32 index64 in
360 + Capability (Uint32.of_int32 index32)
361 +@@ -57,6 +56,6 @@ let encode (descr : t) : Int64.t =
362 + let index32 = Uint32.to_int32 index in
363 + let index64 = Int64.of_int32 index32 in
364 + let shifted_index = Int64.shift_left index64 index_shift in
365 +- Int64.bit_or shifted_index tag_val_other
366 ++ Int64.logor shifted_index tag_val_other
367 +
368 +
369 +Index: capnp-ocaml-2.1.1/src/runtime/structPointer.ml
370 +===================================================================
371 +--- capnp-ocaml-2.1.1.orig/src/runtime/structPointer.ml
372 ++++ capnp-ocaml-2.1.1/src/runtime/structPointer.ml
373 +@@ -28,7 +28,6 @@
374 + ******************************************************************************)
375 +
376 +
377 +-module Int64 = Core_kernel.Core_int64
378 + module Caml = Core_kernel.Caml
379 +
380 + type t = {
381 +@@ -79,13 +78,13 @@ let decode (pointer64 : Int64.t) : t =
382 + }
383 + else
384 + let offset =
385 +- let masked = Int64.bit_and pointer64 offset_mask in
386 ++ let masked = Int64.logand pointer64 offset_mask in
387 + let offset64 = Int64.shift_right_logical masked offset_shift in
388 + let offset_int = Caml.Int64.to_int offset64 in
389 + Util.decode_signed 30 offset_int
390 + in
391 + let data_size =
392 +- let masked = Int64.bit_and pointer64 data_size_mask in
393 ++ let masked = Int64.logand pointer64 data_size_mask in
394 + let size64 = Int64.shift_right_logical masked data_size_shift in
395 + Caml.Int64.to_int size64
396 + in {
397 +@@ -113,8 +112,8 @@ let encode (storage_descr : t) : Int64.t
398 + let data_size64 = Int64.of_int storage_descr.data_words in
399 + let ptr_size64 = Int64.of_int storage_descr.pointer_words in
400 + tag_val_struct |>
401 +- Int64.bit_or (Int64.shift_left offset64 offset_shift) |>
402 +- Int64.bit_or (Int64.shift_left data_size64 data_size_shift) |>
403 +- Int64.bit_or (Int64.shift_left ptr_size64 pointers_size_shift)
404 ++ Int64.logor (Int64.shift_left offset64 offset_shift) |>
405 ++ Int64.logor (Int64.shift_left data_size64 data_size_shift) |>
406 ++ Int64.logor (Int64.shift_left ptr_size64 pointers_size_shift)
407 +
408 +