[90467] trunk/dports/lang/ocaml

mww at macports.org mww at macports.org
Tue Mar 6 07:05:02 PST 2012


Revision: 90467
          http://trac.macports.org/changeset/90467
Author:   mww at macports.org
Date:     2012-03-06 07:05:02 -0800 (Tue, 06 Mar 2012)
Log Message:
-----------
ocaml: add patch for handling of 'bigarray' with clang/llvm-3.0; inc. revision

Modified Paths:
--------------
    trunk/dports/lang/ocaml/Portfile

Added Paths:
-----------
    trunk/dports/lang/ocaml/files/
    trunk/dports/lang/ocaml/files/patch-otherlibs-bigarray.diff

Modified: trunk/dports/lang/ocaml/Portfile
===================================================================
--- trunk/dports/lang/ocaml/Portfile	2012-03-06 15:02:56 UTC (rev 90466)
+++ trunk/dports/lang/ocaml/Portfile	2012-03-06 15:05:02 UTC (rev 90467)
@@ -4,7 +4,7 @@
 
 name                ocaml
 version             3.12.1
-revision            2
+revision            3
 # When updating ocaml, also update camlp5 to a compatible version (c.f. #26769, #20219, #18292)
 set major_vers      [join [lrange [split ${version} .] 0 1] .]
 platforms           darwin
@@ -28,6 +28,8 @@
 
 depends_lib         port:ncurses
 
+patchfiles          patch-otherlibs-bigarray.diff
+
 use_parallel_build  no
 universal_variant   no
 

Added: trunk/dports/lang/ocaml/files/patch-otherlibs-bigarray.diff
===================================================================
--- trunk/dports/lang/ocaml/files/patch-otherlibs-bigarray.diff	                        (rev 0)
+++ trunk/dports/lang/ocaml/files/patch-otherlibs-bigarray.diff	2012-03-06 15:05:02 UTC (rev 90467)
@@ -0,0 +1,80 @@
+diff -u -r otherlibs/bigarray/bigarray.h /var/tmp/ocaml/trunk/otherlibs/bigarray/bigarray.h
+--- otherlibs/bigarray/bigarray.h	2008-12-03 19:09:09.000000000 +0100
++++ /var/tmp/ocaml/trunk/otherlibs/bigarray/bigarray.h	2012-03-06 11:37:25.000000000 +0100
+@@ -73,7 +73,12 @@
+   intnat num_dims;            /* Number of dimensions */
+   intnat flags;  /* Kind of element array + memory layout + allocation status */
+   struct caml_ba_proxy * proxy; /* The proxy for sub-arrays, or NULL */
++  /* PR#5516: use C99's / gcc's flexible array types if possible */
++#if (__STDC_VERSION__ >= 199901L) || defined(__GNUC__)
++  intnat dim[]  /*[num_dims]*/; /* Size in each dimension */
++#else
+   intnat dim[1] /*[num_dims]*/; /* Size in each dimension */
++#endif
+ };
+ 
+ #define Caml_ba_array_val(v) ((struct caml_ba_array *) Data_custom_val(v))
+diff -u -r otherlibs/bigarray/bigarray_stubs.c /var/tmp/ocaml/trunk/otherlibs/bigarray/bigarray_stubs.c
+--- otherlibs/bigarray/bigarray_stubs.c	2011-05-12 16:34:05.000000000 +0200
++++ /var/tmp/ocaml/trunk/otherlibs/bigarray/bigarray_stubs.c	2012-03-06 11:37:25.000000000 +0100
+@@ -121,20 +123,20 @@
+ 
+ /* Allocation of a big array */
+ 
+-#define CAML_BA_MAX_MEMORY 256*1024*1024
+-/* 256 Mb -- after allocating that much, it's probably worth speeding
++#define CAML_BA_MAX_MEMORY 1024*1024*1024
++/* 1 Gb -- after allocating that much, it's probably worth speeding
+    up the major GC */
+ 
+ /* [caml_ba_alloc] will allocate a new bigarray object in the heap.
+    If [data] is NULL, the memory for the contents is also allocated
+    (with [malloc]) by [caml_ba_alloc].
+-   [data] cannot point into the Caml heap.
+-   [dim] may point into an object in the Caml heap.
++   [data] cannot point into the OCaml heap.
++   [dim] may point into an object in the OCaml heap.
+ */
+ CAMLexport value
+ caml_ba_alloc(int flags, int num_dims, void * data, intnat * dim)
+ {
+-  uintnat num_elts, size;
++  uintnat num_elts, asize, size;
+   int overflow, i;
+   value res;
+   struct caml_ba_array * b;
+@@ -158,10 +160,13 @@
+     if (data == NULL && size != 0) caml_raise_out_of_memory();
+     flags |= CAML_BA_MANAGED;
+   }
+-  res = caml_alloc_custom(&caml_ba_ops,
+-                          sizeof(struct caml_ba_array)
+-                          + (num_dims - 1) * sizeof(intnat),
+-                          size, CAML_BA_MAX_MEMORY);
++  /* PR#5516: use C99's / gcc's flexible array types if possible */
++#if (__STDC_VERSION__ >= 199901L) || defined(__GNUC__)
++  asize = sizeof(struct caml_ba_array) + num_dims * sizeof(intnat);
++#else
++  asize = sizeof(struct caml_ba_array) + (num_dims - 1) * sizeof(intnat);
++#endif
++  res = caml_alloc_custom(&caml_ba_ops, asize, size, CAML_BA_MAX_MEMORY);
+   b = Caml_ba_array_val(res);
+   b->data = data;
+   b->num_dims = num_dims;
+@@ -181,6 +186,7 @@
+   int i;
+   value res;
+ 
++  Assert(num_dims <= CAML_BA_MAX_NUM_DIMS);
+   va_start(ap, data);
+   for (i = 0; i < num_dims; i++) dim[i] = va_arg(ap, intnat);
+   va_end(ap);
+@@ -1062,7 +1084,7 @@
+   num_elts = 1;
+   for (i = 0; i < num_dims; i++) {
+     dim[i] = Long_val(Field(vdim, i));
+-    if (dim[i] < 0 || dim[i] > 0x7FFFFFFFL)
++    if (dim[i] < 0)
+       caml_invalid_argument("Bigarray.reshape: negative dimension");
+     num_elts *= dim[i];
+   }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120306/32f3ded2/attachment.html>


More information about the macports-changes mailing list