1 |
commit: 1a54f9a1015c47079fa8a49586b1ecbc03d40482 |
2 |
Author: Alexis Ballier <aballier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Mar 3 12:07:20 2017 +0000 |
4 |
Commit: Alexis Ballier <aballier <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Mar 3 12:07:20 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1a54f9a1 |
7 |
|
8 |
dev-ml/labltk: Fix build with ocaml 4.05 |
9 |
|
10 |
Package-Manager: Portage-2.3.4, Repoman-2.3.2 |
11 |
|
12 |
dev-ml/labltk/files/ocaml405.patch | 382 +++++++++++++++++++++++++++++++++++++ |
13 |
dev-ml/labltk/labltk-8.06.2.ebuild | 1 + |
14 |
2 files changed, 383 insertions(+) |
15 |
|
16 |
diff --git a/dev-ml/labltk/files/ocaml405.patch b/dev-ml/labltk/files/ocaml405.patch |
17 |
new file mode 100644 |
18 |
index 00000000000..8503646f71e |
19 |
--- /dev/null |
20 |
+++ b/dev-ml/labltk/files/ocaml405.patch |
21 |
@@ -0,0 +1,382 @@ |
22 |
+Index: labltk-8.06.2/support/cltkCaml.c |
23 |
+=================================================================== |
24 |
+--- labltk-8.06.2.orig/support/cltkCaml.c |
25 |
++++ labltk-8.06.2/support/cltkCaml.c |
26 |
+@@ -39,7 +39,7 @@ int CamlCBCmd(ClientData clientdata, Tcl |
27 |
+ int id; |
28 |
+ if (Tcl_GetInt(interp, argv[1], &id) != TCL_OK) |
29 |
+ return TCL_ERROR; |
30 |
+- callback2(*handler_code,Val_int(id), |
31 |
++ caml_callback2(*handler_code,Val_int(id), |
32 |
+ copy_string_list(argc - 2,(char **)&argv[2])); |
33 |
+ /* Never fails (OCaml would have raised an exception) */ |
34 |
+ /* but result may have been set by callback */ |
35 |
+@@ -65,7 +65,7 @@ CAMLprim value camltk_return (value v) |
36 |
+ /* Note: raise_with_string WILL copy the error message */ |
37 |
+ CAMLprim void tk_error(const char *errmsg) |
38 |
+ { |
39 |
+- raise_with_string(*tkerror_exn, errmsg); |
40 |
++ caml_raise_with_string(*tkerror_exn, errmsg); |
41 |
+ } |
42 |
+ |
43 |
+ |
44 |
+Index: labltk-8.06.2/support/cltkDMain.c |
45 |
+=================================================================== |
46 |
+--- labltk-8.06.2.orig/support/cltkDMain.c |
47 |
++++ labltk-8.06.2/support/cltkDMain.c |
48 |
+@@ -56,7 +56,7 @@ void invoke_pending_caml_signals (client |
49 |
+ /* Rearm timer */ |
50 |
+ Tk_CreateTimerHandler(SIGNAL_INTERVAL, invoke_pending_caml_signals, NULL); |
51 |
+ signal_events = 1; |
52 |
+- leave_blocking_section(); |
53 |
++ caml_leave_blocking_section(); |
54 |
+ } |
55 |
+ /* The following is taken from byterun/startup.c */ |
56 |
+ header_t atom_table[256]; |
57 |
+@@ -222,10 +222,10 @@ int Caml_Init(interp) |
58 |
+ strcat(f, RCNAME); |
59 |
+ if (0 == access(f,R_OK)) |
60 |
+ if (TCL_OK != Tcl_EvalFile(cltclinterp,f)) { |
61 |
+- stat_free(f); |
62 |
++ caml_stat_free(f); |
63 |
+ tk_error(Tcl_GetStringResult(cltclinterp)); |
64 |
+ }; |
65 |
+- stat_free(f); |
66 |
++ caml_stat_free(f); |
67 |
+ } |
68 |
+ } |
69 |
+ |
70 |
+Index: labltk-8.06.2/support/cltkEval.c |
71 |
+=================================================================== |
72 |
+--- labltk-8.06.2.orig/support/cltkEval.c |
73 |
++++ labltk-8.06.2/support/cltkEval.c |
74 |
+@@ -45,7 +45,7 @@ value copy_string_list(int argc, char ** |
75 |
+ for (i = argc-1; i >= 0; i--) { |
76 |
+ oldres = res; |
77 |
+ str = tcl_string_to_caml(argv[i]); |
78 |
+- res = alloc(2, 0); |
79 |
++ res = caml_alloc(2, 0); |
80 |
+ Field(res, 0) = str; |
81 |
+ Field(res, 1) = oldres; |
82 |
+ } |
83 |
+@@ -71,7 +71,7 @@ CAMLprim value camltk_tcl_eval(value str |
84 |
+ Tcl_ResetResult(cltclinterp); |
85 |
+ cmd = caml_string_to_tcl(str); |
86 |
+ code = Tcl_Eval(cltclinterp, cmd); |
87 |
+- stat_free(cmd); |
88 |
++ caml_stat_free(cmd); |
89 |
+ |
90 |
+ switch (code) { |
91 |
+ case TCL_OK: |
92 |
+@@ -143,8 +143,8 @@ int fill_args (char **argv, int where, v |
93 |
+ fill_args(tmpargv,0,Field(v,0)); |
94 |
+ tmpargv[size] = NULL; |
95 |
+ merged = Tcl_Merge(size,(const char *const*)tmpargv); |
96 |
+- for(i = 0; i<size; i++){ stat_free(tmpargv[i]); } |
97 |
+- stat_free((char *)tmpargv); |
98 |
++ for(i = 0; i<size; i++){ caml_stat_free(tmpargv[i]); } |
99 |
++ caml_stat_free((char *)tmpargv); |
100 |
+ /* must be freed by stat_free */ |
101 |
+ argv[where] = (char*)caml_stat_alloc(strlen(merged)+1); |
102 |
+ strcpy(argv[where], merged); |
103 |
+@@ -227,10 +227,10 @@ CAMLprim value camltk_tcl_direct_eval(va |
104 |
+ |
105 |
+ /* Free the various things we allocated */ |
106 |
+ for(i=0; i< size; i ++){ |
107 |
+- stat_free((char *) allocated[i]); |
108 |
++ caml_stat_free((char *) allocated[i]); |
109 |
+ } |
110 |
+- stat_free((char *)argv); |
111 |
+- stat_free((char *)allocated); |
112 |
++ caml_stat_free((char *)argv); |
113 |
++ caml_stat_free((char *)allocated); |
114 |
+ |
115 |
+ switch (result) { |
116 |
+ case TCL_OK: |
117 |
+Index: labltk-8.06.2/support/cltkEvent.c |
118 |
+=================================================================== |
119 |
+--- labltk-8.06.2.orig/support/cltkEvent.c |
120 |
++++ labltk-8.06.2/support/cltkEvent.c |
121 |
+@@ -49,6 +49,6 @@ CAMLprim value camltk_dooneevent(value f |
122 |
+ |
123 |
+ CheckInit(); |
124 |
+ |
125 |
+- ret = Tk_DoOneEvent(convert_flag_list(flags, event_flag_table)); |
126 |
++ ret = Tk_DoOneEvent(caml_convert_flag_list(flags, event_flag_table)); |
127 |
+ return Val_int(ret); |
128 |
+ } |
129 |
+Index: labltk-8.06.2/support/cltkFile.c |
130 |
+=================================================================== |
131 |
+--- labltk-8.06.2.orig/support/cltkFile.c |
132 |
++++ labltk-8.06.2/support/cltkFile.c |
133 |
+@@ -33,7 +33,7 @@ |
134 |
+ |
135 |
+ void FileProc(ClientData clientdata, int mask) |
136 |
+ { |
137 |
+- callback2(*handler_code,Val_int(clientdata),Val_int(0)); |
138 |
++ caml_callback2(*handler_code,Val_int(clientdata),Val_int(0)); |
139 |
+ } |
140 |
+ |
141 |
+ /* Map Unix.file_descr values to Tcl file handles */ |
142 |
+Index: labltk-8.06.2/support/cltkImg.c |
143 |
+=================================================================== |
144 |
+--- labltk-8.06.2.orig/support/cltkImg.c |
145 |
++++ labltk-8.06.2/support/cltkImg.c |
146 |
+@@ -47,7 +47,7 @@ CAMLprim value camltk_getimgdata (value |
147 |
+ |
148 |
+ code = Tk_PhotoGetImage(ph,&pib); /* never fails ? */ |
149 |
+ size = pib.width * pib.height * pib.pixelSize; |
150 |
+- res = alloc_string(size); |
151 |
++ res = caml_alloc_string(size); |
152 |
+ |
153 |
+ /* no holes, default format ? */ |
154 |
+ if ((pib.pixelSize == 3) && |
155 |
+Index: labltk-8.06.2/support/cltkMain.c |
156 |
+=================================================================== |
157 |
+--- labltk-8.06.2.orig/support/cltkMain.c |
158 |
++++ labltk-8.06.2/support/cltkMain.c |
159 |
+@@ -51,11 +51,11 @@ int signal_events = 0; /* do we have a p |
160 |
+ void invoke_pending_caml_signals (ClientData clientdata) |
161 |
+ { |
162 |
+ signal_events = 0; |
163 |
+- enter_blocking_section(); /* triggers signal handling */ |
164 |
++ caml_enter_blocking_section(); /* triggers signal handling */ |
165 |
+ /* Rearm timer */ |
166 |
+ Tk_CreateTimerHandler(SIGNAL_INTERVAL, invoke_pending_caml_signals, NULL); |
167 |
+ signal_events = 1; |
168 |
+- leave_blocking_section(); |
169 |
++ caml_leave_blocking_section(); |
170 |
+ } |
171 |
+ |
172 |
+ /* Now the real Tk stuff */ |
173 |
+@@ -77,7 +77,7 @@ CAMLprim value camltk_opentk(value argv) |
174 |
+ tmp = Val_unit; |
175 |
+ |
176 |
+ if ( argv == Val_int(0) ){ |
177 |
+- failwith("camltk_opentk: argv is empty"); |
178 |
++ caml_failwith("camltk_opentk: argv is empty"); |
179 |
+ } |
180 |
+ argv0 = String_val( Field( argv, 0 ) ); |
181 |
+ |
182 |
+@@ -91,7 +91,7 @@ CAMLprim value camltk_opentk(value argv) |
183 |
+ /* Register cltclinterp for use in other related extensions */ |
184 |
+ value *interp = caml_named_value("cltclinterp"); |
185 |
+ if (interp != NULL) |
186 |
+- Store_field(*interp,0,copy_nativeint((intnat)cltclinterp)); |
187 |
++ Store_field(*interp,0,caml_copy_nativeint((intnat)cltclinterp)); |
188 |
+ } |
189 |
+ |
190 |
+ if (Tcl_Init(cltclinterp) != TCL_OK) |
191 |
+@@ -128,7 +128,7 @@ CAMLprim value camltk_opentk(value argv) |
192 |
+ args = Tcl_Merge(argc, (const char *const*)tkargv); /* args must be freed by Tcl_Free */ |
193 |
+ Tcl_SetVar(cltclinterp, "argv", args, TCL_GLOBAL_ONLY); |
194 |
+ Tcl_Free(args); |
195 |
+- stat_free( tkargv ); |
196 |
++ caml_stat_free( tkargv ); |
197 |
+ } |
198 |
+ } |
199 |
+ if (Tk_Init(cltclinterp) != TCL_OK) |
200 |
+@@ -164,10 +164,10 @@ CAMLprim value camltk_opentk(value argv) |
201 |
+ strcat(f, RCNAME); |
202 |
+ if (0 == access(f,R_OK)) |
203 |
+ if (TCL_OK != Tcl_EvalFile(cltclinterp,f)) { |
204 |
+- stat_free(f); |
205 |
++ caml_stat_free(f); |
206 |
+ tk_error(Tcl_GetStringResult(cltclinterp)); |
207 |
+ }; |
208 |
+- stat_free(f); |
209 |
++ caml_stat_free(f); |
210 |
+ } |
211 |
+ } |
212 |
+ |
213 |
+Index: labltk-8.06.2/support/cltkMisc.c |
214 |
+=================================================================== |
215 |
+--- labltk-8.06.2.orig/support/cltkMisc.c |
216 |
++++ labltk-8.06.2/support/cltkMisc.c |
217 |
+@@ -41,12 +41,12 @@ CAMLprim value camltk_splitlist (value v |
218 |
+ { value res = copy_string_list(argc,argv); |
219 |
+ Tcl_Free((char *)argv); /* only one large block was allocated */ |
220 |
+ /* argv points into utf: utf must be freed after argv are freed */ |
221 |
+- stat_free( utf ); |
222 |
++ caml_stat_free( utf ); |
223 |
+ return res; |
224 |
+ } |
225 |
+ case TCL_ERROR: |
226 |
+ default: |
227 |
+- stat_free( utf ); |
228 |
++ caml_stat_free( utf ); |
229 |
+ tk_error(Tcl_GetStringResult(cltclinterp)); |
230 |
+ } |
231 |
+ } |
232 |
+@@ -54,7 +54,7 @@ CAMLprim value camltk_splitlist (value v |
233 |
+ /* Copy an OCaml string to the C heap. Should deallocate with stat_free */ |
234 |
+ char *string_to_c(value s) |
235 |
+ { |
236 |
+- int l = string_length(s); |
237 |
++ int l = caml_string_length(s); |
238 |
+ char *res = caml_stat_alloc(l + 1); |
239 |
+ memmove (res, String_val (s), l); |
240 |
+ res[l] = '\0'; |
241 |
+Index: labltk-8.06.2/support/cltkTimer.c |
242 |
+=================================================================== |
243 |
+--- labltk-8.06.2.orig/support/cltkTimer.c |
244 |
++++ labltk-8.06.2/support/cltkTimer.c |
245 |
+@@ -26,7 +26,7 @@ |
246 |
+ /* Basically the same thing as FileProc */ |
247 |
+ void TimerProc (ClientData clientdata) |
248 |
+ { |
249 |
+- callback2(*handler_code,Val_long(clientdata),Val_int(0)); |
250 |
++ caml_callback2(*handler_code,Val_long(clientdata),Val_int(0)); |
251 |
+ } |
252 |
+ |
253 |
+ CAMLprim value camltk_add_timer(value milli, value cbid) |
254 |
+Index: labltk-8.06.2/support/cltkUtf.c |
255 |
+=================================================================== |
256 |
+--- labltk-8.06.2.orig/support/cltkUtf.c |
257 |
++++ labltk-8.06.2/support/cltkUtf.c |
258 |
+@@ -76,14 +76,14 @@ value tcl_string_to_caml( const char *s |
259 |
+ char *str; |
260 |
+ |
261 |
+ str = utf_to_external( s ); |
262 |
+- res = copy_string(str); |
263 |
+- stat_free(str); |
264 |
++ res = caml_copy_string(str); |
265 |
++ caml_stat_free(str); |
266 |
+ CAMLreturn(res); |
267 |
+ } |
268 |
+ |
269 |
+ #else |
270 |
+ |
271 |
+ char *caml_string_to_tcl(value s){ return string_to_c(s); } |
272 |
+-value tcl_string_to_caml(char *s){ return copy_string(s); } |
273 |
++value tcl_string_to_caml(char *s){ return caml_copy_string(s); } |
274 |
+ |
275 |
+ #endif |
276 |
+Index: labltk-8.06.2/support/cltkVar.c |
277 |
+=================================================================== |
278 |
+--- labltk-8.06.2.orig/support/cltkVar.c |
279 |
++++ labltk-8.06.2/support/cltkVar.c |
280 |
+@@ -35,7 +35,7 @@ CAMLprim value camltk_getvar(value var) |
281 |
+ stable_var = string_to_c(var); |
282 |
+ s = (char *)Tcl_GetVar(cltclinterp,stable_var, |
283 |
+ TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG); |
284 |
+- stat_free(stable_var); |
285 |
++ caml_stat_free(stable_var); |
286 |
+ |
287 |
+ if (s == NULL) |
288 |
+ tk_error(Tcl_GetStringResult(cltclinterp)); |
289 |
+@@ -57,11 +57,11 @@ CAMLprim value camltk_setvar(value var, |
290 |
+ utf_contents = caml_string_to_tcl(contents); |
291 |
+ s = (char *)Tcl_SetVar(cltclinterp,stable_var, utf_contents, |
292 |
+ TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG); |
293 |
+- stat_free(stable_var); |
294 |
++ caml_stat_free(stable_var); |
295 |
+ if( s == utf_contents ){ |
296 |
+ tk_error("camltk_setvar: Tcl_SetVar returned strange result. Call the author of mlTk!"); |
297 |
+ } |
298 |
+- stat_free(utf_contents); |
299 |
++ caml_stat_free(utf_contents); |
300 |
+ |
301 |
+ if (s == NULL) |
302 |
+ tk_error(Tcl_GetStringResult(cltclinterp)); |
303 |
+@@ -84,7 +84,7 @@ static char * tracevar(clientdata, inter |
304 |
+ Tcl_UntraceVar2(interp, name1, name2, |
305 |
+ TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, |
306 |
+ tracevar, clientdata); |
307 |
+- callback2(*handler_code,Val_int(clientdata),Val_unit); |
308 |
++ caml_callback2(*handler_code,Val_int(clientdata),Val_unit); |
309 |
+ return (char *)NULL; |
310 |
+ } |
311 |
+ |
312 |
+@@ -103,10 +103,10 @@ CAMLprim value camltk_trace_var(value va |
313 |
+ tracevar, |
314 |
+ (ClientData) (Long_val(cbid))) |
315 |
+ != TCL_OK) { |
316 |
+- stat_free(cvar); |
317 |
++ caml_stat_free(cvar); |
318 |
+ tk_error(Tcl_GetStringResult(cltclinterp)); |
319 |
+ }; |
320 |
+- stat_free(cvar); |
321 |
++ caml_stat_free(cvar); |
322 |
+ return Val_unit; |
323 |
+ } |
324 |
+ |
325 |
+@@ -123,6 +123,6 @@ CAMLprim value camltk_untrace_var(value |
326 |
+ TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, |
327 |
+ tracevar, |
328 |
+ (ClientData) (Long_val(cbid))); |
329 |
+- stat_free(cvar); |
330 |
++ caml_stat_free(cvar); |
331 |
+ return Val_unit; |
332 |
+ } |
333 |
+Index: labltk-8.06.2/support/cltkWait.c |
334 |
+=================================================================== |
335 |
+--- labltk-8.06.2.orig/support/cltkWait.c |
336 |
++++ labltk-8.06.2/support/cltkWait.c |
337 |
+@@ -54,8 +54,8 @@ static void WaitVisibilityProc(clientDat |
338 |
+ Tk_DeleteEventHandler(vis->win, VisibilityChangeMask, |
339 |
+ WaitVisibilityProc, clientData); |
340 |
+ |
341 |
+- stat_free((char *)vis); |
342 |
+- callback2(*handler_code,cbid,Val_int(0)); |
343 |
++ caml_stat_free((char *)vis); |
344 |
++ caml_callback2(*handler_code,cbid,Val_int(0)); |
345 |
+ } |
346 |
+ |
347 |
+ /* Sets up a callback upon Visibility of a window */ |
348 |
+@@ -65,7 +65,7 @@ CAMLprim value camltk_wait_vis(value win |
349 |
+ (struct WinCBData *)caml_stat_alloc(sizeof(struct WinCBData)); |
350 |
+ vis->win = Tk_NameToWindow(cltclinterp, String_val(win), cltk_mainWindow); |
351 |
+ if (vis -> win == NULL) { |
352 |
+- stat_free((char *)vis); |
353 |
++ caml_stat_free((char *)vis); |
354 |
+ tk_error(Tcl_GetStringResult(cltclinterp)); |
355 |
+ }; |
356 |
+ vis->cbid = Int_val(cbid); |
357 |
+@@ -79,9 +79,9 @@ static void WaitWindowProc(ClientData cl |
358 |
+ if (eventPtr->type == DestroyNotify) { |
359 |
+ struct WinCBData *vis = clientData; |
360 |
+ value cbid = Val_int(vis->cbid); |
361 |
+- stat_free((char *)clientData); |
362 |
++ caml_stat_free((char *)clientData); |
363 |
+ /* The handler is destroyed by Tk itself */ |
364 |
+- callback2(*handler_code,cbid,Val_int(0)); |
365 |
++ caml_callback2(*handler_code,cbid,Val_int(0)); |
366 |
+ } |
367 |
+ } |
368 |
+ |
369 |
+@@ -92,7 +92,7 @@ CAMLprim value camltk_wait_des(value win |
370 |
+ (struct WinCBData *)caml_stat_alloc(sizeof(struct WinCBData)); |
371 |
+ vis->win = Tk_NameToWindow(cltclinterp, String_val(win), cltk_mainWindow); |
372 |
+ if (vis -> win == NULL) { |
373 |
+- stat_free((char *)vis); |
374 |
++ caml_stat_free((char *)vis); |
375 |
+ tk_error(Tcl_GetStringResult(cltclinterp)); |
376 |
+ }; |
377 |
+ vis->cbid = Int_val(cbid); |
378 |
+Index: labltk-8.06.2/browser/searchpos.ml |
379 |
+=================================================================== |
380 |
+--- labltk-8.06.2.orig/browser/searchpos.ml |
381 |
++++ labltk-8.06.2/browser/searchpos.ml |
382 |
+@@ -782,7 +782,7 @@ and search_pos_expr ~pos exp = |
383 |
+ search_pos_expr exp' ~pos |
384 |
+ end; |
385 |
+ search_pos_expr exp ~pos |
386 |
+- | Texp_function (_, l, _) -> |
387 |
++ | Texp_function { arg_label = _; param = _ ; cases = l; partial = _; } -> |
388 |
+ List.iter l ~f:(search_case ~pos) |
389 |
+ | Texp_apply (exp, l) -> |
390 |
+ List.iter l ~f:(fun (_, x) -> Misc.may (search_pos_expr ~pos) x); |
391 |
+Index: labltk-8.06.2/jpf/fileselect.ml |
392 |
+=================================================================== |
393 |
+--- labltk-8.06.2.orig/jpf/fileselect.ml |
394 |
++++ labltk-8.06.2/jpf/fileselect.ml |
395 |
+@@ -55,7 +55,7 @@ let myentry_create p ~variable = |
396 |
+ let subshell cmd = |
397 |
+ let r,w = pipe () in |
398 |
+ match fork () with |
399 |
+- 0 -> close r; dup2 ~src:w ~dst:stdout; |
400 |
++ 0 -> close r; dup2 ~cloexec:false ~src:w ~dst:stdout; |
401 |
+ execv ~prog:"/bin/sh" ~args:[| "/bin/sh"; "-c"; cmd |] |
402 |
+ | id -> |
403 |
+ close w; |
404 |
|
405 |
diff --git a/dev-ml/labltk/labltk-8.06.2.ebuild b/dev-ml/labltk/labltk-8.06.2.ebuild |
406 |
index 4426081ac9e..1210261ebf2 100644 |
407 |
--- a/dev-ml/labltk/labltk-8.06.2.ebuild |
408 |
+++ b/dev-ml/labltk/labltk-8.06.2.ebuild |
409 |
@@ -21,6 +21,7 @@ DEPEND="${RDEPEND} |
410 |
|
411 |
src_prepare() { |
412 |
epatch "${FILESDIR}/findlib.patch" |
413 |
+ has_version '>=dev-lang/ocaml-4.05.0_beta' && epatch "${FILESDIR}/ocaml405.patch" |
414 |
} |
415 |
|
416 |
src_configure() { |