package/dhcp/S80dhcp-server: allow empty INTERFACES
[buildroot-gz.git] / package / ffmpeg / ffmpeg.mk
blob0f8b8407c898ec70c0a09f5f31300cedd9eb105f
1 ################################################################################
3 # ffmpeg
5 ################################################################################
7 FFMPEG_VERSION = 2.8.4
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-vdpau \
40 --disable-dxva2 \
41 --enable-runtime-cpudetect \
42 --disable-hardcoded-tables \
43 --disable-memalign-hack \
44 --disable-mipsdspr1 \
45 --disable-mipsdspr2 \
46 --disable-msa \
47 --enable-hwaccels \
48 --disable-avisynth \
49 --disable-frei0r \
50 --disable-libopencore-amrnb \
51 --disable-libopencore-amrwb \
52 --disable-libopencv \
53 --disable-libcdio \
54 --disable-libdc1394 \
55 --disable-libfaac \
56 --disable-libgsm \
57 --disable-libilbc \
58 --disable-libnut \
59 --disable-libopenjpeg \
60 --disable-libschroedinger \
61 --disable-libvo-aacenc \
62 --disable-libvo-amrwbenc \
63 --disable-symver \
64 --disable-doc
66 FFMPEG_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBICONV),libiconv) host-pkgconf
68 ifeq ($(BR2_PACKAGE_FFMPEG_GPL),y)
69 FFMPEG_CONF_OPTS += --enable-gpl
70 else
71 FFMPEG_CONF_OPTS += --disable-gpl
72 endif
74 ifeq ($(BR2_PACKAGE_FFMPEG_NONFREE),y)
75 FFMPEG_CONF_OPTS += --enable-nonfree
76 else
77 FFMPEG_CONF_OPTS += --disable-nonfree
78 endif
80 ifeq ($(BR2_PACKAGE_FFMPEG_FFMPEG),y)
81 FFMPEG_CONF_OPTS += --enable-ffmpeg
82 else
83 FFMPEG_CONF_OPTS += --disable-ffmpeg
84 endif
86 ifeq ($(BR2_PACKAGE_FFMPEG_FFPLAY),y)
87 FFMPEG_DEPENDENCIES += sdl
88 FFMPEG_CONF_OPTS += --enable-ffplay
89 FFMPEG_CONF_ENV += SDL_CONFIG=$(STAGING_DIR)/usr/bin/sdl-config
90 else
91 FFMPEG_CONF_OPTS += --disable-ffplay
92 endif
94 ifeq ($(BR2_PACKAGE_FFMPEG_FFSERVER),y)
95 FFMPEG_CONF_OPTS += --enable-ffserver
96 else
97 FFMPEG_CONF_OPTS += --disable-ffserver
98 endif
100 ifeq ($(BR2_PACKAGE_FFMPEG_AVRESAMPLE),y)
101 FFMPEG_CONF_OPTS += --enable-avresample
102 else
103 FFMPEG_CONF_OPTS += --disable-avresample
104 endif
106 ifeq ($(BR2_PACKAGE_FFMPEG_FFPROBE),y)
107 FFMPEG_CONF_OPTS += --enable-ffprobe
108 else
109 FFMPEG_CONF_OPTS += --disable-ffprobe
110 endif
112 ifeq ($(BR2_PACKAGE_FFMPEG_POSTPROC),y)
113 FFMPEG_CONF_OPTS += --enable-postproc
114 else
115 FFMPEG_CONF_OPTS += --disable-postproc
116 endif
118 ifeq ($(BR2_PACKAGE_FFMPEG_SWSCALE),y)
119 FFMPEG_CONF_OPTS += --enable-swscale
120 else
121 FFMPEG_CONF_OPTS += --disable-swscale
122 endif
124 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_ENCODERS)),all)
125 FFMPEG_CONF_OPTS += --disable-encoders \
126 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_ENCODERS)),--enable-encoder=$(x))
127 endif
129 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_DECODERS)),all)
130 FFMPEG_CONF_OPTS += --disable-decoders \
131 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_DECODERS)),--enable-decoder=$(x))
132 endif
134 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_MUXERS)),all)
135 FFMPEG_CONF_OPTS += --disable-muxers \
136 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_MUXERS)),--enable-muxer=$(x))
137 endif
139 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_DEMUXERS)),all)
140 FFMPEG_CONF_OPTS += --disable-demuxers \
141 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_DEMUXERS)),--enable-demuxer=$(x))
142 endif
144 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_PARSERS)),all)
145 FFMPEG_CONF_OPTS += --disable-parsers \
146 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_PARSERS)),--enable-parser=$(x))
147 endif
149 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_BSFS)),all)
150 FFMPEG_CONF_OPTS += --disable-bsfs \
151 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_BSFS)),--enable-bsfs=$(x))
152 endif
154 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_PROTOCOLS)),all)
155 FFMPEG_CONF_OPTS += --disable-protocols \
156 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_PROTOCOLS)),--enable-protocol=$(x))
157 endif
159 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_FILTERS)),all)
160 FFMPEG_CONF_OPTS += --disable-filters \
161 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_FILTERS)),--enable-filter=$(x))
162 endif
164 ifeq ($(BR2_PACKAGE_FFMPEG_INDEVS),y)
165 FFMPEG_CONF_OPTS += --enable-indevs
166 else
167 FFMPEG_CONF_OPTS += --disable-indevs
168 endif
170 ifeq ($(BR2_PACKAGE_FFMPEG_OUTDEVS),y)
171 FFMPEG_CONF_OPTS += --enable-outdevs
172 else
173 FFMPEG_CONF_OPTS += --disable-outdevs
174 endif
176 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
177 FFMPEG_CONF_OPTS += --enable-pthreads
178 else
179 FFMPEG_CONF_OPTS += --disable-pthreads
180 endif
182 ifeq ($(BR2_PACKAGE_ZLIB),y)
183 FFMPEG_CONF_OPTS += --enable-zlib
184 FFMPEG_DEPENDENCIES += zlib
185 else
186 FFMPEG_CONF_OPTS += --disable-zlib
187 endif
189 ifeq ($(BR2_PACKAGE_BZIP2),y)
190 FFMPEG_CONF_OPTS += --enable-bzlib
191 FFMPEG_DEPENDENCIES += bzip2
192 else
193 FFMPEG_CONF_OPTS += --disable-bzlib
194 endif
196 ifeq ($(BR2_PACKAGE_FDK_AAC)$(BR2_PACKAGE_FFMPEG_NONFREE),yy)
197 FFMPEG_CONF_OPTS += --enable-libfdk-aac
198 FFMPEG_DEPENDENCIES += fdk-aac
199 else
200 FFMPEG_CONF_OPTS += --disable-libfdk-aac
201 endif
203 ifeq ($(BR2_PACKAGE_GNUTLS),y)
204 FFMPEG_CONF_OPTS += --enable-gnutls --disable-openssl
205 FFMPEG_DEPENDENCIES += gnutls
206 else
207 FFMPEG_CONF_OPTS += --disable-gnutls
208 ifeq ($(BR2_PACKAGE_OPENSSL),y)
209 # openssl isn't license compatible with GPL
210 ifeq ($(BR2_PACKAGE_FFMPEG_GPL)x$(BR2_PACKAGE_FFMPEG_NONFREE),yx)
211 FFMPEG_CONF_OPTS += --disable-openssl
212 else
213 FFMPEG_CONF_OPTS += --enable-openssl
214 FFMPEG_DEPENDENCIES += openssl
215 endif
216 else
217 FFMPEG_CONF_OPTS += --disable-openssl
218 endif
219 endif
221 ifeq ($(BR2_PACKAGE_LIBDCADEC),y)
222 FFMPEG_CONF_OPTS += --enable-libdcadec
223 FFMPEG_DEPENDENCIES += libdcadec
224 else
225 FFMPEG_CONF_OPTS += --disable-libdcadec
226 endif
228 ifeq ($(BR2_PACKAGE_LIBOPENH264),y)
229 FFMPEG_CONF_OPTS += --enable-libopenh264
230 FFMPEG_DEPENDENCIES += libopenh264
231 else
232 FFMPEG_CONF_OPTS += --disable-libopenh264
233 endif
235 ifeq ($(BR2_PACKAGE_LIBVORBIS),y)
236 FFMPEG_DEPENDENCIES += libvorbis
237 FFMPEG_CONF_OPTS += \
238 --enable-libvorbis \
239 --enable-muxer=ogg \
240 --enable-encoder=libvorbis
241 endif
243 ifeq ($(BR2_PACKAGE_LIBVA),y)
244 FFMPEG_CONF_OPTS += --enable-vaapi
245 FFMPEG_DEPENDENCIES += libva
246 else
247 FFMPEG_CONF_OPTS += --disable-vaapi
248 endif
250 ifeq ($(BR2_PACKAGE_OPUS),y)
251 FFMPEG_CONF_OPTS += --enable-libopus
252 FFMPEG_DEPENDENCIES += opus
253 else
254 FFMPEG_CONF_OPTS += --disable-libopus
255 endif
257 ifeq ($(BR2_PACKAGE_LIBVPX),y)
258 FFMPEG_CONF_OPTS += --enable-libvpx
259 FFMPEG_DEPENDENCIES += libvpx
260 else
261 FFMPEG_CONF_OPTS += --disable-libvpx
262 endif
264 ifeq ($(BR2_PACKAGE_LIBASS),y)
265 FFMPEG_CONF_OPTS += --enable-libass
266 FFMPEG_DEPENDENCIES += libass
267 else
268 FFMPEG_CONF_OPTS += --disable-libass
269 endif
271 ifeq ($(BR2_PACKAGE_LIBBLURAY),y)
272 FFMPEG_CONF_OPTS += --enable-libbluray
273 FFMPEG_DEPENDENCIES += libbluray
274 else
275 FFMPEG_CONF_OPTS += --disable-libbluray
276 endif
278 ifeq ($(BR2_PACKAGE_RTMPDUMP),y)
279 FFMPEG_CONF_OPTS += --enable-librtmp
280 FFMPEG_DEPENDENCIES += rtmpdump
281 else
282 FFMPEG_CONF_OPTS += --disable-librtmp
283 endif
285 ifeq ($(BR2_PACKAGE_LAME),y)
286 FFMPEG_CONF_OPTS += --enable-libmp3lame
287 FFMPEG_DEPENDENCIES += lame
288 else
289 FFMPEG_CONF_OPTS += --disable-libmp3lame
290 endif
292 ifeq ($(BR2_PACKAGE_LIBMODPLUG),y)
293 FFMPEG_CONF_OPTS += --enable-libmodplug
294 FFMPEG_DEPENDENCIES += libmodplug
295 else
296 FFMPEG_CONF_OPTS += --disable-libmodplug
297 endif
299 ifeq ($(BR2_PACKAGE_SPEEX),y)
300 FFMPEG_CONF_OPTS += --enable-libspeex
301 FFMPEG_DEPENDENCIES += speex
302 else
303 FFMPEG_CONF_OPTS += --disable-libspeex
304 endif
306 ifeq ($(BR2_PACKAGE_LIBTHEORA),y)
307 FFMPEG_CONF_OPTS += --enable-libtheora
308 FFMPEG_DEPENDENCIES += libtheora
309 else
310 FFMPEG_CONF_OPTS += --disable-libtheora
311 endif
313 ifeq ($(BR2_PACKAGE_WAVPACK),y)
314 FFMPEG_CONF_OPTS += --enable-libwavpack
315 FFMPEG_DEPENDENCIES += wavpack
316 else
317 FFMPEG_CONF_OPTS += --disable-libwavpack
318 endif
320 # ffmpeg freetype support require fenv.h which is only
321 # available/working on glibc.
322 # The microblaze variant doesn't provide the needed exceptions
323 ifeq ($(BR2_PACKAGE_FREETYPE)$(BR2_TOOLCHAIN_USES_GLIBC)x$(BR2_microblaze),yyx)
324 FFMPEG_CONF_OPTS += --enable-libfreetype
325 FFMPEG_DEPENDENCIES += freetype
326 else
327 FFMPEG_CONF_OPTS += --disable-libfreetype
328 endif
330 ifeq ($(BR2_PACKAGE_FONTCONFIG),y)
331 FFMPEG_CONF_OPTS += --enable-fontconfig
332 FFMPEG_DEPENDENCIES += fontconfig
333 else
334 FFMPEG_CONF_OPTS += --disable-fontconfig
335 endif
337 ifeq ($(BR2_PACKAGE_X264)$(BR2_PACKAGE_FFMPEG_GPL),yy)
338 FFMPEG_CONF_OPTS += --enable-libx264
339 FFMPEG_DEPENDENCIES += x264
340 else
341 FFMPEG_CONF_OPTS += --disable-libx264
342 endif
344 ifeq ($(BR2_PACKAGE_X265)$(BR2_PACKAGE_FFMPEG_GPL),yy)
345 FFMPEG_CONF_OPTS += --enable-libx265
346 FFMPEG_DEPENDENCIES += x265
347 else
348 FFMPEG_CONF_OPTS += --disable-libx265
349 endif
351 ifeq ($(BR2_X86_CPU_HAS_MMX),y)
352 FFMPEG_CONF_OPTS += --enable-yasm
353 FFMPEG_DEPENDENCIES += host-yasm
354 else
355 ifeq ($(BR2_x86_i586),y)
356 # Needed to work around a bug with gcc 5.x:
357 # error: 'asm' operand has impossible constraints
358 FFMPEG_CONF_OPTS += --disable-inline-asm
359 endif
360 FFMPEG_CONF_OPTS += --disable-yasm
361 FFMPEG_CONF_OPTS += --disable-mmx
362 endif
364 ifeq ($(BR2_X86_CPU_HAS_SSE),y)
365 FFMPEG_CONF_OPTS += --enable-sse
366 else
367 FFMPEG_CONF_OPTS += --disable-sse
368 endif
370 ifeq ($(BR2_X86_CPU_HAS_SSE2),y)
371 FFMPEG_CONF_OPTS += --enable-sse2
372 else
373 FFMPEG_CONF_OPTS += --disable-sse2
374 endif
376 ifeq ($(BR2_X86_CPU_HAS_SSE3),y)
377 FFMPEG_CONF_OPTS += --enable-sse3
378 else
379 FFMPEG_CONF_OPTS += --disable-sse3
380 endif
382 ifeq ($(BR2_X86_CPU_HAS_SSSE3),y)
383 FFMPEG_CONF_OPTS += --enable-ssse3
384 else
385 FFMPEG_CONF_OPTS += --disable-ssse3
386 endif
388 ifeq ($(BR2_X86_CPU_HAS_SSE4),y)
389 FFMPEG_CONF_OPTS += --enable-sse4
390 else
391 FFMPEG_CONF_OPTS += --disable-sse4
392 endif
394 ifeq ($(BR2_X86_CPU_HAS_SSE42),y)
395 FFMPEG_CONF_OPTS += --enable-sse42
396 else
397 FFMPEG_CONF_OPTS += --disable-sse42
398 endif
400 ifeq ($(BR2_X86_CPU_HAS_AVX),y)
401 FFMPEG_CONF_OPTS += --enable-avx
402 else
403 FFMPEG_CONF_OPTS += --disable-avx
404 endif
406 ifeq ($(BR2_X86_CPU_HAS_AVX2),y)
407 FFMPEG_CONF_OPTS += --enable-avx2
408 else
409 FFMPEG_CONF_OPTS += --disable-avx2
410 endif
412 # Explicitly disable everything that doesn't match for ARM
413 # FFMPEG "autodetects" by compiling an extended instruction via AS
414 # This works on compilers that aren't built for generic by default
415 ifeq ($(BR2_ARM_CPU_ARMV4),y)
416 FFMPEG_CONF_OPTS += --disable-armv5te
417 endif
418 ifeq ($(BR2_ARM_CPU_ARMV6)$(BR2_ARM_CPU_ARMV7A),y)
419 FFMPEG_CONF_OPTS += --enable-armv6
420 else
421 FFMPEG_CONF_OPTS += --disable-armv6 --disable-armv6t2
422 endif
423 ifeq ($(BR2_ARM_CPU_HAS_VFPV2),y)
424 FFMPEG_CONF_OPTS += --enable-vfp
425 else
426 FFMPEG_CONF_OPTS += --disable-vfp
427 endif
428 ifeq ($(BR2_ARM_CPU_HAS_NEON),y)
429 FFMPEG_CONF_OPTS += --enable-neon
430 endif
432 ifeq ($(BR2_MIPS_SOFT_FLOAT),y)
433 FFMPEG_CONF_OPTS += \
434 --disable-mipsfpu
435 else
436 FFMPEG_CONF_OPTS += \
437 --enable-mipsfpu
438 endif
440 ifeq ($(BR2_mips_32r2),y)
441 FFMPEG_CONF_OPTS += \
442 --enable-mips32r2
443 else
444 FFMPEG_CONF_OPTS += \
445 --disable-mips32r2
446 endif
448 ifeq ($(BR2_POWERPC_CPU_HAS_ALTIVEC),y)
449 FFMPEG_CONF_OPTS += --enable-altivec
450 else
451 FFMPEG_CONF_OPTS += --disable-altivec
452 endif
454 ifeq ($(BR2_STATIC_LIBS),)
455 FFMPEG_CONF_OPTS += --enable-pic
456 else
457 FFMPEG_CONF_OPTS += --disable-pic
458 endif
460 ifneq ($(call qstrip,$(BR2_GCC_TARGET_CPU)),)
461 FFMPEG_CONF_OPTS += --cpu=$(BR2_GCC_TARGET_CPU)
462 else ifneq ($(call qstrip,$(BR2_GCC_TARGET_ARCH)),)
463 FFMPEG_CONF_OPTS += --cpu=$(BR2_GCC_TARGET_ARCH)
464 endif
466 FFMPEG_CONF_OPTS += $(call qstrip,$(BR2_PACKAGE_FFMPEG_EXTRACONF))
468 # Override FFMPEG_CONFIGURE_CMDS: FFmpeg does not support --target and others
469 define FFMPEG_CONFIGURE_CMDS
470 (cd $(FFMPEG_SRCDIR) && rm -rf config.cache && \
471 $(TARGET_CONFIGURE_OPTS) \
472 $(TARGET_CONFIGURE_ARGS) \
473 $(FFMPEG_CONF_ENV) \
474 ./configure \
475 --enable-cross-compile \
476 --cross-prefix=$(TARGET_CROSS) \
477 --sysroot=$(STAGING_DIR) \
478 --host-cc="$(HOSTCC)" \
479 --arch=$(BR2_ARCH) \
480 --target-os="linux" \
481 --disable-stripping \
482 --pkg-config="$(PKG_CONFIG_HOST_BINARY)" \
483 $(SHARED_STATIC_LIBS_OPTS) \
484 $(FFMPEG_CONF_OPTS) \
486 endef
488 $(eval $(autotools-package))