ffmpeg: fix license file
[buildroot-gz.git] / package / ffmpeg / ffmpeg.mk
blob5b7fa200296b576c633b39ab606768e3ae8edbdc
1 ################################################################################
3 # ffmpeg
5 ################################################################################
7 FFMPEG_VERSION = 2.4.1
8 FFMPEG_SOURCE = ffmpeg-$(FFMPEG_VERSION).tar.bz2
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_OPT = \
20 --prefix=/usr \
21 --enable-avfilter \
22 --disable-version3 \
23 --enable-logging \
24 --enable-optimizations \
25 --disable-extra-warnings \
26 --disable-ffprobe \
27 --enable-avdevice \
28 --enable-avcodec \
29 --enable-avformat \
30 --disable-x11grab \
31 --enable-network \
32 --disable-gray \
33 --enable-swscale-alpha \
34 --disable-small \
35 --enable-dct \
36 --enable-fft \
37 --enable-mdct \
38 --enable-rdft \
39 --disable-crystalhd \
40 --disable-vdpau \
41 --disable-dxva2 \
42 --enable-runtime-cpudetect \
43 --disable-hardcoded-tables \
44 --disable-memalign-hack \
45 --enable-hwaccels \
46 --disable-avisynth \
47 --disable-frei0r \
48 --disable-libopencore-amrnb \
49 --disable-libopencore-amrwb \
50 --disable-libopencv \
51 --disable-libdc1394 \
52 --disable-libfaac \
53 --disable-libfreetype \
54 --disable-libgsm \
55 --disable-libmp3lame \
56 --disable-libnut \
57 --disable-libopenjpeg \
58 --disable-librtmp \
59 --disable-libschroedinger \
60 --disable-libspeex \
61 --disable-libtheora \
62 --disable-libvo-aacenc \
63 --disable-libvo-amrwbenc \
64 --disable-symver \
65 --disable-doc
67 FFMPEG_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBICONV),libiconv) host-pkgconf
69 ifeq ($(BR2_ENABLE_DEBUG),y)
70 FFMPEG_CONF_OPT += --enable-debug
71 else
72 FFMPEG_CONF_OPT += --disable-debug
73 endif
75 ifeq ($(BR2_PACKAGE_FFMPEG_GPL),y)
76 FFMPEG_CONF_OPT += --enable-gpl
77 else
78 FFMPEG_CONF_OPT += --disable-gpl
79 endif
81 ifeq ($(BR2_PACKAGE_FFMPEG_NONFREE),y)
82 FFMPEG_CONF_OPT += --enable-nonfree
83 else
84 FFMPEG_CONF_OPT += --disable-nonfree
85 endif
87 ifeq ($(BR2_PACKAGE_FFMPEG_FFMPEG),y)
88 FFMPEG_CONF_OPT += --enable-ffmpeg
89 else
90 FFMPEG_CONF_OPT += --disable-ffmpeg
91 endif
93 ifeq ($(BR2_PACKAGE_FFMPEG_FFPLAY),y)
94 FFMPEG_DEPENDENCIES += sdl
95 FFMPEG_CONF_OPT += --enable-ffplay
96 FFMPEG_CONF_ENV += SDL_CONFIG=$(STAGING_DIR)/usr/bin/sdl-config
97 else
98 FFMPEG_CONF_OPT += --disable-ffplay
99 endif
101 ifeq ($(BR2_PACKAGE_FFMPEG_FFSERVER),y)
102 FFMPEG_CONF_OPT += --enable-ffserver
103 else
104 FFMPEG_CONF_OPT += --disable-ffserver
105 endif
107 ifeq ($(BR2_PACKAGE_FFMPEG_POSTPROC),y)
108 FFMPEG_CONF_OPT += --enable-postproc
109 else
110 FFMPEG_CONF_OPT += --disable-postproc
111 endif
113 ifeq ($(BR2_PACKAGE_FFMPEG_SWSCALE),y)
114 FFMPEG_CONF_OPT += --enable-swscale
115 else
116 FFMPEG_CONF_OPT += --disable-swscale
117 endif
119 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_ENCODERS)),all)
120 FFMPEG_CONF_OPT += --disable-encoders \
121 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_ENCODERS)),--enable-encoder=$(x))
122 endif
124 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_DECODERS)),all)
125 FFMPEG_CONF_OPT += --disable-decoders \
126 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_DECODERS)),--enable-decoder=$(x))
127 endif
129 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_MUXERS)),all)
130 FFMPEG_CONF_OPT += --disable-muxers \
131 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_MUXERS)),--enable-muxer=$(x))
132 endif
134 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_DEMUXERS)),all)
135 FFMPEG_CONF_OPT += --disable-demuxers \
136 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_DEMUXERS)),--enable-demuxer=$(x))
137 endif
139 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_PARSERS)),all)
140 FFMPEG_CONF_OPT += --disable-parsers \
141 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_PARSERS)),--enable-parser=$(x))
142 endif
144 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_BSFS)),all)
145 FFMPEG_CONF_OPT += --disable-bsfs \
146 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_BSFS)),--enable-bsfs=$(x))
147 endif
149 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_PROTOCOLS)),all)
150 FFMPEG_CONF_OPT += --disable-protocols \
151 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_PROTOCOLS)),--enable-protocol=$(x))
152 endif
154 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_FILTERS)),all)
155 FFMPEG_CONF_OPT += --disable-filters \
156 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_FILTERS)),--enable-filter=$(x))
157 endif
159 ifeq ($(BR2_PACKAGE_FFMPEG_INDEVS),y)
160 FFMPEG_CONF_OPT += --enable-indevs
161 else
162 FFMPEG_CONF_OPT += --disable-indevs
163 endif
165 ifeq ($(BR2_PACKAGE_FFMPEG_OUTDEVS),y)
166 FFMPEG_CONF_OPT += --enable-outdevs
167 else
168 FFMPEG_CONF_OPT += --disable-outdevs
169 endif
171 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
172 FFMPEG_CONF_OPT += --enable-pthreads
173 else
174 FFMPEG_CONF_OPT += --disable-pthreads
175 endif
177 ifeq ($(BR2_PACKAGE_ZLIB),y)
178 FFMPEG_CONF_OPT += --enable-zlib
179 FFMPEG_DEPENDENCIES += zlib
180 else
181 FFMPEG_CONF_OPT += --disable-zlib
182 endif
184 ifeq ($(BR2_PACKAGE_BZIP2),y)
185 FFMPEG_CONF_OPT += --enable-bzlib
186 FFMPEG_DEPENDENCIES += bzip2
187 else
188 FFMPEG_CONF_OPT += --disable-bzlib
189 endif
191 ifeq ($(BR2_PACKAGE_OPENSSL),y)
192 # openssl isn't license compatible with GPL
193 ifeq ($(BR2_PACKAGE_FFMPEG_GPL)x$(BR2_PACKAGE_FFMPEG_NONFREE),yx)
194 FFMPEG_CONF_OPT += --disable-openssl
195 else
196 FFMPEG_CONF_OPT += --enable-openssl
197 FFMPEG_DEPENDENCIES += openssl
198 endif
199 else
200 FFMPEG_CONF_OPT += --disable-openssl
201 endif
203 ifeq ($(BR2_PACKAGE_LIBVORBIS),y)
204 FFMPEG_DEPENDENCIES += libvorbis
205 FFMPEG_CONF_OPT += \
206 --enable-libvorbis \
207 --enable-muxer=ogg \
208 --enable-encoder=libvorbis
209 endif
211 ifeq ($(BR2_PACKAGE_LIBVA),y)
212 FFMPEG_CONF_OPT += --enable-vaapi
213 FFMPEG_DEPENDENCIES += libva
214 else
215 FFMPEG_CONF_OPT += --disable-vaapi
216 endif
218 ifeq ($(BR2_PACKAGE_OPUS),y)
219 FFMPEG_CONF_OPT += --enable-libopus
220 FFMPEG_DEPENDENCIES += opus
221 else
222 FFMPEG_CONF_OPT += --disable-libopus
223 endif
225 ifeq ($(BR2_PACKAGE_LIBVPX),y)
226 FFMPEG_CONF_OPT += --enable-libvpx
227 FFMPEG_DEPENDENCIES += libvpx
228 else
229 FFMPEG_CONF_OPT += --disable-libvpx
230 endif
232 ifeq ($(BR2_X86_CPU_HAS_MMX),y)
233 FFMPEG_CONF_OPT += --enable-yasm
234 FFMPEG_DEPENDENCIES += host-yasm
235 else
236 FFMPEG_CONF_OPT += --disable-yasm
237 FFMPEG_CONF_OPT += --disable-mmx
238 endif
240 ifeq ($(BR2_X86_CPU_HAS_SSE),y)
241 FFMPEG_CONF_OPT += --enable-sse
242 else
243 FFMPEG_CONF_OPT += --disable-sse
244 endif
246 ifeq ($(BR2_X86_CPU_HAS_SSE2),y)
247 FFMPEG_CONF_OPT += --enable-sse2
248 else
249 FFMPEG_CONF_OPT += --disable-sse2
250 endif
252 ifeq ($(BR2_X86_CPU_HAS_SSE3),y)
253 FFMPEG_CONF_OPT += --enable-sse3
254 else
255 FFMPEG_CONF_OPT += --disable-sse3
256 endif
258 ifeq ($(BR2_X86_CPU_HAS_SSSE3),y)
259 FFMPEG_CONF_OPT += --enable-ssse3
260 else
261 FFMPEG_CONF_OPT += --disable-ssse3
262 endif
264 ifeq ($(BR2_X86_CPU_HAS_SSE4),y)
265 FFMPEG_CONF_OPT += --enable-sse4
266 else
267 FFMPEG_CONF_OPT += --disable-sse4
268 endif
270 ifeq ($(BR2_X86_CPU_HAS_SSE42),y)
271 FFMPEG_CONF_OPT += --enable-sse42
272 else
273 FFMPEG_CONF_OPT += --disable-sse42
274 endif
276 # Explicitly disable everything that doesn't match for ARM
277 # FFMPEG "autodetects" by compiling an extended instruction via AS
278 # This works on compilers that aren't built for generic by default
279 ifeq ($(BR2_arm920t)$(BR2_arm922t)$(BR2_strongarm)$(BR2_fa526),y)
280 FFMPEG_CONF_OPT += --disable-armv5te
281 endif
282 ifeq ($(BR2_arm1136jf_s)$(BR2_arm1176jz_s)$(BR2_arm1176jzf_s)$(BR2_cortex_a5)$(BR2_cortex_a8)$(BR2_cortex_a9)$(BR2_cortex_a15),y)
283 FFMPEG_CONF_OPT += --enable-armv6
284 else
285 FFMPEG_CONF_OPT += --disable-armv6 --disable-armv6t2
286 endif
287 ifeq ($(BR2_arm10)$(BR2_arm1136jf_s)$(BR2_arm1176jz_s)$(BR2_arm1176jzf_s)$(BR2_cortex_a5)$(BR2_cortex_a8)$(BR2_cortex_a9)$(BR2_cortex_a15),y)
288 FFMPEG_CONF_OPT += --enable-vfp
289 else
290 FFMPEG_CONF_OPT += --disable-vfp
291 endif
292 ifeq ($(BR2_ARM_CPU_HAS_NEON),y)
293 FFMPEG_CONF_OPT += --enable-neon
294 endif
296 ifeq ($(BR2_MIPS_SOFT_FLOAT),y)
297 FFMPEG_CONF_OPT += \
298 --disable-mipsfpu
299 else
300 FFMPEG_CONF_OPT += \
301 --enable-mipsfpu
302 endif
304 ifeq ($(BR2_mips_32r2),y)
305 FFMPEG_CONF_OPT += \
306 --enable-mips32r2
307 else
308 FFMPEG_CONF_OPT += \
309 --disable-mips32r2
310 endif
312 ifeq ($(BR2_mips_64r2),y)
313 FFMPEG_CONF_OPT += \
314 --enable-mipsdspr1 \
315 --enable-mipsdspr2
316 else
317 FFMPEG_CONF_OPT += \
318 --disable-mipsdspr1 \
319 --disable-mipsdspr2
320 endif
322 ifeq ($(BR2_POWERPC_CPU_HAS_ALTIVEC),y)
323 FFMPEG_CONF_OPT += --enable-altivec
324 else
325 FFMPEG_CONF_OPT += --disable-altivec
326 endif
328 ifeq ($(BR2_PREFER_STATIC_LIB),)
329 FFMPEG_CONF_OPT += --enable-pic
330 else
331 FFMPEG_CONF_OPT += --disable-pic
332 endif
334 FFMPEG_CONF_OPT += $(call qstrip,$(BR2_PACKAGE_FFMPEG_EXTRACONF))
336 # Override FFMPEG_CONFIGURE_CMDS: FFmpeg does not support --target and others
337 define FFMPEG_CONFIGURE_CMDS
338 (cd $(FFMPEG_SRCDIR) && rm -rf config.cache && \
339 $(TARGET_CONFIGURE_OPTS) \
340 $(TARGET_CONFIGURE_ARGS) \
341 $(FFMPEG_CONF_ENV) \
342 ./configure \
343 --enable-cross-compile \
344 --cross-prefix=$(TARGET_CROSS) \
345 --sysroot=$(STAGING_DIR) \
346 --host-cc="$(HOSTCC)" \
347 --arch=$(BR2_ARCH) \
348 --target-os="linux" \
349 --disable-stripping \
350 --pkg-config="$(PKG_CONFIG_HOST_BINARY)" \
351 $(if $(BR2_GCC_TARGET_TUNE),--cpu=$(BR2_GCC_TARGET_TUNE)) \
352 $(SHARED_STATIC_LIBS_OPTS) \
353 $(FFMPEG_CONF_OPT) \
355 endef
357 $(eval $(autotools-package))