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