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