media-video/ffmpeg: When using samba, require the client use flag
[gentoo.git] / media-video / ffmpeg / ffmpeg-4.1.ebuild
1 # Copyright 1999-2018 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
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=56.58.58
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 eutils flag-o-matic multilib multilib-minimal toolchain-funcs ${SCM}
25
26 DESCRIPTION="Complete solution to record, convert and 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.bz2"
32 else # Release
33         SRC_URI="https://ffmpeg.org/releases/${P/_/-}.tar.bz2"
34 fi
35 FFMPEG_REVISION="${PV#*_p}"
36
37 SLOT="0/${FFMPEG_SUBSLOT}"
38 LICENSE="
39         !gpl? ( LGPL-2.1 )
40         gpl? ( GPL-2 )
41         amr? (
42                 gpl? ( GPL-3 )
43                 !gpl? ( LGPL-3 )
44         )
45         gmp? (
46                 gpl? ( GPL-3 )
47                 !gpl? ( LGPL-3 )
48         )
49         encode? (
50                 amrenc? (
51                         gpl? ( GPL-3 )
52                         !gpl? ( LGPL-3 )
53                 )
54         )
55         samba? ( GPL-3 )
56 "
57 if [ "${PV#9999}" = "${PV}" ] ; then
58         KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
59 fi
60
61 # Options to use as use_enable in the foo[:bar] form.
62 # This will feed configure with $(use_enable foo bar)
63 # or $(use_enable foo foo) if no :bar is set.
64 # foo is added to IUSE.
65 FFMPEG_FLAG_MAP=(
66                 +bzip2:bzlib cpudetection:runtime-cpudetect debug gcrypt gnutls gmp
67                 +gpl +hardcoded-tables +iconv libressl:libtls lzma +network opencl
68                 openssl +postproc samba:libsmbclient sdl:ffplay sdl:sdl2 vaapi vdpau
69                 X:xlib xcb:libxcb xcb:libxcb-shm xcb:libxcb-xfixes +zlib
70                 # libavdevice options
71                 cdio:libcdio iec61883:libiec61883 ieee1394:libdc1394 libcaca openal
72                 opengl
73                 # indevs
74                 libv4l:libv4l2 pulseaudio:libpulse libdrm jack:libjack
75                 # decoders
76                 amr:libopencore-amrwb amr:libopencore-amrnb codec2:libcodec2 fdk:libfdk-aac
77                 jpeg2k:libopenjpeg bluray:libbluray gme:libgme gsm:libgsm
78                 mmal modplug:libmodplug opus:libopus libilbc librtmp ssh:libssh
79                 speex:libspeex srt:libsrt svg:librsvg video_cards_nvidia:ffnvcodec
80                 vorbis:libvorbis vpx:libvpx zvbi:libzvbi
81                 # libavfilter options
82                 appkit
83                 bs2b:libbs2b chromaprint flite:libflite frei0r
84                 fribidi:libfribidi fontconfig ladspa libass lv2 truetype:libfreetype
85                 rubberband:librubberband zeromq:libzmq zimg:libzimg
86                 # libswresample options
87                 libsoxr
88                 # Threads; we only support pthread for now but ffmpeg supports more
89                 +threads:pthreads
90 )
91
92 # Same as above but for encoders, i.e. they do something only with USE=encode.
93 FFMPEG_ENCODER_FLAG_MAP=(
94         amrenc:libvo-amrwbenc mp3:libmp3lame
95         kvazaar:libkvazaar libaom
96         openh264:libopenh264 snappy:libsnappy theora:libtheora twolame:libtwolame
97         wavpack:libwavpack webp:libwebp x264:libx264 x265:libx265 xvid:libxvid
98 )
99
100 IUSE="
101         alsa chromium doc +encode oss pic static-libs test v4l
102         ${FFMPEG_FLAG_MAP[@]%:*}
103         ${FFMPEG_ENCODER_FLAG_MAP[@]%:*}
104 "
105
106 # Strings for CPU features in the useflag[:configure_option] form
107 # if :configure_option isn't set, it will use 'useflag' as configure option
108 ARM_CPU_FEATURES=(
109         cpu_flags_arm_thumb:armv5te
110         cpu_flags_arm_v6:armv6
111         cpu_flags_arm_thumb2:armv6t2
112         cpu_flags_arm_neon:neon
113         cpu_flags_arm_vfp:vfp
114         cpu_flags_arm_vfpv3:vfpv3
115         cpu_flags_arm_v8:armv8
116 )
117 ARM_CPU_REQUIRED_USE="
118         arm64? ( cpu_flags_arm_v8 )
119         cpu_flags_arm_v8? (  cpu_flags_arm_vfpv3 cpu_flags_arm_neon )
120         cpu_flags_arm_neon? ( cpu_flags_arm_thumb2 cpu_flags_arm_vfp )
121         cpu_flags_arm_vfpv3? ( cpu_flags_arm_vfp )
122         cpu_flags_arm_thumb2? ( cpu_flags_arm_v6 )
123         cpu_flags_arm_v6? ( cpu_flags_arm_thumb )
124 "
125 MIPS_CPU_FEATURES=( mipsdspr1:mipsdsp mipsdspr2 mipsfpu )
126 PPC_CPU_FEATURES=( altivec )
127 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 )
128 X86_CPU_FEATURES=( ${X86_CPU_FEATURES_RAW[@]/#/cpu_flags_x86_} )
129 X86_CPU_REQUIRED_USE="
130         cpu_flags_x86_avx2? ( cpu_flags_x86_avx )
131         cpu_flags_x86_fma4? ( cpu_flags_x86_avx )
132         cpu_flags_x86_fma3? ( cpu_flags_x86_avx )
133         cpu_flags_x86_xop?  ( cpu_flags_x86_avx )
134         cpu_flags_x86_avx?  ( cpu_flags_x86_sse4_2 )
135         cpu_flags_x86_aes? ( cpu_flags_x86_sse4_2 )
136         cpu_flags_x86_sse4_2?  ( cpu_flags_x86_sse4_1 )
137         cpu_flags_x86_sse4_1?  ( cpu_flags_x86_ssse3 )
138         cpu_flags_x86_ssse3?  ( cpu_flags_x86_sse3 )
139         cpu_flags_x86_sse3?  ( cpu_flags_x86_sse2 )
140         cpu_flags_x86_sse2?  ( cpu_flags_x86_sse )
141         cpu_flags_x86_sse?  ( cpu_flags_x86_mmxext )
142         cpu_flags_x86_mmxext?  ( cpu_flags_x86_mmx )
143         cpu_flags_x86_3dnowext?  ( cpu_flags_x86_3dnow )
144         cpu_flags_x86_3dnow?  ( cpu_flags_x86_mmx )
145 "
146
147 CPU_FEATURES_MAP=(
148         ${ARM_CPU_FEATURES[@]}
149         ${MIPS_CPU_FEATURES[@]}
150         ${PPC_CPU_FEATURES[@]}
151         ${X86_CPU_FEATURES[@]}
152 )
153 IUSE="${IUSE}
154         ${CPU_FEATURES_MAP[@]%:*}"
155
156 CPU_REQUIRED_USE="
157         ${ARM_CPU_REQUIRED_USE}
158         ${X86_CPU_REQUIRED_USE}
159 "
160
161 FFTOOLS=( aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart sidxindex trasher )
162 IUSE="${IUSE} ${FFTOOLS[@]/#/+fftools_}"
163
164 RDEPEND="
165         alsa? ( >=media-libs/alsa-lib-1.0.27.2[${MULTILIB_USEDEP}] )
166         amr? ( >=media-libs/opencore-amr-0.1.3-r1[${MULTILIB_USEDEP}] )
167         bluray? ( >=media-libs/libbluray-0.3.0-r1:=[${MULTILIB_USEDEP}] )
168         bs2b? ( >=media-libs/libbs2b-3.1.0-r1[${MULTILIB_USEDEP}] )
169         bzip2? ( >=app-arch/bzip2-1.0.6-r4[${MULTILIB_USEDEP}] )
170         cdio? ( >=dev-libs/libcdio-paranoia-0.90_p1-r1[${MULTILIB_USEDEP}] )
171         chromaprint? ( >=media-libs/chromaprint-1.2-r1[${MULTILIB_USEDEP}] )
172         codec2? ( media-libs/codec2[${MULTILIB_USEDEP}] )
173         encode? (
174                 amrenc? ( >=media-libs/vo-amrwbenc-0.1.2-r1[${MULTILIB_USEDEP}] )
175                 kvazaar? ( media-libs/kvazaar[${MULTILIB_USEDEP}] )
176                 mp3? ( >=media-sound/lame-3.99.5-r1[${MULTILIB_USEDEP}] )
177                 openh264? ( >=media-libs/openh264-1.4.0-r1[${MULTILIB_USEDEP}] )
178                 snappy? ( >=app-arch/snappy-1.1.2-r1:=[${MULTILIB_USEDEP}] )
179                 theora? (
180                         >=media-libs/libtheora-1.1.1[encode,${MULTILIB_USEDEP}]
181                         >=media-libs/libogg-1.3.0[${MULTILIB_USEDEP}]
182                 )
183                 twolame? ( >=media-sound/twolame-0.3.13-r1[${MULTILIB_USEDEP}] )
184                 wavpack? ( >=media-sound/wavpack-4.60.1-r1[${MULTILIB_USEDEP}] )
185                 webp? ( >=media-libs/libwebp-0.3.0:=[${MULTILIB_USEDEP}] )
186                 x264? ( >=media-libs/x264-0.0.20130506:=[${MULTILIB_USEDEP}] )
187                 x265? ( >=media-libs/x265-1.6:=[${MULTILIB_USEDEP}] )
188                 xvid? ( >=media-libs/xvid-1.3.2-r1[${MULTILIB_USEDEP}] )
189         )
190         fdk? ( >=media-libs/fdk-aac-0.1.3:=[${MULTILIB_USEDEP}] )
191         flite? ( >=app-accessibility/flite-1.4-r4[${MULTILIB_USEDEP}] )
192         fontconfig? ( >=media-libs/fontconfig-2.10.92[${MULTILIB_USEDEP}] )
193         frei0r? ( media-plugins/frei0r-plugins )
194         fribidi? ( >=dev-libs/fribidi-0.19.6[${MULTILIB_USEDEP}] )
195         gcrypt? ( >=dev-libs/libgcrypt-1.6:0=[${MULTILIB_USEDEP}] )
196         gme? ( >=media-libs/game-music-emu-0.6.0[${MULTILIB_USEDEP}] )
197         gmp? ( >=dev-libs/gmp-6:0=[${MULTILIB_USEDEP}] )
198         gsm? ( >=media-sound/gsm-1.0.13-r1[${MULTILIB_USEDEP}] )
199         iconv? ( >=virtual/libiconv-0-r1[${MULTILIB_USEDEP}] )
200         iec61883? (
201                 >=media-libs/libiec61883-1.2.0-r1[${MULTILIB_USEDEP}]
202                 >=sys-libs/libraw1394-2.1.0-r1[${MULTILIB_USEDEP}]
203                 >=sys-libs/libavc1394-0.5.4-r1[${MULTILIB_USEDEP}]
204         )
205         ieee1394? (
206                 >=media-libs/libdc1394-2.2.1[${MULTILIB_USEDEP}]
207                 >=sys-libs/libraw1394-2.1.0-r1[${MULTILIB_USEDEP}]
208         )
209         jack? ( virtual/jack[${MULTILIB_USEDEP}] )
210         jpeg2k? ( >=media-libs/openjpeg-2:2[${MULTILIB_USEDEP}] )
211         libaom? ( media-libs/libaom[${MULTILIB_USEDEP}] )
212         libass? ( >=media-libs/libass-0.10.2:=[${MULTILIB_USEDEP}] )
213         libcaca? ( >=media-libs/libcaca-0.99_beta18-r1[${MULTILIB_USEDEP}] )
214         libdrm? ( x11-libs/libdrm[${MULTILIB_USEDEP}] )
215         libilbc? ( >=media-libs/libilbc-2[${MULTILIB_USEDEP}] )
216         libsoxr? ( >=media-libs/soxr-0.1.0[${MULTILIB_USEDEP}] )
217         libv4l? ( >=media-libs/libv4l-0.9.5[${MULTILIB_USEDEP}] )
218         lv2? ( media-libs/lv2[${MULTILIB_USEDEP}] media-libs/lilv[${MULTILIB_USEDEP}] )
219         lzma? ( >=app-arch/xz-utils-5.0.5-r1[${MULTILIB_USEDEP}] )
220         mmal? ( media-libs/raspberrypi-userland )
221         modplug? ( >=media-libs/libmodplug-0.8.8.4-r1[${MULTILIB_USEDEP}] )
222         openal? ( >=media-libs/openal-1.15.1[${MULTILIB_USEDEP}] )
223         opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
224         opengl? ( >=virtual/opengl-7.0-r1[${MULTILIB_USEDEP}] )
225         opus? ( >=media-libs/opus-1.0.2-r2[${MULTILIB_USEDEP}] )
226         pulseaudio? ( >=media-sound/pulseaudio-2.1-r1[${MULTILIB_USEDEP}] )
227         librtmp? ( >=media-video/rtmpdump-2.4_p20131018[${MULTILIB_USEDEP}] )
228         rubberband? ( >=media-libs/rubberband-1.8.1-r1[${MULTILIB_USEDEP}] )
229         samba? ( >=net-fs/samba-3.6.23-r1[client,${MULTILIB_USEDEP}] )
230         sdl? ( media-libs/libsdl2[sound,video,${MULTILIB_USEDEP}] )
231         speex? ( >=media-libs/speex-1.2_rc1-r1[${MULTILIB_USEDEP}] )
232         srt? ( net-libs/srt[${MULTILIB_USEDEP}] )
233         ssh? ( >=net-libs/libssh-0.5.5[${MULTILIB_USEDEP}] )
234         svg? ( gnome-base/librsvg:2=[${MULTILIB_USEDEP}] )
235         truetype? ( >=media-libs/freetype-2.5.0.1:2[${MULTILIB_USEDEP}] )
236         vaapi? ( >=x11-libs/libva-1.2.1-r1[${MULTILIB_USEDEP}] )
237         video_cards_nvidia? ( >=media-libs/nv-codec-headers-8.1.24.2[${MULTILIB_USEDEP}] )
238         vdpau? ( >=x11-libs/libvdpau-0.7[${MULTILIB_USEDEP}] )
239         vorbis? (
240                 >=media-libs/libvorbis-1.3.3-r1[${MULTILIB_USEDEP}]
241                 >=media-libs/libogg-1.3.0[${MULTILIB_USEDEP}]
242         )
243         vpx? ( >=media-libs/libvpx-1.4.0:=[${MULTILIB_USEDEP}] )
244         X? (
245                 >=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}]
246                 >=x11-libs/libXext-1.3.2[${MULTILIB_USEDEP}]
247                 >=x11-libs/libXv-1.0.10[${MULTILIB_USEDEP}]
248         )
249         xcb? ( >=x11-libs/libxcb-1.4[${MULTILIB_USEDEP}] )
250         zeromq? ( >=net-libs/zeromq-4.1.6 )
251         zimg? ( >=media-libs/zimg-2.7.4:=[${MULTILIB_USEDEP}] )
252         zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
253         zvbi? ( >=media-libs/zvbi-0.2.35[${MULTILIB_USEDEP}] )
254         !media-video/qt-faststart
255         postproc? ( !media-libs/libpostproc )
256 "
257
258 # Crypto & co provider magic
259 # - libressl is a useflag meaning it should always favor libressl over openssl
260 # - libressl and openssl provide more features to ffmpeg than gnutls
261 #
262 # The ordering is thus: libressl > openssl > gnutls
263 RDEPEND="${RDEPEND}
264         libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP}] )
265         !libressl? (
266                 openssl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
267                 !openssl? ( gnutls? ( >=net-libs/gnutls-2.12.23-r6:=[${MULTILIB_USEDEP}] ) )
268         )
269 "
270
271 DEPEND="${RDEPEND}
272         >=sys-devel/make-3.81
273         doc? ( sys-apps/texinfo )
274         >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]
275         ladspa? ( >=media-libs/ladspa-sdk-1.13-r2[${MULTILIB_USEDEP}] )
276         cpu_flags_x86_mmx? ( || ( >=dev-lang/nasm-2.13 >=dev-lang/yasm-1.3 ) )
277         test? ( net-misc/wget sys-devel/bc )
278         v4l? ( sys-kernel/linux-headers )
279 "
280
281 # Code requiring FFmpeg to be built under gpl license
282 GPL_REQUIRED_USE="
283         postproc? ( gpl )
284         frei0r? ( gpl )
285         cdio? ( gpl )
286         samba? ( gpl )
287         encode? (
288                 x264? ( gpl )
289                 x265? ( gpl )
290                 xvid? ( gpl )
291                 X? ( !xcb? ( gpl ) )
292         )
293 "
294 REQUIRED_USE="
295         libv4l? ( v4l )
296         fftools_cws2fws? ( zlib )
297         test? ( encode )
298         ${GPL_REQUIRED_USE}
299         ${CPU_REQUIRED_USE}"
300 RESTRICT="
301         gpl? ( openssl? ( bindist ) fdk? ( bindist ) libressl? ( bindist ) )
302 "
303
304 S=${WORKDIR}/${P/_/-}
305
306 PATCHES=(
307         "${FILESDIR}"/chromium-r1.patch
308         "${FILESDIR}/${P}-vaapi-tools.patch"
309 )
310
311 MULTILIB_WRAPPED_HEADERS=(
312         /usr/include/libavutil/avconfig.h
313 )
314
315 src_prepare() {
316         if [[ "${PV%_p*}" != "${PV}" ]] ; then # Snapshot
317                 export revision=git-N-${FFMPEG_REVISION}
318         fi
319         default
320         echo 'include $(SRC_PATH)/ffbuild/libffmpeg.mak' >> Makefile || die
321 }
322
323 multilib_src_configure() {
324         local myconf=( ${EXTRA_FFMPEG_CONF} )
325
326         local ffuse=( "${FFMPEG_FLAG_MAP[@]}" )
327         use openssl || use libressl && use gpl && myconf+=( --enable-nonfree )
328         use samba && myconf+=( --enable-version3 )
329
330         # Encoders
331         if use encode ; then
332                 ffuse+=( "${FFMPEG_ENCODER_FLAG_MAP[@]}" )
333
334                 # Licensing.
335                 if use amrenc ; then
336                         myconf+=( --enable-version3 )
337                 fi
338         else
339                 myconf+=( --disable-encoders )
340         fi
341
342         # Indevs
343         use v4l || myconf+=( --disable-indev=v4l2 --disable-outdev=v4l2 )
344         for i in alsa oss jack ; do
345                 use ${i} || myconf+=( --disable-indev=${i} )
346         done
347
348         # Outdevs
349         for i in alsa oss sdl ; do
350                 use ${i} || myconf+=( --disable-outdev=${i} )
351         done
352
353         # Decoders
354         use amr && myconf+=( --enable-version3 )
355         use gmp && myconf+=( --enable-version3 )
356         use fdk && use gpl && myconf+=( --enable-nonfree )
357
358         for i in "${ffuse[@]#+}" ; do
359                 myconf+=( $(use_enable ${i%:*} ${i#*:}) )
360         done
361
362         # Incompatible features: openssl or libressl and gnutls
363         if use libressl ; then
364                 myconf+=( --disable-gnutls --disable-openssl )
365         elif use openssl ; then
366                 myconf+=( --disable-gnutls )
367         fi
368
369         # (temporarily) disable non-multilib deps
370         if ! multilib_is_native_abi; then
371                 for i in frei0r libzmq ; do
372                         myconf+=( --disable-${i} )
373                 done
374         fi
375
376         # CPU features
377         for i in "${CPU_FEATURES_MAP[@]}" ; do
378                 use ${i%:*} || myconf+=( --disable-${i#*:} )
379         done
380
381         if use pic ; then
382                 myconf+=( --enable-pic )
383                 # disable asm code if PIC is required
384                 # as the provided asm decidedly is not PIC for x86.
385                 [[ ${ABI} == x86 ]] && myconf+=( --disable-asm )
386         fi
387         [[ ${ABI} == x32 ]] && myconf+=( --disable-asm ) #427004
388
389         # Try to get cpu type based on CFLAGS.
390         # Bug #172723
391         # We need to do this so that features of that CPU will be better used
392         # If they contain an unknown CPU it will not hurt since ffmpeg's configure
393         # will just ignore it.
394         for i in $(get-flag mcpu) $(get-flag march) ; do
395                 [[ ${i} = native ]] && i="host" # bug #273421
396                 myconf+=( --cpu=${i} )
397                 break
398         done
399
400         # LTO support, bug #566282
401         is-flagq "-flto*" && myconf+=( "--enable-lto" )
402
403         # Mandatory configuration
404         myconf=(
405                 --enable-avfilter
406                 --enable-avresample
407                 --disable-stripping
408                 --disable-libcelt # bug #664158
409                 "${myconf[@]}"
410         )
411
412         # cross compile support
413         if tc-is-cross-compiler ; then
414                 myconf+=( --enable-cross-compile --arch=$(tc-arch-kernel) --cross-prefix=${CHOST}- --host-cc="$(tc-getBUILD_CC)" )
415                 case ${CHOST} in
416                         *freebsd*)
417                                 myconf+=( --target-os=freebsd )
418                                 ;;
419                         *mingw32*)
420                                 myconf+=( --target-os=mingw32 )
421                                 ;;
422                         *linux*)
423                                 myconf+=( --target-os=linux )
424                                 ;;
425                 esac
426         fi
427
428         # doc
429         myconf+=(
430                 $(multilib_native_use_enable doc)
431                 $(multilib_native_use_enable doc htmlpages)
432                 $(multilib_native_enable manpages)
433         )
434
435         set -- "${S}/configure" \
436                 --prefix="${EPREFIX}/usr" \
437                 --libdir="${EPREFIX}/usr/$(get_libdir)" \
438                 --shlibdir="${EPREFIX}/usr/$(get_libdir)" \
439                 --docdir="${EPREFIX}/usr/share/doc/${PF}/html" \
440                 --mandir="${EPREFIX}/usr/share/man" \
441                 --enable-shared \
442                 --cc="$(tc-getCC)" \
443                 --cxx="$(tc-getCXX)" \
444                 --ar="$(tc-getAR)" \
445                 --optflags="${CFLAGS}" \
446                 $(use_enable static-libs static) \
447                 "${myconf[@]}"
448         echo "${@}"
449         "${@}" || die
450
451         if multilib_is_native_abi && use chromium; then
452                 einfo "Configuring for Chromium"
453                 mkdir -p ../chromium || die
454                 pushd ../chromium >/dev/null || die
455                 set -- "${@}" \
456                         --disable-shared \
457                         --enable-static \
458                         --enable-pic \
459                         --extra-cflags="-DFF_API_CONVERGENCE_DURATION=0"
460                 echo "${@}"
461                 "${@}" || die
462                 popd >/dev/null || die
463         fi
464 }
465
466 multilib_src_compile() {
467         emake V=1
468
469         if multilib_is_native_abi; then
470                 for i in "${FFTOOLS[@]}" ; do
471                         if use fftools_${i} ; then
472                                 emake V=1 tools/${i}$(get_exeext)
473                         fi
474                 done
475
476                 if use chromium; then
477                         einfo "Compiling for Chromium"
478                         pushd ../chromium >/dev/null || die
479                         emake V=1 libffmpeg
480                         popd >/dev/null || die
481                 fi
482         fi
483 }
484
485 multilib_src_install() {
486         emake V=1 DESTDIR="${D}" install install-doc
487
488         if multilib_is_native_abi; then
489                 for i in "${FFTOOLS[@]}" ; do
490                         if use fftools_${i} ; then
491                                 dobin tools/${i}$(get_exeext)
492                         fi
493                 done
494
495                 if use chromium; then
496                         einfo "Installing for Chromium"
497                         pushd ../chromium >/dev/null || die
498                         emake V=1 DESTDIR="${D}" install-libffmpeg
499                         popd >/dev/null || die
500                 fi
501         fi
502 }
503
504 multilib_src_install_all() {
505         dodoc Changelog README.md CREDITS doc/*.txt doc/APIchanges
506         [ -f "RELEASE_NOTES" ] && dodoc "RELEASE_NOTES"
507 }
508
509 multilib_src_test() {
510         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:${BUILD_DIR}/libavresample" \
511                 emake V=1 fate
512 }