ocaml-lwt: Various build fixes.

This commit is contained in:
jperkin 2018-02-01 09:40:13 +00:00
parent 8563c21076
commit 35f463a324
3 changed files with 71 additions and 1 deletions

View file

@ -1,7 +1,9 @@
$NetBSD: distinfo,v 1.14 2018/01/22 11:53:24 jaapb Exp $
$NetBSD: distinfo,v 1.15 2018/02/01 09:40:13 jperkin Exp $
SHA1 (lwt-3.2.0.tar.gz) = fe821da0bf8e6f38d59d29932b1e5404a745304e
RMD160 (lwt-3.2.0.tar.gz) = b079c2dbc26f05f02a06d73b877d6178289fff0d
SHA512 (lwt-3.2.0.tar.gz) = 59e4dc53b81b9673c490b20cd3dd362ed8262d32b07e2656b5de801bd204df6050fec02a461c64533ea6c8863d160ddaf9d0050bccbebe82fa696c923486f0c8
Size (lwt-3.2.0.tar.gz) = 310769 bytes
SHA1 (patch-META.lwt) = ddfaf4ebd6c90a7022d0779a4e65ded8feb0864f
SHA1 (patch-src_unix_config_discover.ml) = ef8ea37d85f20d56654514617050ee46d6080ef1
SHA1 (patch-src_unix_lwt__unix__unix.h) = 545eabb01a3f10d02a6fa38f8fe6a74cdba75434

View file

@ -0,0 +1,38 @@
$NetBSD: patch-src_unix_config_discover.ml,v 1.1 2018/02/01 09:40:13 jperkin Exp $
Avoid system NANOSEC definition.
--- src/unix/config/discover.ml.orig 2017-12-19 21:28:38.000000000 +0000
+++ src/unix/config/discover.ml
@@ -279,14 +279,14 @@ let struct_ns_code conversion = "
#include <unistd.h>
#include <caml/mlvalues.h>
-#define NANOSEC" ^ conversion ^ "
+#define OCNANOSEC" ^ conversion ^ "
CAMLprim value lwt_test() {
struct stat *buf;
double a, m, c;
- a = (double)NANOSEC(buf, a);
- m = (double)NANOSEC(buf, m);
- c = (double)NANOSEC(buf, c);
+ a = (double)OCNANOSEC(buf, a);
+ m = (double)OCNANOSEC(buf, m);
+ c = (double)OCNANOSEC(buf, c);
return Val_unit;
}
"
@@ -687,10 +687,10 @@ Run with DEBUG=y for more details.
conversion
with Not_found -> begin
printf " %s unavailable\n%!" (String.make 11 '.');
- fprintf config "#define NANOSEC%s\n" fallback;
+ fprintf config "#define OCNANOSEC%s\n" fallback;
fallback
end in
- fprintf config "#define NANOSEC%s\n" conversion
+ fprintf config "#define OCNANOSEC%s\n" conversion
in
if not (test_basic_compilation ()) then begin

View file

@ -0,0 +1,30 @@
$NetBSD: patch-src_unix_lwt__unix__unix.h,v 1.1 2018/02/01 09:40:13 jperkin Exp $
Need limits.h for IOV_MAX.
Avoid system NANOSEC definition.
--- src/unix/lwt_unix_unix.h.orig 2017-12-19 21:28:38.000000000 +0000
+++ src/unix/lwt_unix_unix.h
@@ -33,6 +33,7 @@
#include <caml/unixsupport.h>
#include <caml/version.h>
#include <dirent.h>
+#include <limits.h>
#include <poll.h>
#include <sys/resource.h>
#include <sys/time.h>
@@ -1288,11 +1289,11 @@ static value copy_stat(int use_64, struc
CAMLlocal5(atime, mtime, ctime, offset, v);
atime = caml_copy_double((double)buf->st_atime +
- (NANOSEC(buf, a) / 1000000000.0));
+ (OCNANOSEC(buf, a) / 1000000000.0));
mtime = caml_copy_double((double)buf->st_mtime +
- (NANOSEC(buf, m) / 1000000000.0));
+ (OCNANOSEC(buf, m) / 1000000000.0));
ctime = caml_copy_double((double)buf->st_ctime +
- (NANOSEC(buf, c) / 1000000000.0));
+ (OCNANOSEC(buf, c) / 1000000000.0));
offset = use_64 ? caml_copy_int64(buf->st_size) : Val_int(buf->st_size);
v = caml_alloc_small(12, 0);
Field(v, 0) = Val_int(buf->st_dev);