1 |
commit: d7d57903f6e0094b295fc3bcf9bb1f83443b9c5c |
2 |
Author: Alexis Ballier <aballier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jun 30 11:42:02 2017 +0000 |
4 |
Commit: Alexis Ballier <aballier <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jun 30 12:47:13 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d7d57903 |
7 |
|
8 |
dev-ml/ocamlnet: backport upstream fix to build with ocaml 4.05 |
9 |
|
10 |
Package-Manager: Portage-2.3.6, Repoman-2.3.2 |
11 |
|
12 |
dev-ml/ocamlnet/files/ocaml405.patch | 145 ++++++++++++++++++++++++++++++++++ |
13 |
dev-ml/ocamlnet/ocamlnet-4.1.2.ebuild | 6 +- |
14 |
2 files changed, 150 insertions(+), 1 deletion(-) |
15 |
|
16 |
diff --git a/dev-ml/ocamlnet/files/ocaml405.patch b/dev-ml/ocamlnet/files/ocaml405.patch |
17 |
new file mode 100644 |
18 |
index 00000000000..a112d1fb447 |
19 |
--- /dev/null |
20 |
+++ b/dev-ml/ocamlnet/files/ocaml405.patch |
21 |
@@ -0,0 +1,145 @@ |
22 |
+commit f3d451b81c4caa8cce7f55af6463ec685e79e227 |
23 |
+Author: Gerd Stolpmann <gerd@××××××××××××××.de> |
24 |
+Date: Sun Feb 26 21:04:49 2017 +0100 |
25 |
+ |
26 |
+ ocaml-4.05: support for O_KEEPEXEC |
27 |
+ |
28 |
+diff --git a/code/src/netsys/Makefile b/code/src/netsys/Makefile |
29 |
+index cbc1ce2..cb70a09 100644 |
30 |
+--- a/code/src/netsys/Makefile |
31 |
++++ b/code/src/netsys/Makefile |
32 |
+@@ -56,7 +56,7 @@ OCAMLC_OPTIONS_FOR_netsys_c_xdr.c = -ccopt -O |
33 |
+ OCAMLC_OPTIONS += $(STRING_OPTS) |
34 |
+ OCAMLOPT_OPTIONS += $(STRING_OPTS) |
35 |
+ |
36 |
+-PP_OPTIONS = -pp "$(CPPO) $(DEF_O_SHARE_DELETE) $(DEF_O_CLOEXEC) $(PP_BYTES) $(PP_DEPRECATED)" |
37 |
++PP_OPTIONS = -pp "$(CPPO) $(DEF_O_SHARE_DELETE) $(DEF_O_CLOEXEC) $(DEF_O_KEEPEXEC) $(PP_BYTES) $(PP_DEPRECATED)" |
38 |
+ |
39 |
+ INSTALL_EXTRA += netsys_c_event.h $(OOH_OBJECT) |
40 |
+ |
41 |
+diff --git a/code/src/netsys/configure b/code/src/netsys/configure |
42 |
+index 1325843..f4dbc09 100755 |
43 |
+--- a/code/src/netsys/configure |
44 |
++++ b/code/src/netsys/configure |
45 |
+@@ -437,6 +437,21 @@ else |
46 |
+ echo "no" |
47 |
+ fi |
48 |
+ |
49 |
++###################################################################### |
50 |
++ |
51 |
++printf "Checking for O_KEEPEXEC... " |
52 |
++mkdir -p tmp |
53 |
++cat <<_EOF_ >tmp/t.ml |
54 |
++let x = Unix.O_KEEPEXEC;; |
55 |
++_EOF_ |
56 |
++ |
57 |
++def_o_keepexec="-D NO_O_KEEPEXEC" |
58 |
++if ocaml unix.cma tmp/t.ml >/dev/null 2>/dev/null; then |
59 |
++ echo "yes" |
60 |
++ def_o_keepexec="-D HAVE_O_KEEPEXEC" |
61 |
++else |
62 |
++ echo "no" |
63 |
++fi |
64 |
+ |
65 |
+ ###################################################################### |
66 |
+ |
67 |
+@@ -445,6 +460,7 @@ cat <<EOF >Makefile.conf |
68 |
+ NETSYS_LINK_OPTIONS = $netsys_link_options |
69 |
+ DEF_O_SHARE_DELETE = $def_o_share_delete |
70 |
+ DEF_O_CLOEXEC = $def_o_cloexec |
71 |
++DEF_O_KEEPEXEC = $def_o_keepexec |
72 |
+ OOH_OBJECT = $def_ooh_object |
73 |
+ EOF |
74 |
+ |
75 |
+diff --git a/code/src/netsys/netsys_c.c b/code/src/netsys/netsys_c.c |
76 |
+index a8b16be..4c30873 100644 |
77 |
+--- a/code/src/netsys/netsys_c.c |
78 |
++++ b/code/src/netsys/netsys_c.c |
79 |
+@@ -448,32 +448,43 @@ static int at_flags_table[] = { |
80 |
+ #ifndef O_RSYNC |
81 |
+ #define O_RSYNC 0 |
82 |
+ #endif |
83 |
+-#ifndef O_CLOEXEC |
84 |
+-#define NEED_CLOEXEC_EMULATION |
85 |
+-#define O_CLOEXEC 0 |
86 |
+-#endif |
87 |
+ |
88 |
+ static int open_flag_table[] = { |
89 |
+ O_RDONLY, O_WRONLY, O_RDWR, O_NONBLOCK, O_APPEND, O_CREAT, O_TRUNC, O_EXCL, |
90 |
+- O_NOCTTY, O_DSYNC, O_SYNC, O_RSYNC, 0 /* O_SHARE_DELETE */, O_CLOEXEC |
91 |
++ O_NOCTTY, O_DSYNC, O_SYNC, O_RSYNC, |
92 |
++ 0 /* O_SHARE_DELETE */, 0 /* O_CLOEXEC */, 0 /* O_KEEPEXEC */ |
93 |
+ }; |
94 |
+ |
95 |
+-#ifdef NEED_CLOEXEC_EMULATION |
96 |
++enum { CLOEXEC = 1, KEEPEXEC = 2 }; |
97 |
++ |
98 |
+ static int open_cloexec_table[] = { |
99 |
+- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 |
100 |
++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CLOEXEC, KEEPEXEC |
101 |
+ }; |
102 |
++#ifndef HAVE_O_KEEPEXEC |
103 |
++#define unix_cloexec_default 0 |
104 |
+ #endif |
105 |
++ |
106 |
+ #endif |
107 |
+ |
108 |
+ CAMLprim value netsys_openat(value dirfd, value path, value flags, value perm) |
109 |
+ { |
110 |
+ #ifdef HAVE_AT |
111 |
+ CAMLparam4(dirfd, path, flags, perm); |
112 |
+- int ret, cv_flags; |
113 |
++ int ret, cv_flags, clo_flags, cloexec; |
114 |
+ char * p; |
115 |
+ |
116 |
+ /* shamelessly copied from ocaml distro */ |
117 |
+ cv_flags = convert_flag_list(flags, open_flag_table); |
118 |
++ clo_flags = convert_flag_list(flags, open_cloexec_table); |
119 |
++ if (clo_flags & CLOEXEC) |
120 |
++ cloexec = 1; |
121 |
++ else if (clo_flags & KEEPEXEC) |
122 |
++ cloexec = 0; |
123 |
++ else |
124 |
++ cloexec = unix_cloexec_default; |
125 |
++#if defined(O_CLOEXEC) |
126 |
++ if (cloexec) cv_flags |= O_CLOEXEC; |
127 |
++#endif |
128 |
+ p = stat_alloc(string_length(path) + 1); |
129 |
+ strcpy(p, String_val(path)); |
130 |
+ enter_blocking_section(); |
131 |
+@@ -481,8 +492,8 @@ CAMLprim value netsys_openat(value dirfd, value path, value flags, value perm) |
132 |
+ leave_blocking_section(); |
133 |
+ stat_free(p); |
134 |
+ if (ret == -1) uerror("openat", path); |
135 |
+-#if defined(NEED_CLOEXEC_EMULATION) && defined(FD_CLOEXEC) |
136 |
+- if (convert_flag_list(flags, open_cloexec_table) != 0) { |
137 |
++#if !defined(O_CLOEXEC) |
138 |
++ { |
139 |
+ int flags = fcntl(Int_val(dirfd), F_GETFD, 0); |
140 |
+ if (flags == -1 || fcntl(Int_val(dirfd), F_SETFD, flags | FD_CLOEXEC) == -1) |
141 |
+ uerror("openat", path); |
142 |
+diff --git a/code/src/netsys/netsys_posix.ml b/code/src/netsys/netsys_posix.ml |
143 |
+index 602ceae..3bf3e7c 100644 |
144 |
+--- a/code/src/netsys/netsys_posix.ml |
145 |
++++ b/code/src/netsys/netsys_posix.ml |
146 |
+@@ -715,6 +715,12 @@ type at_flag = AT_EACCESS | AT_SYMLINK_NOFOLLOW | AT_SYMLINK_FOLLOW | |
147 |
+ AT_REMOVEDIR |
148 |
+ |
149 |
+ (* The stubs assume these type definitions: *) |
150 |
++#ifdef HAVE_O_KEEPEXEC |
151 |
++type open_flag1 = Unix.open_flag = |
152 |
++ O_RDONLY | O_WRONLY | O_RDWR | O_NONBLOCK | O_APPEND | O_CREAT | O_TRUNC |
153 |
++ | O_EXCL | O_NOCTTY | O_DSYNC | O_SYNC | O_RSYNC | O_SHARE_DELETE |
154 |
++ | O_CLOEXEC | O_KEEPEXEC |
155 |
++#else |
156 |
+ #ifdef HAVE_O_CLOEXEC |
157 |
+ type open_flag1 = Unix.open_flag = |
158 |
+ O_RDONLY | O_WRONLY | O_RDWR | O_NONBLOCK | O_APPEND | O_CREAT | O_TRUNC |
159 |
+@@ -731,6 +737,7 @@ type open_flag1 = Unix.open_flag = |
160 |
+ | O_EXCL | O_NOCTTY | O_DSYNC | O_SYNC | O_RSYNC |
161 |
+ #endif |
162 |
+ #endif |
163 |
++#endif |
164 |
+ |
165 |
+ type access_permission1 = Unix.access_permission = |
166 |
+ R_OK | W_OK | X_OK | F_OK |
167 |
|
168 |
diff --git a/dev-ml/ocamlnet/ocamlnet-4.1.2.ebuild b/dev-ml/ocamlnet/ocamlnet-4.1.2.ebuild |
169 |
index 3bceb097c9c..6d89e100f0e 100644 |
170 |
--- a/dev-ml/ocamlnet/ocamlnet-4.1.2.ebuild |
171 |
+++ b/dev-ml/ocamlnet/ocamlnet-4.1.2.ebuild |
172 |
@@ -1,4 +1,4 @@ |
173 |
-# Copyright 1999-2016 Gentoo Foundation |
174 |
+# Copyright 1999-2017 Gentoo Foundation |
175 |
# Distributed under the terms of the GNU General Public License v2 |
176 |
|
177 |
EAPI="5" |
178 |
@@ -34,6 +34,10 @@ DEPEND="${RDEPEND} |
179 |
|
180 |
S=${WORKDIR}/${MY_P} |
181 |
|
182 |
+src_prepare() { |
183 |
+ epatch "${FILESDIR}/ocaml405.patch" |
184 |
+} |
185 |
+ |
186 |
ocamlnet_use_with() { |
187 |
if use $1; then |
188 |
echo "-with-$2" |