Gentoo Archives: gentoo-commits

From: Sven Wegener <swegener@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-dns/pdns-recursor/files/, net-dns/pdns-recursor/
Date: Fri, 14 Oct 2016 12:48:05
Message-Id: 1476449266.62dbdfb90a5079d7e0ca0cf540bb5cfee960011a.swegener@gentoo
1 commit: 62dbdfb90a5079d7e0ca0cf540bb5cfee960011a
2 Author: Sven Wegener <swegener <AT> gentoo <DOT> org>
3 AuthorDate: Fri Oct 14 12:36:39 2016 +0000
4 Commit: Sven Wegener <swegener <AT> gentoo <DOT> org>
5 CommitDate: Fri Oct 14 12:47:46 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=62dbdfb9
7
8 net-dns/pdns-recursor: Fix building with >=boost-1.61, bug #595988
9
10 Package-Manager: portage-2.3.0
11
12 .../pdns-recursor-4.0.3-boost-1.61-fcontext.patch | 152 +++++++++++++++++++++
13 net-dns/pdns-recursor/pdns-recursor-4.0.3.ebuild | 6 +-
14 2 files changed, 157 insertions(+), 1 deletion(-)
15
16 diff --git a/net-dns/pdns-recursor/files/pdns-recursor-4.0.3-boost-1.61-fcontext.patch b/net-dns/pdns-recursor/files/pdns-recursor-4.0.3-boost-1.61-fcontext.patch
17 new file mode 100644
18 index 00000000..c6cd9a3
19 --- /dev/null
20 +++ b/net-dns/pdns-recursor/files/pdns-recursor-4.0.3-boost-1.61-fcontext.patch
21 @@ -0,0 +1,152 @@
22 +diff --git a/mtasker_fcontext.cc b/mtasker_fcontext.cc
23 +index bc37e76..8d96fa1 100644
24 +--- a/mtasker_fcontext.cc
25 ++++ b/mtasker_fcontext.cc
26 +@@ -23,14 +23,15 @@
27 + #include <exception>
28 + #include <cassert>
29 + #include <type_traits>
30 +-#if BOOST_VERSION > 106100
31 +-#include <boost/context/detail/fcontext.hpp>
32 +-#else
33 +-#include <boost/context/fcontext.hpp>
34 +-#endif
35 + #include <boost/version.hpp>
36 +-
37 ++#if BOOST_VERSION < 106100
38 ++#include <boost/context/fcontext.hpp>
39 + using boost::context::make_fcontext;
40 ++#else
41 ++#include <boost/context/detail/fcontext.hpp>
42 ++using boost::context::detail::make_fcontext;
43 ++#endif /* BOOST_VERSION < 106100 */
44 ++
45 +
46 + #if BOOST_VERSION < 105600
47 + /* Note: This typedef means functions taking fcontext_t*, like jump_fcontext(),
48 +@@ -61,8 +62,15 @@ jump_fcontext (fcontext_t* const ofc, fcontext_t const nfc,
49 + }
50 + }
51 + #else
52 ++
53 ++#if BOOST_VERSION < 106100
54 + using boost::context::fcontext_t;
55 + using boost::context::jump_fcontext;
56 ++#else
57 ++using boost::context::detail::fcontext_t;
58 ++using boost::context::detail::jump_fcontext;
59 ++using boost::context::detail::transfer_t;
60 ++#endif /* BOOST_VERSION < 106100 */
61 +
62 + static_assert (std::is_pointer<fcontext_t>::value,
63 + "Boost Context has changed the fcontext_t type again :-(");
64 +@@ -72,7 +80,9 @@ static_assert (std::is_pointer<fcontext_t>::value,
65 + * jump. args_t simply provides a way to pass more by reference.
66 + */
67 + struct args_t {
68 ++#if BOOST_VERSION < 106100
69 + fcontext_t prev_ctx = nullptr;
70 ++#endif
71 + pdns_ucontext_t* self = nullptr;
72 + boost::function<void(void)>* work = nullptr;
73 + };
74 +@@ -80,7 +90,11 @@ struct args_t {
75 + extern "C" {
76 + static
77 + void
78 ++#if BOOST_VERSION < 106100
79 + threadWrapper (intptr_t const xargs) {
80 ++#else
81 ++threadWrapper (transfer_t const t) {
82 ++#endif
83 + /* Access the args passed from pdns_makecontext, and copy them directly from
84 + * the calling stack on to ours (we're now using the MThreads stack).
85 + * This saves heap allocating an args object, at the cost of an extra
86 +@@ -90,11 +104,28 @@ threadWrapper (intptr_t const xargs) {
87 + * the behaviour of the System V implementation, which can inherently only
88 + * be passed ints and pointers.
89 + */
90 ++#if BOOST_VERSION < 106100
91 + auto args = reinterpret_cast<args_t*>(xargs);
92 ++#else
93 ++ auto args = reinterpret_cast<args_t*>(t.data);
94 ++#endif
95 + auto ctx = args->self;
96 + auto work = args->work;
97 ++ /* we switch back to pdns_makecontext() */
98 ++#if BOOST_VERSION < 106100
99 + jump_fcontext (reinterpret_cast<fcontext_t*>(&ctx->uc_mcontext),
100 + static_cast<fcontext_t>(args->prev_ctx), 0);
101 ++#else
102 ++ transfer_t res = jump_fcontext (t.fctx, 0);
103 ++ /* we got switched back from pdns_swapcontext() */
104 ++ if (res.data) {
105 ++ /* if res.data is not a nullptr, it holds a pointer to the context
106 ++ we just switched from, and we need to fill it to be able to
107 ++ switch back to it later. */
108 ++ fcontext_t* ptr = static_cast<fcontext_t*>(res.data);
109 ++ *ptr = res.fctx;
110 ++ }
111 ++#endif
112 + args = nullptr;
113 +
114 + try {
115 +@@ -106,9 +137,14 @@ threadWrapper (intptr_t const xargs) {
116 +
117 + /* Emulate the System V uc_link feature. */
118 + auto const next_ctx = ctx->uc_link->uc_mcontext;
119 ++#if BOOST_VERSION < 106100
120 + jump_fcontext (reinterpret_cast<fcontext_t*>(&ctx->uc_mcontext),
121 + static_cast<fcontext_t>(next_ctx),
122 + static_cast<bool>(ctx->exception));
123 ++#else
124 ++ jump_fcontext (static_cast<fcontext_t>(next_ctx), 0);
125 ++#endif
126 ++
127 + #ifdef NDEBUG
128 + __builtin_unreachable();
129 + #endif
130 +@@ -129,10 +165,27 @@ pdns_ucontext_t::~pdns_ucontext_t
131 + void
132 + pdns_swapcontext
133 + (pdns_ucontext_t& __restrict octx, pdns_ucontext_t const& __restrict ctx) {
134 ++ /* we either switch back to threadwrapper() if it's the first time,
135 ++ or we switch back to pdns_swapcontext(),
136 ++ in both case we will be returning from a call to jump_fcontext(). */
137 ++#if BOOST_VERSION < 106100
138 + if (jump_fcontext (reinterpret_cast<fcontext_t*>(&octx.uc_mcontext),
139 + static_cast<fcontext_t>(ctx.uc_mcontext), 0)) {
140 + std::rethrow_exception (ctx.exception);
141 + }
142 ++#else
143 ++ transfer_t res = jump_fcontext (static_cast<fcontext_t>(ctx.uc_mcontext), &octx.uc_mcontext);
144 ++ if (res.data) {
145 ++ /* if res.data is not a nullptr, it holds a pointer to the context
146 ++ we just switched from, and we need to fill it to be able to
147 ++ switch back to it later. */
148 ++ fcontext_t* ptr = static_cast<fcontext_t*>(res.data);
149 ++ *ptr = res.fctx;
150 ++ }
151 ++ if (ctx.exception) {
152 ++ std::rethrow_exception (ctx.exception);
153 ++ }
154 ++#endif
155 + }
156 +
157 + void
158 +@@ -146,7 +199,15 @@ pdns_makecontext
159 + args_t args;
160 + args.self = &ctx;
161 + args.work = &start;
162 ++ /* jumping to threadwrapper */
163 ++#if BOOST_VERSION < 106100
164 + jump_fcontext (reinterpret_cast<fcontext_t*>(&args.prev_ctx),
165 + static_cast<fcontext_t>(ctx.uc_mcontext),
166 + reinterpret_cast<intptr_t>(&args));
167 ++#else
168 ++ transfer_t res = jump_fcontext (static_cast<fcontext_t>(ctx.uc_mcontext),
169 ++ &args);
170 ++ /* back from threadwrapper, updating the context */
171 ++ ctx.uc_mcontext = res.fctx;
172 ++#endif
173 + }
174
175 diff --git a/net-dns/pdns-recursor/pdns-recursor-4.0.3.ebuild b/net-dns/pdns-recursor/pdns-recursor-4.0.3.ebuild
176 index a4dddaa..321a847 100644
177 --- a/net-dns/pdns-recursor/pdns-recursor-4.0.3.ebuild
178 +++ b/net-dns/pdns-recursor/pdns-recursor-4.0.3.ebuild
179 @@ -2,7 +2,7 @@
180 # Distributed under the terms of the GNU General Public License v2
181 # $Id$
182
183 -EAPI="5"
184 +EAPI="6"
185
186 inherit toolchain-funcs flag-o-matic eutils versionator
187
188 @@ -30,6 +30,10 @@ DEPEND="${DEPEND}
189
190 S="${WORKDIR}"/${P/_/-}
191
192 +PATCHES=(
193 + "${FILESDIR}"/${P}-boost-1.61-fcontext.patch
194 +)
195 +
196 pkg_setup() {
197 filter-flags -ftree-vectorize
198 }