1 |
commit: a543b70831d746352d8f93df58d53df1ecf79020 |
2 |
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Mar 10 15:47:53 2019 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Mar 10 16:41:48 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a543b708 |
7 |
|
8 |
media-sound/seq24: Fix mutex build ambiguity |
9 |
|
10 |
Thanks-to: Thomas Groman <tgrom.automail <AT> nuegia.net> |
11 |
Bug: https://bugs.gentoo.org/587326 |
12 |
Package-Manager: Portage-2.3.62, Repoman-2.3.12 |
13 |
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> |
14 |
|
15 |
.../seq24/files/seq24-0.9.3-std-mutex.patch | 331 +++++++++++++++++++++ |
16 |
media-sound/seq24/seq24-0.9.3-r1.ebuild | 2 + |
17 |
2 files changed, 333 insertions(+) |
18 |
|
19 |
diff --git a/media-sound/seq24/files/seq24-0.9.3-std-mutex.patch b/media-sound/seq24/files/seq24-0.9.3-std-mutex.patch |
20 |
new file mode 100644 |
21 |
index 00000000000..4e8585a9449 |
22 |
--- /dev/null |
23 |
+++ b/media-sound/seq24/files/seq24-0.9.3-std-mutex.patch |
24 |
@@ -0,0 +1,331 @@ |
25 |
+Description: Use standard mutex and condition variable classes |
26 |
+ Use std::recursive_mutex and std::condition_variable instead of custom classes |
27 |
+ based on pthread. |
28 |
+ . |
29 |
+ Fixes FTBFS with recent GCC versions which defines the "mutex" class which |
30 |
+ conflicts with seq24's version of "mutex". |
31 |
+Author: James Cowgill <jcowgill@××××××.org> |
32 |
+Bug: https://bugs.launchpad.net/seq24/+bug/1647614 |
33 |
+Bug-Debian: https://bugs.debian.org/822394 |
34 |
+--- |
35 |
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ |
36 |
+--- a/src/Module.am |
37 |
++++ b/src/Module.am |
38 |
+@@ -31,8 +31,6 @@ bin_PROGRAMS = %D%/seq24 |
39 |
+ %D%/midibus_portmidi.h \ |
40 |
+ %D%/midifile.cpp \ |
41 |
+ %D%/midifile.h \ |
42 |
+- %D%/mutex.cpp \ |
43 |
+- %D%/mutex.h \ |
44 |
+ %D%/options.cpp \ |
45 |
+ %D%/options.h \ |
46 |
+ %D%/optionsfile.cpp \ |
47 |
+--- a/src/midibus.h |
48 |
++++ b/src/midibus.h |
49 |
+@@ -35,11 +35,11 @@ class midibus; |
50 |
+ # include <alsa/seq_midi_event.h> |
51 |
+ #endif |
52 |
+ |
53 |
++#include <mutex> |
54 |
+ #include <string> |
55 |
+ |
56 |
+ #include "event.h" |
57 |
+ #include "sequence.h" |
58 |
+-#include "mutex.h" |
59 |
+ #include "globals.h" |
60 |
+ |
61 |
+ const int c_midibus_output_size = 0x100000; |
62 |
+@@ -90,7 +90,7 @@ class midibus |
63 |
+ |
64 |
+ |
65 |
+ /* locking */ |
66 |
+- mutex m_mutex; |
67 |
++ std::recursive_mutex m_mutex; |
68 |
+ |
69 |
+ /* mutex */ |
70 |
+ void lock(); |
71 |
+@@ -208,7 +208,7 @@ class mastermidibus |
72 |
+ sequence *m_seq; |
73 |
+ |
74 |
+ /* locking */ |
75 |
+- mutex m_mutex; |
76 |
++ std::recursive_mutex m_mutex; |
77 |
+ |
78 |
+ /* mutex */ |
79 |
+ void lock(); |
80 |
+--- a/src/midibus_portmidi.h |
81 |
++++ b/src/midibus_portmidi.h |
82 |
+@@ -25,12 +25,12 @@ class mastermidibus; |
83 |
+ |
84 |
+ #ifdef __WIN32__ |
85 |
+ |
86 |
++#include <mutex> |
87 |
+ #include <string> |
88 |
+ |
89 |
+ #include "portmidi.h" |
90 |
+ #include "event.h" |
91 |
+ #include "sequence.h" |
92 |
+-#include "mutex.h" |
93 |
+ #include "globals.h" |
94 |
+ |
95 |
+ const int c_midibus_output_size = 0x100000; |
96 |
+@@ -65,7 +65,7 @@ class midibus |
97 |
+ long m_lasttick; |
98 |
+ |
99 |
+ /* locking */ |
100 |
+- mutex m_mutex; |
101 |
++ std::recursive_mutex m_mutex; |
102 |
+ |
103 |
+ /* mutex */ |
104 |
+ void lock(); |
105 |
+@@ -164,7 +164,7 @@ class mastermidibus |
106 |
+ sequence *m_seq; |
107 |
+ |
108 |
+ /* locking */ |
109 |
+- mutex m_mutex; |
110 |
++ std::recursive_mutex m_mutex; |
111 |
+ |
112 |
+ /* mutex */ |
113 |
+ void lock(); |
114 |
+--- a/src/mutex.cpp |
115 |
++++ /dev/null |
116 |
+@@ -1,62 +0,0 @@ |
117 |
+-//---------------------------------------------------------------------------- |
118 |
+-// |
119 |
+-// This file is part of seq24. |
120 |
+-// |
121 |
+-// seq24 is free software; you can redistribute it and/or modify |
122 |
+-// it under the terms of the GNU General Public License as published by |
123 |
+-// the Free Software Foundation; either version 2 of the License, or |
124 |
+-// (at your option) any later version. |
125 |
+-// |
126 |
+-// seq24 is distributed in the hope that it will be useful, |
127 |
+-// but WITHOUT ANY WARRANTY; without even the implied warranty of |
128 |
+-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
129 |
+-// GNU General Public License for more details. |
130 |
+-// |
131 |
+-// You should have received a copy of the GNU General Public License |
132 |
+-// along with seq24; if not, write to the Free Software |
133 |
+-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
134 |
+-// |
135 |
+-//----------------------------------------------------------------------------- |
136 |
+- |
137 |
+-#include "mutex.h" |
138 |
+- |
139 |
+-const pthread_mutex_t mutex::recmutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; |
140 |
+-const pthread_cond_t condition_var::cond = PTHREAD_COND_INITIALIZER; |
141 |
+- |
142 |
+-mutex::mutex( ) |
143 |
+-{ |
144 |
+- m_mutex_lock = recmutex; |
145 |
+-} |
146 |
+- |
147 |
+-void |
148 |
+-mutex::lock( ) |
149 |
+-{ |
150 |
+- pthread_mutex_lock( &m_mutex_lock ); |
151 |
+-} |
152 |
+- |
153 |
+- |
154 |
+-void |
155 |
+-mutex::unlock( ) |
156 |
+-{ |
157 |
+- pthread_mutex_unlock( &m_mutex_lock ); |
158 |
+-} |
159 |
+- |
160 |
+-condition_var::condition_var( ) |
161 |
+-{ |
162 |
+- m_cond = cond; |
163 |
+-} |
164 |
+- |
165 |
+- |
166 |
+-void |
167 |
+-condition_var::signal( ) |
168 |
+-{ |
169 |
+- pthread_cond_signal( &m_cond ); |
170 |
+-} |
171 |
+- |
172 |
+-void |
173 |
+-condition_var::wait( ) |
174 |
+-{ |
175 |
+- pthread_cond_wait( &m_cond, &m_mutex_lock ); |
176 |
+-} |
177 |
+- |
178 |
+- |
179 |
+--- a/src/mutex.h |
180 |
++++ /dev/null |
181 |
+@@ -1,63 +0,0 @@ |
182 |
+-//---------------------------------------------------------------------------- |
183 |
+-// |
184 |
+-// This file is part of seq24. |
185 |
+-// |
186 |
+-// seq24 is free software; you can redistribute it and/or modify |
187 |
+-// it under the terms of the GNU General Public License as published by |
188 |
+-// the Free Software Foundation; either version 2 of the License, or |
189 |
+-// (at your option) any later version. |
190 |
+-// |
191 |
+-// seq24 is distributed in the hope that it will be useful, |
192 |
+-// but WITHOUT ANY WARRANTY; without even the implied warranty of |
193 |
+-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
194 |
+-// GNU General Public License for more details. |
195 |
+-// |
196 |
+-// You should have received a copy of the GNU General Public License |
197 |
+-// along with seq24; if not, write to the Free Software |
198 |
+-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
199 |
+-// |
200 |
+-//----------------------------------------------------------------------------- |
201 |
+- |
202 |
+-#pragma once |
203 |
+- |
204 |
+-#include "globals.h" |
205 |
+- |
206 |
+-#include <pthread.h> |
207 |
+- |
208 |
+-class mutex { |
209 |
+- |
210 |
+-private: |
211 |
+- |
212 |
+- static const pthread_mutex_t recmutex; |
213 |
+- |
214 |
+-protected: |
215 |
+- |
216 |
+- /* mutex lock */ |
217 |
+- pthread_mutex_t m_mutex_lock; |
218 |
+- |
219 |
+-public: |
220 |
+- |
221 |
+- mutex(); |
222 |
+- |
223 |
+- void lock(); |
224 |
+- void unlock(); |
225 |
+- |
226 |
+-}; |
227 |
+- |
228 |
+-class condition_var : public mutex { |
229 |
+- |
230 |
+-private: |
231 |
+- |
232 |
+- static const pthread_cond_t cond; |
233 |
+- |
234 |
+- pthread_cond_t m_cond; |
235 |
+- |
236 |
+-public: |
237 |
+- |
238 |
+- condition_var(); |
239 |
+- |
240 |
+- void wait(); |
241 |
+- void signal(); |
242 |
+- |
243 |
+-}; |
244 |
+- |
245 |
+--- a/src/perform.cpp |
246 |
++++ b/src/perform.cpp |
247 |
+@@ -426,7 +426,7 @@ perform::~perform() |
248 |
+ m_outputing = false; |
249 |
+ m_running = false; |
250 |
+ |
251 |
+- m_condition_var.signal(); |
252 |
++ m_condition_var.notify_one(); |
253 |
+ |
254 |
+ if (m_out_thread_launched ) |
255 |
+ pthread_join( m_out_thread, NULL ); |
256 |
+@@ -1005,7 +1005,7 @@ void perform::stop() |
257 |
+ |
258 |
+ void perform::inner_start(bool a_state) |
259 |
+ { |
260 |
+- m_condition_var.lock(); |
261 |
++ std::lock_guard<std::mutex> lock(m_mutex); |
262 |
+ |
263 |
+ if (!is_running()) { |
264 |
+ |
265 |
+@@ -1015,10 +1015,8 @@ void perform::inner_start(bool a_state) |
266 |
+ off_sequences(); |
267 |
+ |
268 |
+ set_running(true); |
269 |
+- m_condition_var.signal(); |
270 |
++ m_condition_var.notify_one(); |
271 |
+ } |
272 |
+- |
273 |
+- m_condition_var.unlock(); |
274 |
+ } |
275 |
+ |
276 |
+ |
277 |
+@@ -1262,18 +1260,18 @@ void perform::output_func() |
278 |
+ |
279 |
+ //printf ("waiting for signal\n"); |
280 |
+ |
281 |
+- m_condition_var.lock(); |
282 |
++ std::unique_lock<std::mutex> lock(m_mutex); |
283 |
+ |
284 |
+ while (!m_running) { |
285 |
+ |
286 |
+- m_condition_var.wait(); |
287 |
++ m_condition_var.wait(lock); |
288 |
+ |
289 |
+ /* if stopping, then kill thread */ |
290 |
+ if (!m_outputing) |
291 |
+ break; |
292 |
+ } |
293 |
+ |
294 |
+- m_condition_var.unlock(); |
295 |
++ lock.unlock(); |
296 |
+ |
297 |
+ //printf( "signaled [%d]\n", m_playback_mode ); |
298 |
+ |
299 |
+--- a/src/perform.h |
300 |
++++ b/src/perform.h |
301 |
+@@ -32,6 +32,9 @@ class perform; |
302 |
+ #endif |
303 |
+ #include <pthread.h> |
304 |
+ |
305 |
++#include <condition_variable> |
306 |
++#include <mutex> |
307 |
++ |
308 |
+ |
309 |
+ /* if we have jack, include the jack headers */ |
310 |
+ #ifdef JACK_SUPPORT |
311 |
+@@ -152,7 +155,8 @@ class perform |
312 |
+ int m_control_status; |
313 |
+ int m_screen_set; |
314 |
+ |
315 |
+- condition_var m_condition_var; |
316 |
++ std::condition_variable m_condition_var; |
317 |
++ std::mutex m_mutex; |
318 |
+ |
319 |
+ // do not access these directly, use set/lookup below |
320 |
+ std::map<unsigned int,long> key_events; |
321 |
+--- a/src/perfroll.h |
322 |
++++ b/src/perfroll.h |
323 |
+@@ -39,8 +39,6 @@ |
324 |
+ |
325 |
+ #include "globals.h" |
326 |
+ #include "perform.h" |
327 |
+-#include "mutex.h" |
328 |
+- |
329 |
+ |
330 |
+ using namespace Gtk; |
331 |
+ |
332 |
+--- a/src/sequence.h |
333 |
++++ b/src/sequence.h |
334 |
+@@ -26,11 +26,11 @@ class sequence; |
335 |
+ #include <string> |
336 |
+ #include <list> |
337 |
+ #include <stack> |
338 |
++#include <mutex> |
339 |
+ |
340 |
+ #include "event.h" |
341 |
+ #include "midibus.h" |
342 |
+ #include "globals.h" |
343 |
+-#include "mutex.h" |
344 |
+ |
345 |
+ enum draw_type |
346 |
+ { |
347 |
+@@ -153,7 +153,7 @@ class sequence |
348 |
+ long m_rec_vol; |
349 |
+ |
350 |
+ /* locking */ |
351 |
+- mutex m_mutex; |
352 |
++ std::recursive_mutex m_mutex; |
353 |
+ |
354 |
+ /* used to idenfity which events are ours in the out queue */ |
355 |
+ //unsigned char m_tag; |
356 |
|
357 |
diff --git a/media-sound/seq24/seq24-0.9.3-r1.ebuild b/media-sound/seq24/seq24-0.9.3-r1.ebuild |
358 |
index ebb6c2c844a..9901ff78037 100644 |
359 |
--- a/media-sound/seq24/seq24-0.9.3-r1.ebuild |
360 |
+++ b/media-sound/seq24/seq24-0.9.3-r1.ebuild |
361 |
@@ -28,6 +28,8 @@ RDEPEND="${DEPEND}" |
362 |
|
363 |
DOCS=( AUTHORS ChangeLog README RTC SEQ24 ) |
364 |
|
365 |
+PATCHES=( "${FILESDIR}/${P}-std-mutex.patch" ) |
366 |
+ |
367 |
src_configure() { |
368 |
econf \ |
369 |
$(use_enable jack) \ |