Gentoo Archives: gentoo-commits

From: Pacho Ramos <pacho@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-libs/opal/, net-libs/opal/files/
Date: Sun, 28 May 2017 12:00:09
Message-Id: 1495972310.eb032a7df8f22e980bab0cc686c0ccfb4ce231c0.pacho@gentoo
1 commit: eb032a7df8f22e980bab0cc686c0ccfb4ce231c0
2 Author: Pacho Ramos <pacho <AT> gentoo <DOT> org>
3 AuthorDate: Sun May 28 11:51:50 2017 +0000
4 Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org>
5 CommitDate: Sun May 28 11:51:50 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eb032a7d
7
8 net-libs/opal: Support ffmpeg-3 (#575230 by Oleg)
9
10 Package-Manager: Portage-2.3.6, Repoman-2.3.2
11
12 net-libs/opal/files/opal-3.10.10-ffmpeg2-1.patch | 396 +++++++++++++++++++++++
13 net-libs/opal/opal-3.10.11-r1.ebuild | 253 +++++++++++++++
14 2 files changed, 649 insertions(+)
15
16 diff --git a/net-libs/opal/files/opal-3.10.10-ffmpeg2-1.patch b/net-libs/opal/files/opal-3.10.10-ffmpeg2-1.patch
17 new file mode 100644
18 index 00000000000..6b58ac28f3d
19 --- /dev/null
20 +++ b/net-libs/opal/files/opal-3.10.10-ffmpeg2-1.patch
21 @@ -0,0 +1,396 @@
22 +Submitted By: Igor Živković <contact@××××××××××××××××××.hr>
23 +Date: 2013-10-08
24 +Initial Package Version: 3.10.10
25 +Upstream Status: Unknown
26 +Origin: Gentoo
27 +Description: Fixes building against FFmpeg version >= 2.0.0
28 +
29 +diff -Naur opal-3.10.10.orig/plugins/video/common/dyna.cxx opal-3.10.10/plugins/video/common/dyna.cxx
30 +--- opal-3.10.10.orig/plugins/video/common/dyna.cxx 2013-02-20 03:18:05.000000000 +0100
31 ++++ opal-3.10.10/plugins/video/common/dyna.cxx 2013-10-08 12:57:25.058873513 +0200
32 +@@ -210,7 +210,7 @@
33 + #endif
34 +
35 +
36 +-FFMPEGLibrary::FFMPEGLibrary(CodecID codec)
37 ++FFMPEGLibrary::FFMPEGLibrary(AVCodecID codec)
38 + {
39 + m_codec = codec;
40 + if (m_codec==CODEC_ID_H264)
41 +@@ -348,12 +348,12 @@
42 + return true;
43 + }
44 +
45 +-AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum CodecID id)
46 ++AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum AVCodecID id)
47 + {
48 + return Favcodec_find_encoder(id);
49 + }
50 +
51 +-AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum CodecID id)
52 ++AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum AVCodecID id)
53 + {
54 + WaitAndSignal m(processLock);
55 +
56 +diff -Naur opal-3.10.10.orig/plugins/video/common/dyna.h opal-3.10.10/plugins/video/common/dyna.h
57 +--- opal-3.10.10.orig/plugins/video/common/dyna.h 2013-02-20 03:18:05.000000000 +0100
58 ++++ opal-3.10.10/plugins/video/common/dyna.h 2013-10-08 12:57:25.058873513 +0200
59 +@@ -88,13 +88,13 @@
60 + class FFMPEGLibrary
61 + {
62 + public:
63 +- FFMPEGLibrary(CodecID codec);
64 ++ FFMPEGLibrary(AVCodecID codec);
65 + ~FFMPEGLibrary();
66 +
67 + bool Load();
68 +
69 +- AVCodec *AvcodecFindEncoder(enum CodecID id);
70 +- AVCodec *AvcodecFindDecoder(enum CodecID id);
71 ++ AVCodec *AvcodecFindEncoder(enum AVCodecID id);
72 ++ AVCodec *AvcodecFindDecoder(enum AVCodecID id);
73 + AVCodecContext *AvcodecAllocContext(void);
74 + AVFrame *AvcodecAllocFrame(void);
75 + int AvcodecOpen(AVCodecContext *ctx, AVCodec *codec);
76 +@@ -117,15 +117,15 @@
77 + DynaLink m_libAvcodec;
78 + DynaLink m_libAvutil;
79 +
80 +- CodecID m_codec;
81 ++ AVCodecID m_codec;
82 + char m_codecString[32];
83 +
84 + void (*Favcodec_init)(void);
85 + void (*Fav_init_packet)(AVPacket *pkt);
86 +
87 + void (*Favcodec_register_all)(void);
88 +- AVCodec *(*Favcodec_find_encoder)(enum CodecID id);
89 +- AVCodec *(*Favcodec_find_decoder)(enum CodecID id);
90 ++ AVCodec *(*Favcodec_find_encoder)(enum AVCodecID id);
91 ++ AVCodec *(*Favcodec_find_decoder)(enum AVCodecID id);
92 + AVCodecContext *(*Favcodec_alloc_context)(void);
93 + AVFrame *(*Favcodec_alloc_frame)(void);
94 + int (*Favcodec_open)(AVCodecContext *ctx, AVCodec *codec);
95 +diff -Naur opal-3.10.10.orig/plugins/video/common/ffmpeg/libavcodec/avcodec.h opal-3.10.10/plugins/video/common/ffmpeg/libavcodec/avcodec.h
96 +--- opal-3.10.10.orig/plugins/video/common/ffmpeg/libavcodec/avcodec.h 2013-02-20 03:18:04.000000000 +0100
97 ++++ opal-3.10.10/plugins/video/common/ffmpeg/libavcodec/avcodec.h 2013-10-08 12:57:25.060873488 +0200
98 +@@ -101,7 +101,7 @@
99 + * 1. no value of a existing codec ID changes (that would break ABI),
100 + * 2. it is as close as possible to similar codecs.
101 + */
102 +-enum CodecID {
103 ++enum AVCodecID {
104 + CODEC_ID_NONE,
105 +
106 + /* video codecs */
107 +@@ -1390,7 +1390,7 @@
108 +
109 + char codec_name[32];
110 + enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
111 +- enum CodecID codec_id; /* see CODEC_ID_xxx */
112 ++ enum AVCodecID codec_id; /* see CODEC_ID_xxx */
113 +
114 + /**
115 + * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
116 +@@ -2843,7 +2843,7 @@
117 + */
118 + const char *name;
119 + enum AVMediaType type;
120 +- enum CodecID id;
121 ++ enum AVCodecID id;
122 + int priv_data_size;
123 + int (*init)(AVCodecContext *);
124 + int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
125 +@@ -2898,7 +2898,7 @@
126 + *
127 + * See CODEC_ID_xxx
128 + */
129 +- enum CodecID id;
130 ++ enum AVCodecID id;
131 +
132 + /**
133 + * Supported pixel format.
134 +@@ -3402,10 +3402,10 @@
135 + /**
136 + * Find a registered encoder with a matching codec ID.
137 + *
138 +- * @param id CodecID of the requested encoder
139 ++ * @param id AVCodecID of the requested encoder
140 + * @return An encoder if one was found, NULL otherwise.
141 + */
142 +-AVCodec *avcodec_find_encoder(enum CodecID id);
143 ++AVCodec *avcodec_find_encoder(enum AVCodecID id);
144 +
145 + /**
146 + * Find a registered encoder with the specified name.
147 +@@ -3418,10 +3418,10 @@
148 + /**
149 + * Find a registered decoder with a matching codec ID.
150 + *
151 +- * @param id CodecID of the requested decoder
152 ++ * @param id AVCodecID of the requested decoder
153 + * @return A decoder if one was found, NULL otherwise.
154 + */
155 +-AVCodec *avcodec_find_decoder(enum CodecID id);
156 ++AVCodec *avcodec_find_decoder(enum AVCodecID id);
157 +
158 + /**
159 + * Find a registered decoder with the specified name.
160 +@@ -3822,7 +3822,7 @@
161 + * @param[in] codec_id the codec
162 + * @return Number of bits per sample or zero if unknown for the given codec.
163 + */
164 +-int av_get_bits_per_sample(enum CodecID codec_id);
165 ++int av_get_bits_per_sample(enum AVCodecID codec_id);
166 +
167 + #if FF_API_OLD_SAMPLE_FMT
168 + /**
169 +diff -Naur opal-3.10.10.orig/plugins/video/H.263-1998/h263-1998.cxx opal-3.10.10/plugins/video/H.263-1998/h263-1998.cxx
170 +--- opal-3.10.10.orig/plugins/video/H.263-1998/h263-1998.cxx 2013-02-20 03:18:03.000000000 +0100
171 ++++ opal-3.10.10/plugins/video/H.263-1998/h263-1998.cxx 2013-10-08 12:57:25.061873475 +0200
172 +@@ -48,6 +48,10 @@
173 + #endif
174 +
175 + #include "h263-1998.h"
176 ++extern "C"
177 ++{
178 ++#include <libavutil/opt.h>
179 ++}
180 + #include <limits>
181 + #include <iomanip>
182 + #include <stdio.h>
183 +@@ -203,7 +207,7 @@
184 + PTRACE(4, m_prefix, "Encoder closed");
185 + }
186 +
187 +-bool H263_Base_EncoderContext::Init(CodecID codecId)
188 ++bool H263_Base_EncoderContext::Init(AVCodecID codecId)
189 + {
190 + PTRACE(5, m_prefix, "Opening encoder");
191 +
192 +@@ -317,9 +321,9 @@
193 + // Level 2+
194 + // works with eyeBeam, signaled via non-standard "D"
195 + if (atoi(value) == 1)
196 +- m_context->flags |= CODEC_FLAG_H263P_UMV;
197 ++ av_opt_set_int(m_context->priv_data, "umv", 1, 0);
198 + else
199 +- m_context->flags &= ~CODEC_FLAG_H263P_UMV;
200 ++ av_opt_set_int(m_context->priv_data, "umv", 0, 0);
201 + return;
202 + }
203 +
204 +@@ -328,9 +332,9 @@
205 + // Annex F: Advanced Prediction Mode
206 + // does not work with eyeBeam
207 + if (atoi(value) == 1)
208 +- m_context->flags |= CODEC_FLAG_OBMC;
209 ++ av_opt_set_int(m_context->priv_data, "obmc", 1, 0);
210 + else
211 +- m_context->flags &= ~CODEC_FLAG_OBMC;
212 ++ av_opt_set_int(m_context->priv_data, "obmc", 0, 0);
213 + return;
214 + }
215 + #endif
216 +@@ -360,9 +364,9 @@
217 + // Annex K: Slice Structure
218 + // does not work with eyeBeam
219 + if (atoi(value) != 0)
220 +- m_context->flags |= CODEC_FLAG_H263P_SLICE_STRUCT;
221 ++ av_opt_set_int(m_context->priv_data, "structured_slices", 1, 0);
222 + else
223 +- m_context->flags &= ~CODEC_FLAG_H263P_SLICE_STRUCT;
224 ++ av_opt_set_int(m_context->priv_data, "structured_slices", 0, 0);
225 + return;
226 + }
227 +
228 +@@ -370,9 +374,9 @@
229 + // Annex S: Alternative INTER VLC mode
230 + // does not work with eyeBeam
231 + if (atoi(value) == 1)
232 +- m_context->flags |= CODEC_FLAG_H263P_AIV;
233 ++ av_opt_set_int(m_context->priv_data, "aiv", 1, 0);
234 + else
235 +- m_context->flags &= ~CODEC_FLAG_H263P_AIV;
236 ++ av_opt_set_int(m_context->priv_data, "aiv", 0, 0);
237 + return;
238 + }
239 +
240 +@@ -450,15 +454,6 @@
241 + PTRACE(5, m_prefix, "qmax set to " << m_context->qmax);
242 + PTRACE(5, m_prefix, "payload size set to " << m_context->rtp_payload_size);
243 +
244 +- #define CODEC_TRACER_FLAG(tracer, flag) \
245 +- PTRACE(4, m_prefix, #flag " is " << ((m_context->flags & flag) ? "enabled" : "disabled"));
246 +- CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_UMV);
247 +- CODEC_TRACER_FLAG(tracer, CODEC_FLAG_OBMC);
248 +- CODEC_TRACER_FLAG(tracer, CODEC_FLAG_AC_PRED);
249 +- CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_SLICE_STRUCT)
250 +- CODEC_TRACER_FLAG(tracer, CODEC_FLAG_LOOP_FILTER);
251 +- CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_AIV);
252 +-
253 + return FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec) == 0;
254 + }
255 +
256 +@@ -521,7 +516,7 @@
257 +
258 + // Need to copy to local buffer to guarantee 16 byte alignment
259 + memcpy(m_inputFrame->data[0], OPAL_VIDEO_FRAME_DATA_PTR(header), header->width*header->height*3/2);
260 +- m_inputFrame->pict_type = (flags & PluginCodec_CoderForceIFrame) ? FF_I_TYPE : AV_PICTURE_TYPE_NONE;
261 ++ m_inputFrame->pict_type = (flags & PluginCodec_CoderForceIFrame) ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_NONE;
262 +
263 + /*
264 + m_inputFrame->pts = (int64_t)srcRTP.GetTimestamp()*m_context->time_base.den/m_context->time_base.num/VIDEO_CLOCKRATE;
265 +@@ -603,13 +598,13 @@
266 + m_context->rtp_callback = &H263_RFC2190_EncoderContext::RTPCallBack;
267 + m_context->opaque = this; // used to separate out packets from different encode threads
268 +
269 +- m_context->flags &= ~CODEC_FLAG_H263P_UMV;
270 ++ av_opt_set_int(m_context->priv_data, "umv", 0, 0);
271 + m_context->flags &= ~CODEC_FLAG_4MV;
272 + #if LIBAVCODEC_RTP_MODE
273 + m_context->flags &= ~CODEC_FLAG_H263P_AIC;
274 + #endif
275 +- m_context->flags &= ~CODEC_FLAG_H263P_AIV;
276 +- m_context->flags &= ~CODEC_FLAG_H263P_SLICE_STRUCT;
277 ++ av_opt_set_int(m_context->priv_data, "aiv", 0, 0);
278 ++ av_opt_set_int(m_context->priv_data, "structured_slices", 0, 0);
279 +
280 + return true;
281 + }
282 +diff -Naur opal-3.10.10.orig/plugins/video/H.263-1998/h263-1998.h opal-3.10.10/plugins/video/H.263-1998/h263-1998.h
283 +--- opal-3.10.10.orig/plugins/video/H.263-1998/h263-1998.h 2013-02-20 03:18:03.000000000 +0100
284 ++++ opal-3.10.10/plugins/video/H.263-1998/h263-1998.h 2013-10-08 12:57:25.062873463 +0200
285 +@@ -115,7 +115,7 @@
286 + virtual ~H263_Base_EncoderContext();
287 +
288 + virtual bool Init() = 0;
289 +- virtual bool Init(CodecID codecId);
290 ++ virtual bool Init(AVCodecID codecId);
291 +
292 + virtual bool SetOptions(const char * const * options);
293 + virtual void SetOption(const char * option, const char * value);
294 +diff -Naur opal-3.10.10.orig/plugins/video/H.263-1998/Makefile.in opal-3.10.10/plugins/video/H.263-1998/Makefile.in
295 +--- opal-3.10.10.orig/plugins/video/H.263-1998/Makefile.in 2013-02-20 03:18:03.000000000 +0100
296 ++++ opal-3.10.10/plugins/video/H.263-1998/Makefile.in 2013-10-08 12:57:25.062873463 +0200
297 +@@ -35,7 +35,7 @@
298 + $(COMMONDIR)/dyna.cxx
299 +
300 + CFLAGS += @LIBAVCODEC_CFLAGS@ -I$(COMMONDIR)
301 +-LIBS += @DL_LIBS@
302 ++LIBS += @DL_LIBS@ @LIBAVUTIL_LIBS@
303 +
304 + HAVE_LIBAVCODEC_RTP_MODE=@HAVE_LIBAVCODEC_RTP_MODE@
305 + ifeq ($(HAVE_LIBAVCODEC_RTP_MODE),yes)
306 +diff -Naur opal-3.10.10.orig/plugins/video/H.264/gpl/h264_helper.cxx opal-3.10.10/plugins/video/H.264/gpl/h264_helper.cxx
307 +--- opal-3.10.10.orig/plugins/video/H.264/gpl/h264_helper.cxx 2013-02-20 03:18:02.000000000 +0100
308 ++++ opal-3.10.10/plugins/video/H.264/gpl/h264_helper.cxx 2013-10-08 12:57:25.062873463 +0200
309 +@@ -27,6 +27,7 @@
310 + #include <fstream>
311 + #include <stdlib.h>
312 + #include <sys/stat.h>
313 ++#include <unistd.h>
314 +
315 + #ifdef HAVE_UNISTD_H
316 + #include <unistd.h>
317 +diff -Naur opal-3.10.10.orig/plugins/video/H.264/h264-x264.cxx opal-3.10.10/plugins/video/H.264/h264-x264.cxx
318 +--- opal-3.10.10.orig/plugins/video/H.264/h264-x264.cxx 2013-02-20 03:18:02.000000000 +0100
319 ++++ opal-3.10.10/plugins/video/H.264/h264-x264.cxx 2013-10-08 12:57:25.063873450 +0200
320 +@@ -40,6 +40,9 @@
321 + #include "plugin-config.h"
322 + #endif
323 +
324 ++#define FF_IDCT_H264 11
325 ++#define CODEC_FLAG2_SKIP_RD 0x00004000
326 ++
327 + #include <codec/opalplugin.hpp>
328 +
329 + #include "../common/ffmpeg.h"
330 +@@ -1071,13 +1074,10 @@
331 + return false;
332 +
333 + m_context->workaround_bugs = FF_BUG_AUTODETECT;
334 +- m_context->error_recognition = FF_ER_AGGRESSIVE;
335 + m_context->idct_algo = FF_IDCT_H264;
336 + m_context->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK;
337 + m_context->flags = CODEC_FLAG_INPUT_PRESERVED | CODEC_FLAG_EMU_EDGE;
338 +- m_context->flags2 = CODEC_FLAG2_BRDO |
339 +- CODEC_FLAG2_MEMC_ONLY |
340 +- CODEC_FLAG2_DROP_FRAME_TIMECODE |
341 ++ m_context->flags2 = CODEC_FLAG2_DROP_FRAME_TIMECODE |
342 + CODEC_FLAG2_SKIP_RD |
343 + CODEC_FLAG2_CHUNKS;
344 +
345 +diff -Naur opal-3.10.10.orig/plugins/video/H.264/shared/x264wrap.cxx opal-3.10.10/plugins/video/H.264/shared/x264wrap.cxx
346 +--- opal-3.10.10.orig/plugins/video/H.264/shared/x264wrap.cxx 2013-02-20 03:18:02.000000000 +0100
347 ++++ opal-3.10.10/plugins/video/H.264/shared/x264wrap.cxx 2013-10-08 12:57:25.064873438 +0200
348 +@@ -33,6 +33,7 @@
349 +
350 + #include <codec/opalplugin.hpp>
351 + #include <stdio.h>
352 ++#include <unistd.h>
353 +
354 + #ifdef HAVE_UNISTD_H
355 + #include <unistd.h>
356 +diff -Naur opal-3.10.10.orig/plugins/video/MPEG4-ffmpeg/Makefile.in opal-3.10.10/plugins/video/MPEG4-ffmpeg/Makefile.in
357 +--- opal-3.10.10.orig/plugins/video/MPEG4-ffmpeg/Makefile.in 2013-02-20 03:18:07.000000000 +0100
358 ++++ opal-3.10.10/plugins/video/MPEG4-ffmpeg/Makefile.in 2013-10-08 12:57:25.064873438 +0200
359 +@@ -31,7 +31,7 @@
360 + SRCS := mpeg4.cxx $(COMMONDIR)/dyna.cxx
361 +
362 + CFLAGS += @LIBAVCODEC_CFLAGS@ -I$(COMMONDIR)
363 +-LIBS += @DL_LIBS@
364 ++LIBS += @DL_LIBS@ @LIBAVUTIL_LIBS@
365 +
366 + # Add LIBAVCODEC_SOURCE_DIR to the include path so we can #include <libavcodec/...h>
367 + # Also add libavutil, so ffmpeg headers can #include "log.h".
368 +diff -Naur opal-3.10.10.orig/plugins/video/MPEG4-ffmpeg/mpeg4.cxx opal-3.10.10/plugins/video/MPEG4-ffmpeg/mpeg4.cxx
369 +--- opal-3.10.10.orig/plugins/video/MPEG4-ffmpeg/mpeg4.cxx 2013-02-20 03:18:07.000000000 +0100
370 ++++ opal-3.10.10/plugins/video/MPEG4-ffmpeg/mpeg4.cxx 2013-10-08 12:57:25.065873425 +0200
371 +@@ -103,6 +103,7 @@
372 +
373 + #else /* LIBAVCODEC_HAVE_SOURCE_DIR */
374 + #include "../common/ffmpeg.h"
375 ++#include <libavutil/opt.h>
376 + #endif /* LIBAVCODEC_HAVE_SOURCE_DIR */
377 + }
378 +
379 +@@ -589,17 +590,17 @@
380 + m_avpicture->quality = m_videoQMin;
381 +
382 + #ifdef USE_ORIG
383 +- m_avcontext->flags |= CODEC_FLAG_PART; // data partitioning
384 ++ av_opt_set_int(m_avcontext->priv_data, "data_partitionin", 1, 0);
385 + m_avcontext->flags |= CODEC_FLAG_4MV; // 4 motion vectors
386 + #else
387 + m_avcontext->max_b_frames=0; /*don't use b frames*/
388 + m_avcontext->flags|=CODEC_FLAG_AC_PRED;
389 +- m_avcontext->flags|=CODEC_FLAG_H263P_UMV;
390 ++ av_opt_set_int(m_avcontext->priv_data, "umv", 1, 0);
391 + /*c->flags|=CODEC_FLAG_QPEL;*/ /*don't enable this one: this forces profile_level to advanced simple profile */
392 + m_avcontext->flags|=CODEC_FLAG_4MV;
393 + m_avcontext->flags|=CODEC_FLAG_GMC;
394 + m_avcontext->flags|=CODEC_FLAG_LOOP_FILTER;
395 +- m_avcontext->flags|=CODEC_FLAG_H263P_SLICE_STRUCT;
396 ++ av_opt_set_int(m_avcontext->priv_data, "structured_slices", 1, 0);
397 + #endif
398 + m_avcontext->opaque = this; // for use in RTP callback
399 + }
400 +@@ -804,7 +805,7 @@
401 + // Should the next frame be an I-Frame?
402 + if ((flags & PluginCodec_CoderForceIFrame) || (m_frameNum == 0))
403 + {
404 +- m_avpicture->pict_type = FF_I_TYPE;
405 ++ m_avpicture->pict_type = AV_PICTURE_TYPE_I;
406 + }
407 + else // No IFrame requested, let avcodec decide what to do
408 + {
409 +@@ -1325,7 +1326,7 @@
410 +
411 + void MPEG4DecoderContext::SetStaticDecodingParams() {
412 + m_avcontext->flags |= CODEC_FLAG_4MV;
413 +- m_avcontext->flags |= CODEC_FLAG_PART;
414 ++ av_opt_set_int(m_avcontext->priv_data, "data_partitionin", 1, 0);
415 + m_avcontext->workaround_bugs = 0; // no workaround for buggy implementations
416 + }
417 +
418
419 diff --git a/net-libs/opal/opal-3.10.11-r1.ebuild b/net-libs/opal/opal-3.10.11-r1.ebuild
420 new file mode 100644
421 index 00000000000..333385c2cdd
422 --- /dev/null
423 +++ b/net-libs/opal/opal-3.10.11-r1.ebuild
424 @@ -0,0 +1,253 @@
425 +# Copyright 1999-2017 Gentoo Foundation
426 +# Distributed under the terms of the GNU General Public License v2
427 +
428 +EAPI=6
429 +inherit autotools toolchain-funcs java-pkg-opt-2 flag-o-matic
430 +
431 +DESCRIPTION="C++ class library normalising numerous telephony protocols"
432 +HOMEPAGE="http://www.opalvoip.org/"
433 +SRC_URI="mirror://sourceforge/opalvoip/${P}.tar.bz2
434 + doc? ( mirror://sourceforge/opalvoip/${P}-htmldoc.tar.bz2 )"
435 +
436 +LICENSE="MPL-1.0"
437 +SLOT="0"
438 +KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86"
439 +IUSE="celt debug doc +dtmf examples fax ffmpeg h224 h281 h323 iax ilbc
440 +ipv6 ivr ixj java ldap libav lid +plugins sbc +sip +sipim +sound srtp ssl static-libs
441 +stats swig theora +video vpb vxml +wav x264 x264-static +xml"
442 +
443 +REQUIRED_USE="
444 + x264-static? ( x264 )
445 + h281? ( h224 )
446 + sip? ( sipim )
447 +"
448 +
449 +RDEPEND="
450 + >=net-libs/ptlib-2.10.10:=[stun,debug=,dtmf,http,ipv6?,ldap?,sound?,ssl?,video?,vxml?,wav?,xml?]
451 + >=media-libs/speex-1.2_beta
452 + fax? ( net-libs/ptlib[asn] )
453 + h323? ( net-libs/ptlib[asn] )
454 + ivr? ( net-libs/ptlib[http,xml,vxml] )
455 + java? ( >=virtual/jre-1.4 )
456 + plugins? (
457 + media-sound/gsm
458 + celt? ( media-libs/celt )
459 + ffmpeg? (
460 + libav? ( media-video/libav:0=[encode] )
461 + !libav? ( media-video/ffmpeg:0=[encode] ) )
462 + ixj? ( sys-kernel/linux-headers )
463 + ilbc? ( dev-libs/ilbc-rfc3951 )
464 + sbc? ( media-libs/libsamplerate )
465 + theora? ( media-libs/libtheora )
466 + x264? ( virtual/ffmpeg
467 + media-libs/x264 ) )
468 + srtp? ( net-libs/libsrtp )
469 + vxml? ( net-libs/ptlib[http,vxml] )
470 +"
471 +DEPEND="${RDEPEND}
472 + virtual/pkgconfig
473 + java? ( swig? ( dev-lang/swig )
474 + >=virtual/jdk-1.4 )
475 +"
476 +
477 +# NOTES:
478 +# ffmpeg[encode] is for h263 and mpeg4
479 +# ssl, xml, vxml, ipv6, ldap, sound, wav, and video are use flags
480 +# herited from ptlib: feature is enabled if ptlib has enabled it
481 +# however, disabling it if ptlib has it looks hard (coz of buildopts.h)
482 +# forcing ptlib to disable it for opal is not a solution too
483 +# atm, accepting the "auto-feature" looks like a good solution
484 +# (asn is used for fax and config _only_ for examples)
485 +# OPALDIR should not be used anymore but if a package still need it, create it
486 +
487 +pkg_setup() {
488 + # workaround for bug 282838
489 + append-cxxflags "-fno-visibility-inlines-hidden"
490 + append-cxxflags "-fno-strict-aliasing"
491 +
492 + java-pkg-opt-2_pkg_setup
493 +}
494 +
495 +src_prepare() {
496 + default
497 +
498 + # remove visual studio related files from samples/
499 + if use examples; then
500 + rm -f samples/*/*.vcproj
501 + rm -f samples/*/*.sln
502 + rm -f samples/*/*.dsp
503 + rm -f samples/*/*.dsw
504 + fi
505 +
506 + # LFS ffmpeg2+ fixes.
507 + eapply "${FILESDIR}"/opal-3.10.10-ffmpeg2-1.patch
508 +
509 + if ! use h323; then
510 + # Without this patch, ekiga wont compile, even with
511 + # USE=-h323.
512 + eapply "${FILESDIR}/${PN}-3.10.9-disable-h323-workaround.patch"
513 + fi
514 +
515 + eapply "${FILESDIR}/${PN}-3.10.9-java-ruby-swig-fix.patch"
516 +
517 + sed -i -e "s:\(.*HAS_H224.*\), \[OPAL_H323\]:\1:" configure.ac \
518 + || die "sed failed"
519 +
520 + # sed fixes for ffmpeg-3.
521 + sed -e 's/CODEC_ID/AV_&/' \
522 + -e 's/PIX_FMT_/AV_&/' \
523 + -i plugins/video/H.263-1998/h263-1998.cxx \
524 + plugins/video/common/dyna.cxx \
525 + plugins/video/H.264/h264-x264.cxx \
526 + plugins/video/MPEG4-ffmpeg/mpeg4.cxx || die "sed failed"
527 +
528 + eaclocal
529 + eautoconf
530 +
531 + # in plugins
532 + cd plugins/
533 + eaclocal
534 + eautoconf
535 + cd ..
536 +
537 + # disable celt if celt is not enabled (prevent auto magic dep)
538 + # already in repository
539 + if ! use celt; then
540 + sed -i -e "s/HAVE_CELT=yes/HAVE_CELT=no/" plugins/configure \
541 + || die "sed failed"
542 + fi
543 +
544 + # fix automatic swig detection, upstream bug 2712521 (upstream reject it)
545 + if ! use swig; then
546 + sed -i -e "/^SWIG=/d" configure || die "patching configure failed"
547 + fi
548 +
549 + use ilbc || { rm -r plugins/audio/iLBC/ || die "removing iLBC failed"; }
550 +
551 + java-pkg-opt-2_src_prepare
552 +}
553 +
554 +src_configure() {
555 + local forcedconf=""
556 +
557 + # fix bug 277233, upstream bug 2820939
558 + if use fax; then
559 + forcedconf="${forcedconf} --enable-statistics"
560 + fi
561 +
562 + # --with-libavcodec-source-dir should _not_ be set, it's for trunk sources
563 + # versioncheck: check for ptlib version
564 + # shared: should always be enabled for a lib
565 + # localspeex, localspeexdsp, localgsm, localilbc: never use bundled libs
566 + # samples: only build some samples, useless
567 + # libavcodec-stackalign-hack: prevent hack (default disable by upstream)
568 + # default-to-full-capabilties: default enable by upstream
569 + # aec: atm, only used when bundled speex, so it's painless for us
570 + # zrtp doesn't depend on net-libs/libzrtpcpp but on libzrtp from
571 + # http://zfoneproject.com/ wich is not in portage
572 + # msrp: highly experimental
573 + # spandsp: doesn't work with newest spandsp, upstream bug 2796047
574 + # g711plc: force enable
575 + # rfc4103: not really used, upstream bug 2795831
576 + # t38, spandsp: merged in fax
577 + # h450, h460, h501: merged in h323 (they are additional features of h323)
578 + econf \
579 + --enable-versioncheck \
580 + --enable-shared \
581 + --disable-zrtp \
582 + --disable-localspeex \
583 + --disable-localspeexdsp \
584 + --disable-localgsm \
585 + --disable-localilbc \
586 + --disable-samples \
587 + --disable-libavcodec-stackalign-hack \
588 + --enable-default-to-full-capabilties \
589 + --enable-aec \
590 + --disable-msrp \
591 + --disable-spandsp \
592 + --enable-g711plc \
593 + --enable-rfc4103 \
594 + --disable-capi \
595 + $(use_enable debug) \
596 + $(use_enable fax) \
597 + $(use_enable fax t38) \
598 + $(use_enable h224) \
599 + $(use_enable h281) \
600 + $(use_enable h323) \
601 + $(use_enable h323 h450) \
602 + $(use_enable h323 h460) \
603 + $(use_enable h323 h501) \
604 + $(use_enable iax) \
605 + $(use_enable ivr) \
606 + $(use_enable ixj) \
607 + $(use_enable java) \
608 + $(use_enable lid) \
609 + $(use_enable plugins) \
610 + $(use_enable sbc) \
611 + $(use_enable sip) \
612 + $(use_enable sipim) \
613 + $(use_enable stats statistics) \
614 + $(use_enable video) $(use_enable video rfc4175) \
615 + $(use_enable vpb) \
616 + $(use_enable x264 h264) \
617 + $(use_enable x264-static x264-link-static) \
618 + ${forcedconf}
619 +}
620 +
621 +src_compile() {
622 + local makeopts=""
623 +
624 + use debug && makeopts="debug"
625 +
626 + emake ${makeopts}
627 +}
628 +
629 +src_install() {
630 + default
631 +
632 + # Get rid of static libraries if not requested
633 + # There seems to be no easy way to disable this in the build system
634 + if ! use static-libs; then
635 + rm -v "${D}"/usr/lib*/*.a || die
636 + fi
637 +
638 + if use doc; then
639 + dohtml -r "${WORKDIR}"/html/* docs/* || die "dohtml failed"
640 + fi
641 +
642 + if use examples; then
643 + local exampledir="/usr/share/doc/${PF}/examples"
644 + local basedir="samples"
645 + local sampledirs="`ls ${basedir} --hide=configure* \
646 + --hide=opal_samples.mak.in`"
647 +
648 + # first, install files
649 + insinto ${exampledir}/
650 + doins ${basedir}/{configure*,opal_samples*} \
651 + || die "doins failed"
652 +
653 + # now, all examples
654 + for x in ${sampledirs}; do
655 + insinto ${exampledir}/${x}/
656 + doins ${basedir}/${x}/* || die "doins failed"
657 + done
658 +
659 + # some examples need version.h
660 + insinto "/usr/share/doc/${PF}/"
661 + doins version.h || die "doins failed"
662 + fi
663 +}
664 +
665 +pkg_postinst() {
666 + if use examples; then
667 + ewarn "All examples have been installed, some of them will not work on your system"
668 + ewarn "it will depend of the enabled USE flags in ptlib and opal"
669 + fi
670 +
671 + if ! use plugins || ! use sound || ! use video; then
672 + ewarn "You have disabled sound, video or plugins USE flags."
673 + ewarn "Most audio/video features or plugins have been disabled silently"
674 + ewarn "even if enabled via USE flags."
675 + ewarn "Having a feature enabled via USE flag but disabled can lead to issues."
676 + fi
677 +}