configs: atmel: at91sam9260eknf: update defconfig
[buildroot-gz.git] / package / ffmpeg / ffmpeg.mk
blobde6d8416c318e705d2571aa060db6bc55fa088d0
1 ################################################################################
3 # ffmpeg
5 ################################################################################
7 FFMPEG_VERSION = 3.2
8 FFMPEG_SOURCE = ffmpeg-$(FFMPEG_VERSION).tar.xz
9 FFMPEG_SITE = http://ffmpeg.org/releases
10 FFMPEG_INSTALL_STAGING = YES
12 FFMPEG_LICENSE = LGPLv2.1+, libjpeg license
13 FFMPEG_LICENSE_FILES = LICENSE.md COPYING.LGPLv2.1
14 ifeq ($(BR2_PACKAGE_FFMPEG_GPL),y)
15 FFMPEG_LICENSE += and GPLv2+
16 FFMPEG_LICENSE_FILES += COPYING.GPLv2
17 endif
19 FFMPEG_CONF_OPTS = \
20 --prefix=/usr \
21 --enable-avfilter \
22 --disable-version3 \
23 --enable-logging \
24 --enable-optimizations \
25 --disable-extra-warnings \
26 --enable-avdevice \
27 --enable-avcodec \
28 --enable-avformat \
29 --disable-x11grab \
30 --enable-network \
31 --disable-gray \
32 --enable-swscale-alpha \
33 --disable-small \
34 --enable-dct \
35 --enable-fft \
36 --enable-mdct \
37 --enable-rdft \
38 --disable-crystalhd \
39 --disable-dxva2 \
40 --enable-runtime-cpudetect \
41 --disable-hardcoded-tables \
42 --disable-memalign-hack \
43 --disable-mipsdsp \
44 --disable-mipsdspr2 \
45 --disable-msa \
46 --enable-hwaccels \
47 --disable-avisynth \
48 --disable-frei0r \
49 --disable-libopencore-amrnb \
50 --disable-libopencore-amrwb \
51 --disable-libcdio \
52 --disable-libdc1394 \
53 --disable-libgsm \
54 --disable-libilbc \
55 --disable-libnut \
56 --disable-libopenjpeg \
57 --disable-libschroedinger \
58 --disable-libvo-amrwbenc \
59 --disable-symver \
60 --disable-doc
62 FFMPEG_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBICONV),libiconv) host-pkgconf
64 ifeq ($(BR2_PACKAGE_FFMPEG_GPL),y)
65 FFMPEG_CONF_OPTS += --enable-gpl
66 else
67 FFMPEG_CONF_OPTS += --disable-gpl
68 endif
70 ifeq ($(BR2_PACKAGE_FFMPEG_NONFREE),y)
71 FFMPEG_CONF_OPTS += --enable-nonfree
72 else
73 FFMPEG_CONF_OPTS += --disable-nonfree
74 endif
76 ifeq ($(BR2_PACKAGE_FFMPEG_FFMPEG),y)
77 FFMPEG_CONF_OPTS += --enable-ffmpeg
78 else
79 FFMPEG_CONF_OPTS += --disable-ffmpeg
80 endif
82 ifeq ($(BR2_PACKAGE_FFMPEG_FFPLAY),y)
83 FFMPEG_DEPENDENCIES += sdl
84 FFMPEG_CONF_OPTS += --enable-ffplay
85 FFMPEG_CONF_ENV += SDL_CONFIG=$(STAGING_DIR)/usr/bin/sdl-config
86 else
87 FFMPEG_CONF_OPTS += --disable-ffplay
88 endif
90 ifeq ($(BR2_PACKAGE_FFMPEG_FFSERVER),y)
91 FFMPEG_CONF_OPTS += --enable-ffserver
92 else
93 FFMPEG_CONF_OPTS += --disable-ffserver
94 endif
96 ifeq ($(BR2_PACKAGE_FFMPEG_AVRESAMPLE),y)
97 FFMPEG_CONF_OPTS += --enable-avresample
98 else
99 FFMPEG_CONF_OPTS += --disable-avresample
100 endif
102 ifeq ($(BR2_PACKAGE_FFMPEG_FFPROBE),y)
103 FFMPEG_CONF_OPTS += --enable-ffprobe
104 else
105 FFMPEG_CONF_OPTS += --disable-ffprobe
106 endif
108 ifeq ($(BR2_PACKAGE_FFMPEG_POSTPROC),y)
109 FFMPEG_CONF_OPTS += --enable-postproc
110 else
111 FFMPEG_CONF_OPTS += --disable-postproc
112 endif
114 ifeq ($(BR2_PACKAGE_FFMPEG_SWSCALE),y)
115 FFMPEG_CONF_OPTS += --enable-swscale
116 else
117 FFMPEG_CONF_OPTS += --disable-swscale
118 endif
120 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_ENCODERS)),all)
121 FFMPEG_CONF_OPTS += --disable-encoders \
122 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_ENCODERS)),--enable-encoder=$(x))
123 endif
125 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_DECODERS)),all)
126 FFMPEG_CONF_OPTS += --disable-decoders \
127 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_DECODERS)),--enable-decoder=$(x))
128 endif
130 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_MUXERS)),all)
131 FFMPEG_CONF_OPTS += --disable-muxers \
132 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_MUXERS)),--enable-muxer=$(x))
133 endif
135 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_DEMUXERS)),all)
136 FFMPEG_CONF_OPTS += --disable-demuxers \
137 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_DEMUXERS)),--enable-demuxer=$(x))
138 endif
140 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_PARSERS)),all)
141 FFMPEG_CONF_OPTS += --disable-parsers \
142 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_PARSERS)),--enable-parser=$(x))
143 endif
145 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_BSFS)),all)
146 FFMPEG_CONF_OPTS += --disable-bsfs \
147 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_BSFS)),--enable-bsfs=$(x))
148 endif
150 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_PROTOCOLS)),all)
151 FFMPEG_CONF_OPTS += --disable-protocols \
152 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_PROTOCOLS)),--enable-protocol=$(x))
153 endif
155 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_FILTERS)),all)
156 FFMPEG_CONF_OPTS += --disable-filters \
157 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_FILTERS)),--enable-filter=$(x))
158 endif
160 ifeq ($(BR2_PACKAGE_FFMPEG_INDEVS),y)
161 FFMPEG_CONF_OPTS += --enable-indevs
162 else
163 FFMPEG_CONF_OPTS += --disable-indevs
164 endif
166 ifeq ($(BR2_PACKAGE_FFMPEG_OUTDEVS),y)
167 FFMPEG_CONF_OPTS += --enable-outdevs
168 else
169 FFMPEG_CONF_OPTS += --disable-outdevs
170 endif
172 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
173 FFMPEG_CONF_OPTS += --enable-pthreads
174 else
175 FFMPEG_CONF_OPTS += --disable-pthreads
176 endif
178 ifeq ($(BR2_PACKAGE_ZLIB),y)
179 FFMPEG_CONF_OPTS += --enable-zlib
180 FFMPEG_DEPENDENCIES += zlib
181 else
182 FFMPEG_CONF_OPTS += --disable-zlib
183 endif
185 ifeq ($(BR2_PACKAGE_BZIP2),y)
186 FFMPEG_CONF_OPTS += --enable-bzlib
187 FFMPEG_DEPENDENCIES += bzip2
188 else
189 FFMPEG_CONF_OPTS += --disable-bzlib
190 endif
192 ifeq ($(BR2_PACKAGE_FDK_AAC)$(BR2_PACKAGE_FFMPEG_NONFREE),yy)
193 FFMPEG_CONF_OPTS += --enable-libfdk-aac
194 FFMPEG_DEPENDENCIES += fdk-aac
195 else
196 FFMPEG_CONF_OPTS += --disable-libfdk-aac
197 endif
199 ifeq ($(BR2_PACKAGE_GNUTLS),y)
200 FFMPEG_CONF_OPTS += --enable-gnutls --disable-openssl
201 FFMPEG_DEPENDENCIES += gnutls
202 else
203 FFMPEG_CONF_OPTS += --disable-gnutls
204 ifeq ($(BR2_PACKAGE_OPENSSL),y)
205 # openssl isn't license compatible with GPL
206 ifeq ($(BR2_PACKAGE_FFMPEG_GPL)x$(BR2_PACKAGE_FFMPEG_NONFREE),yx)
207 FFMPEG_CONF_OPTS += --disable-openssl
208 else
209 FFMPEG_CONF_OPTS += --enable-openssl
210 FFMPEG_DEPENDENCIES += openssl
211 endif
212 else
213 FFMPEG_CONF_OPTS += --disable-openssl
214 endif
215 endif
217 ifeq ($(BR2_PACKAGE_FFMPEG_GPL)$(BR2_PACKAGE_LIBEBUR128),yy)
218 FFMPEG_DEPENDENCIES += libebur128
219 endif
221 ifeq ($(BR2_PACKAGE_LIBOPENH264),y)
222 FFMPEG_CONF_OPTS += --enable-libopenh264
223 FFMPEG_DEPENDENCIES += libopenh264
224 else
225 FFMPEG_CONF_OPTS += --disable-libopenh264
226 endif
228 ifeq ($(BR2_PACKAGE_LIBVORBIS),y)
229 FFMPEG_DEPENDENCIES += libvorbis
230 FFMPEG_CONF_OPTS += \
231 --enable-libvorbis \
232 --enable-muxer=ogg \
233 --enable-encoder=libvorbis
234 endif
236 ifeq ($(BR2_PACKAGE_LIBVA),y)
237 FFMPEG_CONF_OPTS += --enable-vaapi
238 FFMPEG_DEPENDENCIES += libva
239 else
240 FFMPEG_CONF_OPTS += --disable-vaapi
241 endif
243 ifeq ($(BR2_PACKAGE_LIBVDPAU),y)
244 FFMPEG_CONF_OPTS += --enable-vdpau
245 FFMPEG_DEPENDENCIES += libvdpau
246 else
247 FFMPEG_CONF_OPTS += --disable-vdpau
248 endif
250 # To avoid a circular dependency only use opencv if opencv itself does
251 # not depend on ffmpeg.
252 ifeq ($(BR2_PACKAGE_OPENCV_LIB_IMGPROC)x$(BR2_PACKAGE_OPENCV_WITH_FFMPEG),yx)
253 FFMPEG_CONF_OPTS += --enable-libopencv
254 FFMPEG_DEPENDENCIES += opencv
255 else ifeq ($(BR2_PACKAGE_OPENCV3_LIB_IMGPROC)x$(BR2_PACKAGE_OPENCV3_WITH_FFMPEG),yx)
256 FFMPEG_CONF_OPTS += --enable-libopencv
257 FFMPEG_DEPENDENCIES += opencv3
258 else
259 FFMPEG_CONF_OPTS += --disable-libopencv
260 endif
262 ifeq ($(BR2_PACKAGE_OPUS),y)
263 FFMPEG_CONF_OPTS += --enable-libopus
264 FFMPEG_DEPENDENCIES += opus
265 else
266 FFMPEG_CONF_OPTS += --disable-libopus
267 endif
269 ifeq ($(BR2_PACKAGE_LIBVPX),y)
270 FFMPEG_CONF_OPTS += --enable-libvpx
271 FFMPEG_DEPENDENCIES += libvpx
272 else
273 FFMPEG_CONF_OPTS += --disable-libvpx
274 endif
276 ifeq ($(BR2_PACKAGE_LIBASS),y)
277 FFMPEG_CONF_OPTS += --enable-libass
278 FFMPEG_DEPENDENCIES += libass
279 else
280 FFMPEG_CONF_OPTS += --disable-libass
281 endif
283 ifeq ($(BR2_PACKAGE_LIBBLURAY),y)
284 FFMPEG_CONF_OPTS += --enable-libbluray
285 FFMPEG_DEPENDENCIES += libbluray
286 else
287 FFMPEG_CONF_OPTS += --disable-libbluray
288 endif
290 ifeq ($(BR2_PACKAGE_RTMPDUMP),y)
291 FFMPEG_CONF_OPTS += --enable-librtmp
292 FFMPEG_DEPENDENCIES += rtmpdump
293 else
294 FFMPEG_CONF_OPTS += --disable-librtmp
295 endif
297 ifeq ($(BR2_PACKAGE_LAME),y)
298 FFMPEG_CONF_OPTS += --enable-libmp3lame
299 FFMPEG_DEPENDENCIES += lame
300 else
301 FFMPEG_CONF_OPTS += --disable-libmp3lame
302 endif
304 ifeq ($(BR2_PACKAGE_LIBMODPLUG),y)
305 FFMPEG_CONF_OPTS += --enable-libmodplug
306 FFMPEG_DEPENDENCIES += libmodplug
307 else
308 FFMPEG_CONF_OPTS += --disable-libmodplug
309 endif
311 ifeq ($(BR2_PACKAGE_SPEEX),y)
312 FFMPEG_CONF_OPTS += --enable-libspeex
313 FFMPEG_DEPENDENCIES += speex
314 else
315 FFMPEG_CONF_OPTS += --disable-libspeex
316 endif
318 ifeq ($(BR2_PACKAGE_LIBTHEORA),y)
319 FFMPEG_CONF_OPTS += --enable-libtheora
320 FFMPEG_DEPENDENCIES += libtheora
321 else
322 FFMPEG_CONF_OPTS += --disable-libtheora
323 endif
325 ifeq ($(BR2_PACKAGE_WAVPACK),y)
326 FFMPEG_CONF_OPTS += --enable-libwavpack
327 FFMPEG_DEPENDENCIES += wavpack
328 else
329 FFMPEG_CONF_OPTS += --disable-libwavpack
330 endif
332 # ffmpeg freetype support require fenv.h which is only
333 # available/working on glibc.
334 # The microblaze variant doesn't provide the needed exceptions
335 ifeq ($(BR2_PACKAGE_FREETYPE)$(BR2_TOOLCHAIN_USES_GLIBC)x$(BR2_microblaze),yyx)
336 FFMPEG_CONF_OPTS += --enable-libfreetype
337 FFMPEG_DEPENDENCIES += freetype
338 else
339 FFMPEG_CONF_OPTS += --disable-libfreetype
340 endif
342 ifeq ($(BR2_PACKAGE_FONTCONFIG),y)
343 FFMPEG_CONF_OPTS += --enable-fontconfig
344 FFMPEG_DEPENDENCIES += fontconfig
345 else
346 FFMPEG_CONF_OPTS += --disable-fontconfig
347 endif
349 ifeq ($(BR2_PACKAGE_X264)$(BR2_PACKAGE_FFMPEG_GPL),yy)
350 FFMPEG_CONF_OPTS += --enable-libx264
351 FFMPEG_DEPENDENCIES += x264
352 else
353 FFMPEG_CONF_OPTS += --disable-libx264
354 endif
356 ifeq ($(BR2_PACKAGE_X265)$(BR2_PACKAGE_FFMPEG_GPL),yy)
357 FFMPEG_CONF_OPTS += --enable-libx265
358 FFMPEG_DEPENDENCIES += x265
359 else
360 FFMPEG_CONF_OPTS += --disable-libx265
361 endif
363 ifeq ($(BR2_X86_CPU_HAS_MMX),y)
364 FFMPEG_CONF_OPTS += --enable-yasm
365 FFMPEG_DEPENDENCIES += host-yasm
366 else
367 ifeq ($(BR2_x86_i586),y)
368 # Needed to work around a bug with gcc 5.x:
369 # error: 'asm' operand has impossible constraints
370 FFMPEG_CONF_OPTS += --disable-inline-asm
371 endif
372 FFMPEG_CONF_OPTS += --disable-yasm
373 FFMPEG_CONF_OPTS += --disable-mmx
374 endif
376 ifeq ($(BR2_X86_CPU_HAS_SSE),y)
377 FFMPEG_CONF_OPTS += --enable-sse
378 else
379 FFMPEG_CONF_OPTS += --disable-sse
380 endif
382 ifeq ($(BR2_X86_CPU_HAS_SSE2),y)
383 FFMPEG_CONF_OPTS += --enable-sse2
384 else
385 FFMPEG_CONF_OPTS += --disable-sse2
386 endif
388 ifeq ($(BR2_X86_CPU_HAS_SSE3),y)
389 FFMPEG_CONF_OPTS += --enable-sse3
390 else
391 FFMPEG_CONF_OPTS += --disable-sse3
392 endif
394 ifeq ($(BR2_X86_CPU_HAS_SSSE3),y)
395 FFMPEG_CONF_OPTS += --enable-ssse3
396 else
397 FFMPEG_CONF_OPTS += --disable-ssse3
398 endif
400 ifeq ($(BR2_X86_CPU_HAS_SSE4),y)
401 FFMPEG_CONF_OPTS += --enable-sse4
402 else
403 FFMPEG_CONF_OPTS += --disable-sse4
404 endif
406 ifeq ($(BR2_X86_CPU_HAS_SSE42),y)
407 FFMPEG_CONF_OPTS += --enable-sse42
408 else
409 FFMPEG_CONF_OPTS += --disable-sse42
410 endif
412 ifeq ($(BR2_X86_CPU_HAS_AVX),y)
413 FFMPEG_CONF_OPTS += --enable-avx
414 else
415 FFMPEG_CONF_OPTS += --disable-avx
416 endif
418 ifeq ($(BR2_X86_CPU_HAS_AVX2),y)
419 FFMPEG_CONF_OPTS += --enable-avx2
420 else
421 FFMPEG_CONF_OPTS += --disable-avx2
422 endif
424 # Explicitly disable everything that doesn't match for ARM
425 # FFMPEG "autodetects" by compiling an extended instruction via AS
426 # This works on compilers that aren't built for generic by default
427 ifeq ($(BR2_ARM_CPU_ARMV4),y)
428 FFMPEG_CONF_OPTS += --disable-armv5te
429 endif
430 ifeq ($(BR2_ARM_CPU_ARMV6)$(BR2_ARM_CPU_ARMV7A),y)
431 FFMPEG_CONF_OPTS += --enable-armv6
432 else
433 FFMPEG_CONF_OPTS += --disable-armv6 --disable-armv6t2
434 endif
435 ifeq ($(BR2_ARM_CPU_HAS_VFPV2),y)
436 FFMPEG_CONF_OPTS += --enable-vfp
437 else
438 FFMPEG_CONF_OPTS += --disable-vfp
439 endif
440 ifeq ($(BR2_ARM_CPU_HAS_NEON),y)
441 FFMPEG_CONF_OPTS += --enable-neon
442 else
443 FFMPEG_CONF_OPTS += --disable-neon
444 endif
446 ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y)
447 ifeq ($(BR2_MIPS_SOFT_FLOAT),y)
448 FFMPEG_CONF_OPTS += --disable-mipsfpu
449 else
450 FFMPEG_CONF_OPTS += --enable-mipsfpu
451 endif
452 endif # MIPS
454 ifeq ($(BR2_POWERPC_CPU_HAS_ALTIVEC),y)
455 FFMPEG_CONF_OPTS += --enable-altivec
456 else
457 FFMPEG_CONF_OPTS += --disable-altivec
458 endif
460 ifeq ($(BR2_STATIC_LIBS),)
461 FFMPEG_CONF_OPTS += --enable-pic
462 else
463 FFMPEG_CONF_OPTS += --disable-pic
464 endif
466 # Default to --cpu=generic for MIPS architecture, in order to avoid a
467 # warning from ffmpeg's configure script.
468 ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y)
469 FFMPEG_CONF_OPTS += --cpu=generic
470 else ifneq ($(call qstrip,$(BR2_GCC_TARGET_CPU)),)
471 FFMPEG_CONF_OPTS += --cpu=$(BR2_GCC_TARGET_CPU)
472 else ifneq ($(call qstrip,$(BR2_GCC_TARGET_ARCH)),)
473 FFMPEG_CONF_OPTS += --cpu=$(BR2_GCC_TARGET_ARCH)
474 endif
477 FFMPEG_CONF_OPTS += $(call qstrip,$(BR2_PACKAGE_FFMPEG_EXTRACONF))
479 # Override FFMPEG_CONFIGURE_CMDS: FFmpeg does not support --target and others
480 define FFMPEG_CONFIGURE_CMDS
481 (cd $(FFMPEG_SRCDIR) && rm -rf config.cache && \
482 $(TARGET_CONFIGURE_OPTS) \
483 $(TARGET_CONFIGURE_ARGS) \
484 $(FFMPEG_CONF_ENV) \
485 ./configure \
486 --enable-cross-compile \
487 --cross-prefix=$(TARGET_CROSS) \
488 --sysroot=$(STAGING_DIR) \
489 --host-cc="$(HOSTCC)" \
490 --arch=$(BR2_ARCH) \
491 --target-os="linux" \
492 --disable-stripping \
493 --pkg-config="$(PKG_CONFIG_HOST_BINARY)" \
494 $(SHARED_STATIC_LIBS_OPTS) \
495 $(FFMPEG_CONF_OPTS) \
497 endef
499 $(eval $(autotools-package))