Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: Wes <anomaly256@×××××.com>
Subject: Re: [gentoo-dev] Quick RFC: USE=libav vs FFMPEG_IMPL=libav|ffmpeg
Date: Mon, 02 Feb 2015 22:48:05
Message-Id: 20150202234743.48f1d068@pomiot.lan
In Reply to: [gentoo-dev] Quick RFC: USE=libav vs FFMPEG_IMPL=libav|ffmpeg by "Michał Górny"
1 Dnia 2015-02-02, o godz. 15:06:40
2 Michał Górny <mgorny@g.o> napisał(a):
3
4 > The idea is that instead of having USE=libav (that's tangential to
5 > USE=ffmpeg and confusing) to use a USE_EXPAND like FFMPEG_IMPL taking
6 > either ffmpeg or libav. Now, why...
7
8 Ok, since this is going to be a long night, a quick summary of
9 the alternatives.
10
11 First of all, plain USE='ffmpeg libav' where each one signifies one of
12 the impls. This can't work because we already have packages that depend
13 on, say, 'app-misc/tracker[ffmpeg]'. If we replaced that with two
14 optional flags, we'd have to do '|| ( tracker[ffmpeg] tracker[libav]
15 )'. And || () deps are pretty much fragile, don't support := operator
16 and cause unpredictable blockers during dependency resolution. So this
17 can't work.
18
19 Secondly, global variables that are not USE flags. They can't work
20 since the dependencies in ebuilds need to be consistent and can not be
21 affected by external variables.
22
23 Thirdly, || () blocks. I already listed above why they must not be used.
24
25
26 So, after throwing all technically unsound solutions, we are left with
27 having to have exactly one *feature flag* -- the flag that enables
28 ffmpeg-or-libav support in the packages that have it optional, and one
29 or more *implementation flags* that select the implementation when more
30 than one can be used.
31
32 For feature flag, name is the only issue. Currently USE=ffmpeg serves
33 that purpose and I think changing that would have a very high cost
34 (and cause a lot of bikeshed), esp. if we would end up reusing the flag
35 for another purpose. So most likely leave it as-is.
36
37 For implementation flags, we have three options:
38
39 a. one binary 'libav' flag that switches between the two
40 implementations,
41
42 b. two regular unary flags that select one of the implementations,
43
44 c. two USE_EXPAND unary flags that select one of the implementations.
45
46
47 A. binary 'libav' flag (or similar)
48
49 default set in profiles:
50
51 USE="${USE} libav"
52
53 user changes impl to ffmpeg:
54
55 USE="-libav"
56
57 portage output:
58
59 media-video/foo USE="... ffmpeg ... libav ..."
60
61 ebuild code:
62
63 IUSE="ffmpeg libav"
64
65 RDEPEND="
66 ffmpeg? (
67 !libav? ( media-video/ffmpeg:0= )
68 libav? ( media-video/libav:0= )
69 )"
70
71 non-meaningful flag combinations:
72
73 USE="-ffmpeg libav" -> doesn't give you libav
74
75
76 B. two regular unary flags (i'm going to use ffmpeg/libav here but
77 the names would likely have to be different)
78
79 default set in profiles:
80
81 USE="${USE} libav"
82
83 user changes impl to ffmpeg:
84
85 USE="-libav ffmpeg"
86
87 portage output:
88
89 media-video/foo USE="... avcodec ... libav ... -ffmpeg ..."
90
91 ebuild code:
92
93 IUSE="avcodec ffmpeg libav"
94
95 RDEPEND="
96 avcodec? (
97 ffmpeg? ( media-video/ffmpeg:0= )
98 libav? ( media-video/libav:0= )
99 )"
100
101 REQUIRED_USE="avcodec? ( ^^ ( ffmpeg libav ) )"
102
103 non-meaningful flag combinations:
104
105 USE="-avcodec *" -> doesn't give you libav or ffmpeg
106
107 disallowed flag combinations:
108
109 USE="avcodec -ffmpeg -libav" -> no implementation selected
110 USE="avcodec ffmpeg libav" -> multiple implementations selected
111
112
113 C. two USE_EXPAND unary flags
114
115 default set in profiles:
116
117 FFMPEG_IMPL="libav"
118
119 user changes impl to ffmpeg:
120
121 FFMPEG_IMPL=ffmpeg
122
123 portage output:
124
125 media-video/foo USE="... ffmpeg ..." FFMPEG_IMPL="libav -ffmpeg"
126
127 ebuild code (yeah, pain to type -- but only once...):
128
129 IUSE="ffmpeg ffmpeg_impl_ffmpeg ffmpeg_impl_libav"
130
131 RDEPEND="
132 ffmpeg? (
133 ffmpeg_impl_ffmpeg? ( media-video/ffmpeg:0= )
134 ffmpeg_impl_libav? ( media-video/libav:0= )
135 )"
136
137 REQUIRED_USE="ffmpeg? ( ^^ ( ffmpeg_impl_ffmpeg ffmpeg_impl_libav ) )"
138
139 non-meaningful flag combinations:
140
141 USE="-ffmpeg" FFMPEG_IMPL="*" -> doesn't give you libav or ffmpeg
142
143 disallowed flag combinations:
144
145 USE="ffmpeg" FFMPEG_IMPL="-ffmpeg -libav" -> no implementation selected
146 USE="ffmpeg" FFMPEG_IMPL="ffmpeg libav" -> multiple implementations selected
147
148
149 --
150 Best regards,
151 Michał Górny

Replies

Subject Author
Re: [gentoo-dev] Quick RFC: USE=libav vs FFMPEG_IMPL=libav|ffmpeg Michael Orlitzky <mjo@g.o>