Line 0
Link Here
|
|
|
1 |
# Copyright 1999-2022 Gentoo Authors |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
|
4 |
EAPI=7 |
5 |
|
6 |
# Subslot: libavutil major.libavcodec major.libavformat major |
7 |
# Since FFmpeg ships several libraries, subslot is kind of limited here. |
8 |
# Most consumers will use those three libraries, if a "less used" library |
9 |
# changes its soname, consumers will have to be rebuilt the old way |
10 |
# (preserve-libs). |
11 |
# If, for example, a package does not link to libavformat and only libavformat |
12 |
# changes its ABI then this package will be rebuilt needlessly. Hence, such a |
13 |
# package is free _not_ to := depend on FFmpeg but I would strongly encourage |
14 |
# doing so since such a case is unlikely. |
15 |
FFMPEG_SUBSLOT=57.59.59 |
16 |
|
17 |
SCM="" |
18 |
if [ "${PV#9999}" != "${PV}" ] ; then |
19 |
SCM="git-r3" |
20 |
EGIT_MIN_CLONE_TYPE="single" |
21 |
EGIT_REPO_URI="https://git.ffmpeg.org/ffmpeg.git" |
22 |
fi |
23 |
|
24 |
inherit flag-o-matic multilib multilib-minimal toolchain-funcs ${SCM} |
25 |
|
26 |
DESCRIPTION="Complete solution to record/convert/stream audio and video. Includes libavcodec" |
27 |
HOMEPAGE="https://ffmpeg.org/" |
28 |
if [ "${PV#9999}" != "${PV}" ] ; then |
29 |
SRC_URI="" |
30 |
elif [ "${PV%_p*}" != "${PV}" ] ; then # Snapshot |
31 |
SRC_URI="mirror://gentoo/${P}.tar.xz" |
32 |
else # Release |
33 |
VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/ffmpeg.asc |
34 |
inherit verify-sig |
35 |
SRC_URI="https://ffmpeg.org/releases/${P/_/-}.tar.xz" |
36 |
SRC_URI+=" verify-sig? ( https://ffmpeg.org/releases/${P/_/-}.tar.xz.asc )" |
37 |
|
38 |
BDEPEND=" verify-sig? ( sec-keys/openpgp-keys-ffmpeg )" |
39 |
fi |
40 |
FFMPEG_REVISION="${PV#*_p}" |
41 |
|
42 |
SLOT="0/${FFMPEG_SUBSLOT}" |
43 |
LICENSE=" |
44 |
!gpl? ( LGPL-2.1 ) |
45 |
gpl? ( GPL-2 ) |
46 |
amr? ( |
47 |
gpl? ( GPL-3 ) |
48 |
!gpl? ( LGPL-3 ) |
49 |
) |
50 |
gmp? ( |
51 |
gpl? ( GPL-3 ) |
52 |
!gpl? ( LGPL-3 ) |
53 |
) |
54 |
libaribb24? ( |
55 |
gpl? ( GPL-3 ) |
56 |
!gpl? ( LGPL-3 ) |
57 |
) |
58 |
encode? ( |
59 |
amrenc? ( |
60 |
gpl? ( GPL-3 ) |
61 |
!gpl? ( LGPL-3 ) |
62 |
) |
63 |
) |
64 |
samba? ( GPL-3 ) |
65 |
" |
66 |
if [ "${PV#9999}" = "${PV}" ] ; then |
67 |
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos" |
68 |
fi |
69 |
|
70 |
# Options to use as use_enable in the foo[:bar] form. |
71 |
# This will feed configure with $(use_enable foo bar) |
72 |
# or $(use_enable foo foo) if no :bar is set. |
73 |
# foo is added to IUSE. |
74 |
FFMPEG_FLAG_MAP=( |
75 |
+bzip2:bzlib cpudetection:runtime-cpudetect debug gcrypt +gnutls gmp |
76 |
+gpl hardcoded-tables +iconv libxml2 lzma +network opencl |
77 |
openssl +postproc samba:libsmbclient sdl:ffplay sdl:sdl2 vaapi vdpau vulkan |
78 |
X:xlib X:libxcb X:libxcb-shm X:libxcb-xfixes +zlib |
79 |
# libavdevice options |
80 |
cdio:libcdio iec61883:libiec61883 ieee1394:libdc1394 libcaca openal |
81 |
opengl |
82 |
# indevs |
83 |
libv4l:libv4l2 pulseaudio:libpulse libdrm jack:libjack |
84 |
# decoders |
85 |
amr:libopencore-amrwb amr:libopencore-amrnb codec2:libcodec2 +dav1d:libdav1d fdk:libfdk-aac |
86 |
jpeg2k:libopenjpeg jpegxl:libjxl bluray:libbluray gme:libgme gsm:libgsm |
87 |
libaribb24 mmal modplug:libmodplug opus:libopus libilbc librtmp ssh:libssh |
88 |
speex:libspeex srt:libsrt svg:librsvg nvenc:ffnvcodec |
89 |
vorbis:libvorbis vpx:libvpx zvbi:libzvbi |
90 |
# libavfilter options |
91 |
appkit |
92 |
bs2b:libbs2b chromaprint cuda:cuda-llvm flite:libflite frei0r vmaf:libvmaf |
93 |
fribidi:libfribidi fontconfig ladspa lcms:lcms2 libass libplacebo libtesseract lv2 |
94 |
truetype:libfreetype vidstab:libvidstab |
95 |
rubberband:librubberband zeromq:libzmq zimg:libzimg |
96 |
# libswresample options |
97 |
libsoxr |
98 |
# Threads; we only support pthread for now but ffmpeg supports more |
99 |
+threads:pthreads |
100 |
) |
101 |
|
102 |
# Same as above but for encoders, i.e. they do something only with USE=encode. |
103 |
FFMPEG_ENCODER_FLAG_MAP=( |
104 |
amf amrenc:libvo-amrwbenc kvazaar:libkvazaar libaom mp3:libmp3lame |
105 |
openh264:libopenh264 rav1e:librav1e snappy:libsnappy svt-av1:libsvtav1 |
106 |
theora:libtheora twolame:libtwolame webp:libwebp x264:libx264 |
107 |
x265:libx265 xvid:libxvid |
108 |
) |
109 |
|
110 |
IUSE=" |
111 |
alsa chromium doc +encode oss pic sndio static-libs test v4l |
112 |
${FFMPEG_FLAG_MAP[@]%:*} |
113 |
${FFMPEG_ENCODER_FLAG_MAP[@]%:*} |
114 |
" |
115 |
|
116 |
# Strings for CPU features in the useflag[:configure_option] form |
117 |
# if :configure_option isn't set, it will use 'useflag' as configure option |
118 |
ARM_CPU_FEATURES=( |
119 |
cpu_flags_arm_thumb:armv5te |
120 |
cpu_flags_arm_v6:armv6 |
121 |
cpu_flags_arm_thumb2:armv6t2 |
122 |
cpu_flags_arm_neon:neon |
123 |
cpu_flags_arm_vfp:vfp |
124 |
cpu_flags_arm_vfpv3:vfpv3 |
125 |
cpu_flags_arm_v8:armv8 |
126 |
) |
127 |
ARM_CPU_REQUIRED_USE=" |
128 |
arm64? ( cpu_flags_arm_v8 ) |
129 |
cpu_flags_arm_v8? ( cpu_flags_arm_vfpv3 cpu_flags_arm_neon ) |
130 |
cpu_flags_arm_neon? ( cpu_flags_arm_thumb2 cpu_flags_arm_vfp ) |
131 |
cpu_flags_arm_vfpv3? ( cpu_flags_arm_vfp ) |
132 |
cpu_flags_arm_thumb2? ( cpu_flags_arm_v6 ) |
133 |
cpu_flags_arm_v6? ( cpu_flags_arm_thumb ) |
134 |
" |
135 |
MIPS_CPU_FEATURES=( mipsdspr1:mipsdsp mipsdspr2 mipsfpu ) |
136 |
PPC_CPU_FEATURES=( cpu_flags_ppc_altivec:altivec cpu_flags_ppc_vsx:vsx cpu_flags_ppc_vsx2:power8 ) |
137 |
PPC_CPU_REQUIRED_USE=" |
138 |
cpu_flags_ppc_vsx? ( cpu_flags_ppc_altivec ) |
139 |
cpu_flags_ppc_vsx2? ( cpu_flags_ppc_vsx ) |
140 |
" |
141 |
X86_CPU_FEATURES_RAW=( 3dnow:amd3dnow 3dnowext:amd3dnowext aes:aesni avx:avx avx2:avx2 fma3:fma3 fma4:fma4 mmx:mmx mmxext:mmxext sse:sse sse2:sse2 sse3:sse3 ssse3:ssse3 sse4_1:sse4 sse4_2:sse42 xop:xop ) |
142 |
X86_CPU_FEATURES=( ${X86_CPU_FEATURES_RAW[@]/#/cpu_flags_x86_} ) |
143 |
X86_CPU_REQUIRED_USE=" |
144 |
cpu_flags_x86_avx2? ( cpu_flags_x86_avx ) |
145 |
cpu_flags_x86_fma4? ( cpu_flags_x86_avx ) |
146 |
cpu_flags_x86_fma3? ( cpu_flags_x86_avx ) |
147 |
cpu_flags_x86_xop? ( cpu_flags_x86_avx ) |
148 |
cpu_flags_x86_avx? ( cpu_flags_x86_sse4_2 ) |
149 |
cpu_flags_x86_aes? ( cpu_flags_x86_sse4_2 ) |
150 |
cpu_flags_x86_sse4_2? ( cpu_flags_x86_sse4_1 ) |
151 |
cpu_flags_x86_sse4_1? ( cpu_flags_x86_ssse3 ) |
152 |
cpu_flags_x86_ssse3? ( cpu_flags_x86_sse3 ) |
153 |
cpu_flags_x86_sse3? ( cpu_flags_x86_sse2 ) |
154 |
cpu_flags_x86_sse2? ( cpu_flags_x86_sse ) |
155 |
cpu_flags_x86_sse? ( cpu_flags_x86_mmxext ) |
156 |
cpu_flags_x86_mmxext? ( cpu_flags_x86_mmx ) |
157 |
cpu_flags_x86_3dnowext? ( cpu_flags_x86_3dnow ) |
158 |
cpu_flags_x86_3dnow? ( cpu_flags_x86_mmx ) |
159 |
" |
160 |
|
161 |
CPU_FEATURES_MAP=( |
162 |
${ARM_CPU_FEATURES[@]} |
163 |
${MIPS_CPU_FEATURES[@]} |
164 |
${PPC_CPU_FEATURES[@]} |
165 |
${X86_CPU_FEATURES[@]} |
166 |
) |
167 |
IUSE="${IUSE} |
168 |
${CPU_FEATURES_MAP[@]%:*}" |
169 |
|
170 |
CPU_REQUIRED_USE=" |
171 |
${ARM_CPU_REQUIRED_USE} |
172 |
${PPC_CPU_REQUIRED_USE} |
173 |
${X86_CPU_REQUIRED_USE} |
174 |
" |
175 |
|
176 |
FFTOOLS=( aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart sidxindex trasher ) |
177 |
IUSE="${IUSE} ${FFTOOLS[@]/#/+fftools_}" |
178 |
|
179 |
RDEPEND=" |
180 |
alsa? ( >=media-libs/alsa-lib-1.0.27.2[${MULTILIB_USEDEP}] ) |
181 |
amf? ( media-video/amdgpu-pro-amf ) |
182 |
amr? ( >=media-libs/opencore-amr-0.1.3-r1[${MULTILIB_USEDEP}] ) |
183 |
bluray? ( >=media-libs/libbluray-0.3.0-r1:=[${MULTILIB_USEDEP}] ) |
184 |
bs2b? ( >=media-libs/libbs2b-3.1.0-r1[${MULTILIB_USEDEP}] ) |
185 |
bzip2? ( >=app-arch/bzip2-1.0.6-r4[${MULTILIB_USEDEP}] ) |
186 |
cdio? ( >=dev-libs/libcdio-paranoia-0.90_p1-r1[${MULTILIB_USEDEP}] ) |
187 |
chromaprint? ( >=media-libs/chromaprint-1.2-r1[${MULTILIB_USEDEP}] ) |
188 |
codec2? ( media-libs/codec2[${MULTILIB_USEDEP}] ) |
189 |
dav1d? ( >=media-libs/dav1d-0.4.0:0=[${MULTILIB_USEDEP}] ) |
190 |
encode? ( |
191 |
amrenc? ( >=media-libs/vo-amrwbenc-0.1.2-r1[${MULTILIB_USEDEP}] ) |
192 |
kvazaar? ( >=media-libs/kvazaar-1.2.0[${MULTILIB_USEDEP}] ) |
193 |
mp3? ( >=media-sound/lame-3.99.5-r1[${MULTILIB_USEDEP}] ) |
194 |
openh264? ( >=media-libs/openh264-1.4.0-r1:=[${MULTILIB_USEDEP}] ) |
195 |
rav1e? ( >=media-video/rav1e-0.4:=[capi] ) |
196 |
snappy? ( >=app-arch/snappy-1.1.2-r1:=[${MULTILIB_USEDEP}] ) |
197 |
theora? ( |
198 |
>=media-libs/libogg-1.3.0[${MULTILIB_USEDEP}] |
199 |
>=media-libs/libtheora-1.1.1[encode,${MULTILIB_USEDEP}] |
200 |
) |
201 |
twolame? ( >=media-sound/twolame-0.3.13-r1[${MULTILIB_USEDEP}] ) |
202 |
webp? ( >=media-libs/libwebp-0.3.0:=[${MULTILIB_USEDEP}] ) |
203 |
x264? ( >=media-libs/x264-0.0.20130506:=[${MULTILIB_USEDEP}] ) |
204 |
x265? ( >=media-libs/x265-1.6:=[${MULTILIB_USEDEP}] ) |
205 |
xvid? ( >=media-libs/xvid-1.3.2-r1[${MULTILIB_USEDEP}] ) |
206 |
) |
207 |
fdk? ( >=media-libs/fdk-aac-0.1.3:=[${MULTILIB_USEDEP}] ) |
208 |
flite? ( >=app-accessibility/flite-1.4-r4[${MULTILIB_USEDEP}] ) |
209 |
fontconfig? ( >=media-libs/fontconfig-2.10.92[${MULTILIB_USEDEP}] ) |
210 |
frei0r? ( media-plugins/frei0r-plugins[${MULTILIB_USEDEP}] ) |
211 |
fribidi? ( >=dev-libs/fribidi-0.19.6[${MULTILIB_USEDEP}] ) |
212 |
gcrypt? ( >=dev-libs/libgcrypt-1.6:0=[${MULTILIB_USEDEP}] ) |
213 |
gme? ( >=media-libs/game-music-emu-0.6.0[${MULTILIB_USEDEP}] ) |
214 |
gmp? ( >=dev-libs/gmp-6:0=[${MULTILIB_USEDEP}] ) |
215 |
gsm? ( >=media-sound/gsm-1.0.13-r1[${MULTILIB_USEDEP}] ) |
216 |
iconv? ( >=virtual/libiconv-0-r1[${MULTILIB_USEDEP}] ) |
217 |
iec61883? ( |
218 |
>=media-libs/libiec61883-1.2.0-r1[${MULTILIB_USEDEP}] |
219 |
>=sys-libs/libraw1394-2.1.0-r1[${MULTILIB_USEDEP}] |
220 |
>=sys-libs/libavc1394-0.5.4-r1[${MULTILIB_USEDEP}] |
221 |
) |
222 |
ieee1394? ( |
223 |
>=media-libs/libdc1394-2.2.1:2=[${MULTILIB_USEDEP}] |
224 |
>=sys-libs/libraw1394-2.1.0-r1[${MULTILIB_USEDEP}] |
225 |
) |
226 |
jack? ( virtual/jack[${MULTILIB_USEDEP}] ) |
227 |
jpeg2k? ( >=media-libs/openjpeg-2:2[${MULTILIB_USEDEP}] ) |
228 |
jpegxl? ( >=media-libs/libjxl-0.7.0[$MULTILIB_USEDEP] ) |
229 |
lcms? ( >=media-libs/lcms-2.13:2[$MULTILIB_USEDEP] ) |
230 |
libaom? ( >=media-libs/libaom-1.0.0-r1:=[${MULTILIB_USEDEP}] ) |
231 |
libaribb24? ( >=media-libs/aribb24-1.0.3-r2[${MULTILIB_USEDEP}] ) |
232 |
libass? ( >=media-libs/libass-0.11.0:=[${MULTILIB_USEDEP}] ) |
233 |
libcaca? ( >=media-libs/libcaca-0.99_beta18-r1[${MULTILIB_USEDEP}] ) |
234 |
libdrm? ( x11-libs/libdrm[${MULTILIB_USEDEP}] ) |
235 |
libilbc? ( >=media-libs/libilbc-2[${MULTILIB_USEDEP}] ) |
236 |
libplacebo? ( >=media-libs/libplacebo-4.192.0[$MULTILIB_USEDEP] ) |
237 |
librtmp? ( >=media-video/rtmpdump-2.4_p20131018[${MULTILIB_USEDEP}] ) |
238 |
libsoxr? ( >=media-libs/soxr-0.1.0[${MULTILIB_USEDEP}] ) |
239 |
libtesseract? ( >=app-text/tesseract-4.1.0-r1[${MULTILIB_USEDEP}] ) |
240 |
libv4l? ( >=media-libs/libv4l-0.9.5[${MULTILIB_USEDEP}] ) |
241 |
libxml2? ( dev-libs/libxml2:=[${MULTILIB_USEDEP}] ) |
242 |
lv2? ( media-libs/lv2[${MULTILIB_USEDEP}] media-libs/lilv[${MULTILIB_USEDEP}] ) |
243 |
lzma? ( >=app-arch/xz-utils-5.0.5-r1[${MULTILIB_USEDEP}] ) |
244 |
mmal? ( media-libs/raspberrypi-userland ) |
245 |
modplug? ( >=media-libs/libmodplug-0.8.8.4-r1[${MULTILIB_USEDEP}] ) |
246 |
openal? ( >=media-libs/openal-1.15.1[${MULTILIB_USEDEP}] ) |
247 |
opencl? ( virtual/opencl[${MULTILIB_USEDEP}] ) |
248 |
opengl? ( >=virtual/opengl-7.0-r1[${MULTILIB_USEDEP}] ) |
249 |
opus? ( >=media-libs/opus-1.0.2-r2[${MULTILIB_USEDEP}] ) |
250 |
pulseaudio? ( >=media-sound/pulseaudio-2.1-r1[${MULTILIB_USEDEP}] ) |
251 |
rubberband? ( >=media-libs/rubberband-1.8.1-r1[${MULTILIB_USEDEP}] ) |
252 |
samba? ( >=net-fs/samba-3.6.23-r1[client,${MULTILIB_USEDEP}] ) |
253 |
sdl? ( media-libs/libsdl2[sound,video,${MULTILIB_USEDEP}] ) |
254 |
sndio? ( media-sound/sndio:=[${MULTILIB_USEDEP}] ) |
255 |
speex? ( >=media-libs/speex-1.2_rc1-r1[${MULTILIB_USEDEP}] ) |
256 |
srt? ( >=net-libs/srt-1.3.0:=[${MULTILIB_USEDEP}] ) |
257 |
ssh? ( >=net-libs/libssh-0.5.5:=[sftp,${MULTILIB_USEDEP}] ) |
258 |
svg? ( |
259 |
gnome-base/librsvg:2=[${MULTILIB_USEDEP}] |
260 |
x11-libs/cairo[${MULTILIB_USEDEP}] |
261 |
) |
262 |
nvenc? ( >=media-libs/nv-codec-headers-9.1.23.1 ) |
263 |
svt-av1? ( >=media-libs/svt-av1-0.9.0[${MULTILIB_USEDEP}] ) |
264 |
truetype? ( >=media-libs/freetype-2.5.0.1:2[${MULTILIB_USEDEP}] ) |
265 |
vaapi? ( >=x11-libs/libva-1.2.1-r1:0=[${MULTILIB_USEDEP}] ) |
266 |
vdpau? ( >=x11-libs/libvdpau-0.7[${MULTILIB_USEDEP}] ) |
267 |
vidstab? ( >=media-libs/vidstab-1.1.0[${MULTILIB_USEDEP}] ) |
268 |
vmaf? ( >=media-libs/libvmaf-2.0.0[${MULTILIB_USEDEP}] ) |
269 |
vorbis? ( |
270 |
>=media-libs/libvorbis-1.3.3-r1[${MULTILIB_USEDEP}] |
271 |
>=media-libs/libogg-1.3.0[${MULTILIB_USEDEP}] |
272 |
) |
273 |
vpx? ( >=media-libs/libvpx-1.4.0:=[${MULTILIB_USEDEP}] ) |
274 |
vulkan? ( >=media-libs/vulkan-loader-1.2.189:=[${MULTILIB_USEDEP}] ) |
275 |
X? ( |
276 |
>=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}] |
277 |
>=x11-libs/libXext-1.3.2[${MULTILIB_USEDEP}] |
278 |
>=x11-libs/libXv-1.0.10[${MULTILIB_USEDEP}] |
279 |
>=x11-libs/libxcb-1.4:=[${MULTILIB_USEDEP}] |
280 |
) |
281 |
postproc? ( !media-libs/libpostproc ) |
282 |
zeromq? ( >=net-libs/zeromq-4.1.6 ) |
283 |
zimg? ( >=media-libs/zimg-2.7.4:=[${MULTILIB_USEDEP}] ) |
284 |
zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] ) |
285 |
zvbi? ( >=media-libs/zvbi-0.2.35[${MULTILIB_USEDEP}] ) |
286 |
" |
287 |
|
288 |
RDEPEND="${RDEPEND} |
289 |
openssl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] ) |
290 |
!openssl? ( gnutls? ( >=net-libs/gnutls-2.12.23-r6:=[${MULTILIB_USEDEP}] ) ) |
291 |
" |
292 |
|
293 |
DEPEND="${RDEPEND} |
294 |
amf? ( media-libs/amf-headers ) |
295 |
ladspa? ( >=media-libs/ladspa-sdk-1.13-r2[${MULTILIB_USEDEP}] ) |
296 |
v4l? ( sys-kernel/linux-headers ) |
297 |
" |
298 |
|
299 |
# += for verify-sig above |
300 |
BDEPEND+=" |
301 |
>=sys-devel/make-3.81 |
302 |
virtual/pkgconfig |
303 |
cpu_flags_x86_mmx? ( || ( >=dev-lang/nasm-2.13 >=dev-lang/yasm-1.3 ) ) |
304 |
cuda? ( >=sys-devel/clang-7[llvm_targets_NVPTX] ) |
305 |
doc? ( sys-apps/texinfo ) |
306 |
test? ( net-misc/wget sys-devel/bc ) |
307 |
" |
308 |
|
309 |
# Code requiring FFmpeg to be built under gpl license |
310 |
GPL_REQUIRED_USE=" |
311 |
postproc? ( gpl ) |
312 |
frei0r? ( gpl ) |
313 |
cdio? ( gpl ) |
314 |
rubberband? ( gpl ) |
315 |
vidstab? ( gpl ) |
316 |
samba? ( gpl ) |
317 |
encode? ( |
318 |
x264? ( gpl ) |
319 |
x265? ( gpl ) |
320 |
xvid? ( gpl ) |
321 |
) |
322 |
" |
323 |
REQUIRED_USE=" |
324 |
cuda? ( nvenc ) |
325 |
libv4l? ( v4l ) |
326 |
fftools_cws2fws? ( zlib ) |
327 |
test? ( encode ) |
328 |
${GPL_REQUIRED_USE} |
329 |
${CPU_REQUIRED_USE}" |
330 |
RESTRICT=" |
331 |
!test? ( test ) |
332 |
gpl? ( openssl? ( bindist ) fdk? ( bindist ) ) |
333 |
" |
334 |
|
335 |
S=${WORKDIR}/${P/_/-} |
336 |
|
337 |
PATCHES=( |
338 |
"${FILESDIR}"/chromium-r1.patch |
339 |
) |
340 |
|
341 |
MULTILIB_WRAPPED_HEADERS=( |
342 |
/usr/include/libavutil/avconfig.h |
343 |
) |
344 |
|
345 |
build_separate_libffmpeg() { |
346 |
use opencl |
347 |
} |
348 |
|
349 |
pkg_setup() { |
350 |
# ffmpeg[chromaprint] depends on chromaprint, and chromaprint[tools] depends on ffmpeg. |
351 |
# May cause breakage while updating, #862996, #625210, #833821. |
352 |
if has_version media-libs/chromaprint[tools] && use chromaprint; then |
353 |
ewarn "You have media-libs/chromaprint installed with 'tools' USE flag, which " |
354 |
ewarn "links to ffmpeg, and you have enabled 'chromaprint' USE flag for ffmpeg, " |
355 |
ewarn "which links to chromaprint. This may cause issues while rebuilding ffmpeg." |
356 |
ewarn "" |
357 |
ewarn "If your build fails to 'ERROR: chromaprint not found', rebuild chromaprint " |
358 |
ewarn "without the 'tools' use flag first, then rebuild ffmpeg, and then finally enable " |
359 |
ewarn "'tools' USE flag for chromaprint. See #862996." |
360 |
fi |
361 |
} |
362 |
|
363 |
src_prepare() { |
364 |
if [[ "${PV%_p*}" != "${PV}" ]] ; then # Snapshot |
365 |
export revision=git-N-${FFMPEG_REVISION} |
366 |
fi |
367 |
|
368 |
default |
369 |
|
370 |
# -fdiagnostics-color=auto gets appended after user flags which |
371 |
# will ignore user's preference. |
372 |
sed -i -e '/check_cflags -fdiagnostics-color=auto/d' configure || die |
373 |
|
374 |
echo 'include $(SRC_PATH)/ffbuild/libffmpeg.mak' >> Makefile || die |
375 |
} |
376 |
|
377 |
multilib_src_configure() { |
378 |
local myconf=( ) |
379 |
|
380 |
# bug 842201 |
381 |
use ia64 && tc-is-gcc && append-flags \ |
382 |
-fno-tree-ccp \ |
383 |
-fno-tree-dominator-opts \ |
384 |
-fno-tree-fre \ |
385 |
-fno-code-hoisting \ |
386 |
-fno-tree-pre \ |
387 |
-fno-tree-vrp |
388 |
|
389 |
local ffuse=( "${FFMPEG_FLAG_MAP[@]}" ) |
390 |
use openssl && myconf+=( --enable-nonfree ) |
391 |
use samba && myconf+=( --enable-version3 ) |
392 |
|
393 |
# Encoders |
394 |
if use encode ; then |
395 |
ffuse+=( "${FFMPEG_ENCODER_FLAG_MAP[@]}" ) |
396 |
|
397 |
# Licensing. |
398 |
if use amrenc ; then |
399 |
myconf+=( --enable-version3 ) |
400 |
fi |
401 |
else |
402 |
myconf+=( --disable-encoders ) |
403 |
fi |
404 |
|
405 |
# Indevs |
406 |
use v4l || myconf+=( --disable-indev=v4l2 --disable-outdev=v4l2 ) |
407 |
for i in alsa oss jack sndio ; do |
408 |
use ${i} || myconf+=( --disable-indev=${i} ) |
409 |
done |
410 |
|
411 |
# Outdevs |
412 |
for i in alsa oss sndio ; do |
413 |
use ${i} || myconf+=( --disable-outdev=${i} ) |
414 |
done |
415 |
|
416 |
# Decoders |
417 |
use amr && myconf+=( --enable-version3 ) |
418 |
use gmp && myconf+=( --enable-version3 ) |
419 |
use libaribb24 && myconf+=( --enable-version3 ) |
420 |
use fdk && use gpl && myconf+=( --enable-nonfree ) |
421 |
|
422 |
for i in "${ffuse[@]#+}" ; do |
423 |
myconf+=( $(use_enable ${i%:*} ${i#*:}) ) |
424 |
done |
425 |
|
426 |
if use openssl ; then |
427 |
myconf+=( --disable-gnutls ) |
428 |
has_version dev-libs/openssl:0/3 && myconf+=( --enable-version3 ) |
429 |
fi |
430 |
|
431 |
# (temporarily) disable non-multilib deps |
432 |
if ! multilib_is_native_abi; then |
433 |
for i in librav1e libzmq ; do |
434 |
myconf+=( --disable-${i} ) |
435 |
done |
436 |
fi |
437 |
|
438 |
# CPU features |
439 |
for i in "${CPU_FEATURES_MAP[@]}" ; do |
440 |
use ${i%:*} || myconf+=( --disable-${i#*:} ) |
441 |
done |
442 |
|
443 |
if use pic ; then |
444 |
myconf+=( --enable-pic ) |
445 |
# disable asm code if PIC is required |
446 |
# as the provided asm decidedly is not PIC for x86. |
447 |
[[ ${ABI} == x86 ]] && myconf+=( --disable-asm ) |
448 |
fi |
449 |
[[ ${ABI} == x32 ]] && myconf+=( --disable-asm ) #427004 |
450 |
|
451 |
# Try to get cpu type based on CFLAGS. |
452 |
# Bug #172723 |
453 |
# We need to do this so that features of that CPU will be better used |
454 |
# If they contain an unknown CPU it will not hurt since ffmpeg's configure |
455 |
# will just ignore it. |
456 |
for i in $(get-flag mcpu) $(get-flag march) ; do |
457 |
[[ ${i} = native ]] && i="host" # bug #273421 |
458 |
myconf+=( --cpu=${i} ) |
459 |
break |
460 |
done |
461 |
|
462 |
# LTO support, bug #566282, bug #754654, bug #772854 |
463 |
[[ ${ABI} != x86 ]] && is-flagq "-flto*" && myconf+=( "--enable-lto" ) |
464 |
filter-lto |
465 |
|
466 |
# Mandatory configuration |
467 |
myconf=( |
468 |
--enable-avfilter |
469 |
--disable-stripping |
470 |
# This is only for hardcoded cflags; those are used in configure checks that may |
471 |
# interfere with proper detections, bug #671746 and bug #645778 |
472 |
# We use optflags, so that overrides them anyway. |
473 |
--disable-optimizations |
474 |
--disable-libcelt # bug #664158 |
475 |
"${myconf[@]}" |
476 |
) |
477 |
|
478 |
# cross compile support |
479 |
if tc-is-cross-compiler ; then |
480 |
myconf+=( --enable-cross-compile --arch=$(tc-arch-kernel) --cross-prefix=${CHOST}- --host-cc="$(tc-getBUILD_CC)" ) |
481 |
case ${CHOST} in |
482 |
*freebsd*) |
483 |
myconf+=( --target-os=freebsd ) |
484 |
;; |
485 |
*mingw32*) |
486 |
myconf+=( --target-os=mingw32 ) |
487 |
;; |
488 |
*linux*) |
489 |
myconf+=( --target-os=linux ) |
490 |
;; |
491 |
esac |
492 |
fi |
493 |
|
494 |
# doc |
495 |
myconf+=( |
496 |
$(multilib_native_use_enable doc) |
497 |
$(multilib_native_use_enable doc htmlpages) |
498 |
$(multilib_native_enable manpages) |
499 |
) |
500 |
|
501 |
# Fixed in 5.0.1? Waiting for verification from someone who hit the issue. |
502 |
local extra_libs |
503 |
if use arm || use ppc || use mips || [[ ${CHOST} == *i486* ]] ; then |
504 |
# bug #782811 |
505 |
# bug #790590 |
506 |
extra_libs+="$(test-flags-CCLD -latomic) " |
507 |
fi |
508 |
|
509 |
set -- "${S}/configure" \ |
510 |
--prefix="${EPREFIX}/usr" \ |
511 |
--libdir="${EPREFIX}/usr/$(get_libdir)" \ |
512 |
--shlibdir="${EPREFIX}/usr/$(get_libdir)" \ |
513 |
--docdir="${EPREFIX}/usr/share/doc/${PF}/html" \ |
514 |
--mandir="${EPREFIX}/usr/share/man" \ |
515 |
--enable-shared \ |
516 |
--cc="$(tc-getCC)" \ |
517 |
--cxx="$(tc-getCXX)" \ |
518 |
--ar="$(tc-getAR)" \ |
519 |
--nm="$(tc-getNM)" \ |
520 |
--strip="$(tc-getSTRIP)" \ |
521 |
--ranlib="$(tc-getRANLIB)" \ |
522 |
--pkg-config="$(tc-getPKG_CONFIG)" \ |
523 |
--optflags="${CFLAGS}" \ |
524 |
--extra-libs="${extra_libs}" \ |
525 |
$(use_enable static-libs static) \ |
526 |
"${myconf[@]}" \ |
527 |
${EXTRA_FFMPEG_CONF} |
528 |
echo "${@}" |
529 |
"${@}" || die |
530 |
|
531 |
if multilib_is_native_abi && use chromium && build_separate_libffmpeg; then |
532 |
einfo "Configuring for Chromium" |
533 |
mkdir -p ../chromium || die |
534 |
pushd ../chromium >/dev/null || die |
535 |
set -- "${@}" \ |
536 |
--disable-shared \ |
537 |
--enable-static \ |
538 |
--enable-pic \ |
539 |
--disable-opencl |
540 |
echo "${@}" |
541 |
"${@}" || die |
542 |
popd >/dev/null || die |
543 |
fi |
544 |
} |
545 |
|
546 |
multilib_src_compile() { |
547 |
emake V=1 |
548 |
|
549 |
if multilib_is_native_abi; then |
550 |
for i in "${FFTOOLS[@]}" ; do |
551 |
if use fftools_${i} ; then |
552 |
emake V=1 tools/${i}$(get_exeext) |
553 |
fi |
554 |
done |
555 |
|
556 |
if use chromium; then |
557 |
if build_separate_libffmpeg; then |
558 |
einfo "Compiling for Chromium" |
559 |
pushd ../chromium >/dev/null || die |
560 |
emake V=1 libffmpeg |
561 |
popd >/dev/null || die |
562 |
else |
563 |
emake V=1 libffmpeg |
564 |
fi |
565 |
fi |
566 |
fi |
567 |
} |
568 |
|
569 |
multilib_src_test() { |
570 |
LD_LIBRARY_PATH="${BUILD_DIR}/libpostproc:${BUILD_DIR}/libswscale:${BUILD_DIR}/libswresample:${BUILD_DIR}/libavcodec:${BUILD_DIR}/libavdevice:${BUILD_DIR}/libavfilter:${BUILD_DIR}/libavformat:${BUILD_DIR}/libavutil" \ |
571 |
emake V=1 fate |
572 |
} |
573 |
|
574 |
multilib_src_install() { |
575 |
emake V=1 DESTDIR="${D}" install install-doc |
576 |
|
577 |
if multilib_is_native_abi; then |
578 |
for i in "${FFTOOLS[@]}" ; do |
579 |
if use fftools_${i} ; then |
580 |
dobin tools/${i}$(get_exeext) |
581 |
fi |
582 |
done |
583 |
|
584 |
if use chromium; then |
585 |
if build_separate_libffmpeg; then |
586 |
einfo "Installing for Chromium" |
587 |
pushd ../chromium >/dev/null || die |
588 |
emake V=1 DESTDIR="${D}" install-libffmpeg |
589 |
popd >/dev/null || die |
590 |
else |
591 |
emake V=1 DESTDIR="${D}" install-libffmpeg |
592 |
|
593 |
# When not built separately, libffmpeg has no code of |
594 |
# its own so this QA check raises a false positive. |
595 |
QA_FLAGS_IGNORED+=" usr/$(get_libdir)/chromium/.*" |
596 |
fi |
597 |
fi |
598 |
fi |
599 |
} |
600 |
|
601 |
multilib_src_install_all() { |
602 |
dodoc Changelog README.md CREDITS doc/*.txt doc/APIchanges |
603 |
[ -f "RELEASE_NOTES" ] && dodoc "RELEASE_NOTES" |
604 |
|
605 |
use amf && doenvd "${FILESDIR}"/amf-env-vulkan-override |
606 |
} |