lxc: use generic autoreconf fixup
[feed/packages.git] / multimedia / ffmpeg / Makefile
1 #
2 # Copyright (C) 2006-2015 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=ffmpeg
11 PKG_VERSION:=2.5.3
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://ffmpeg.org/releases/
16 PKG_MD5SUM:=efba7c5cfbea9ce58ff693cd08f90ffa
17 PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
18
19 PKG_LICENSE:=LGPL-2.1+ GPL-2+ LGPL-3
20 PKG_LICENSE_FILES:=COPYING.GPLv2 COPYING.GPLv3 COPYING.LGPLv2.1 COPYING.LGPLv3
21
22 FFMPEG_CUSTOM_ENCODERS:= \
23 ac3 \
24 jpegls \
25 mpeg1video \
26 mpeg2video \
27 mpeg4 \
28 pcm_s16be \
29 pcm_s16le \
30 png \
31 vorbis \
32 zlib \
33
34 FFMPEG_CUSTOM_DECODERS:= \
35 aac \
36 ac3 \
37 alac \
38 amrnb \
39 amrwb \
40 ape \
41 atrac3 \
42 flac \
43 gif \
44 h264 \
45 jpegls \
46 mp2 \
47 mp3 \
48 mpeg1video \
49 mpeg2video \
50 mpeg4 \
51 mpegvideo \
52 mpc7 \
53 mpc8 \
54 pcm_s16be \
55 pcm_s16le \
56 png \
57 vorbis \
58 wavpack \
59 wmav1 \
60 wmav2 \
61 zlib \
62
63 FFMPEG_CUSTOM_MUXERS:= \
64 ac3 \
65 ffm \
66 h264 \
67 mp3 \
68 mp4 \
69 mpeg1video \
70 mpeg2video \
71 mpegts \
72 ogg \
73 rtp \
74
75 FFMPEG_CUSTOM_DEMUXERS:= \
76 aac \
77 ac3 \
78 amr \
79 ape \
80 avi \
81 flac \
82 ffm \
83 h264 \
84 matroska \
85 mov \
86 mp3 \
87 mpegps \
88 mpegts \
89 mpegvideo \
90 mpc \
91 mpc8 \
92 ogg \
93 rm \
94 rtsp \
95 rtp \
96 sdp \
97 v4l2 \
98 wav \
99 wv \
100
101 FFMPEG_CUSTOM_PARSERS:= \
102 aac \
103 flac \
104 ac3 \
105 h264 \
106 mpegaudio \
107 mpeg4video \
108 mpegvideo \
109
110 FFMPEG_CUSTOM_PROTOCOLS:= \
111 file http pipe rtp tcp udp
112
113 FFMPEG_MINI_DECODERS:= \
114 aac \
115 ac3 \
116 flac \
117 h264 \
118 jpegls \
119 mp3 \
120 mpeg1video \
121 mpeg2video \
122 mpeg4 \
123 mpegvideo \
124 png \
125 wmav1 \
126 wmav2 \
127
128 FFMPEG_MINI_DEMUXERS := \
129 aac \
130 ac3 \
131 avi \
132 flac \
133 h264 \
134 matroska \
135 mov \
136 mp3 \
137 mpegts \
138 mpegvideo \
139
140 FFMPEG_MINI_PARSERS:= \
141 ac3 \
142 flac \
143 h264 \
144 mpeg4video \
145 mpegaudio \
146
147 FFMPEG_MINI_PROTOCOLS := \
148 file \
149
150 FFMPEG_AUDIO_DECODERS:= \
151 aac \
152 aac_latm \
153 ac3 \
154 adpcm_* \
155 alac \
156 amrnb \
157 amrwb \
158 ape \
159 atrac3 \
160 flac \
161 mp2 \
162 mp3* \
163 mpc7 \
164 mpc8 \
165 pcm_* \
166 vorbis \
167 wavpack \
168 wmav1 \
169 wmav2 \
170 wmalossless \
171 wmapro \
172 zlib \
173
174 FFMPEG_AUDIO_DEMUXERS:= \
175 aac \
176 ac3 \
177 aiff \
178 amr \
179 ape \
180 avi \
181 flac \
182 ffm \
183 matroska \
184 mp3 \
185 mov \
186 mpc \
187 mpc8 \
188 mpegts \
189 ogg \
190 rm \
191 rtsp \
192 rtp \
193 sdp \
194 wav \
195 wv \
196
197 FFMPEG_AUDIO_PARSERS:= \
198 aac \
199 aac_latm \
200 flac \
201 ac3 \
202 mpegaudio \
203
204 FFMPEG_AUDIO_PROTOCOLS:= \
205 file http rtp tcp udp
206
207
208 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
209
210 PKG_CONFIG_DEPENDS:= \
211 $(patsubst %,CONFIG_FFMPEG_CUSTOM_ENCODER_%,$(FFMPEG_CUSTOM_ENCODERS)) \
212 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DECODER_%,$(FFMPEG_CUSTOM_DECODERS)) \
213 $(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
214 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DEMUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
215 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PARSER_%,$(FFMPEG_CUSTOM_PARSERS)) \
216 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PROTOCOL_%,$(FFMPEG_CUSTOM_PROTOCOLS))
217
218 include $(INCLUDE_DIR)/package.mk
219
220 define Package/ffmpeg/Default
221 TITLE:=FFmpeg
222 URL:=http://ffmpeg.mplayerhq.hu/
223 endef
224
225 define Package/ffmpeg/Default/description
226 FFmpeg is a a software package that can record, convert and stream digital
227 audio and video in numerous formats.
228 endef
229
230
231 define Package/ffmpeg
232 $(call Package/ffmpeg/Default)
233 SECTION:=multimedia
234 CATEGORY:=Multimedia
235 TITLE+= program
236 DEPENDS+= +libpthread +libffmpeg-full
237 VARIANT:=full
238 endef
239
240 define Package/ffmpeg/description
241 $(call Package/ffmpeg/Default/description)
242 .
243 This package contains the FFmpeg command line tool.
244 endef
245
246
247 define Package/ffprobe
248 $(call Package/ffmpeg/Default)
249 SECTION:=multimedia
250 CATEGORY:=Multimedia
251 TITLE+= CLI media identifier
252 DEPENDS+= +libffmpeg-full
253 VARIANT:=full
254 endef
255
256 define Package/ffprobe/description
257 $(call Package/ffmpeg/Default/description)
258 .
259 This package contains the FFprobe command line tool.
260 endef
261
262
263 define Package/ffserver
264 $(call Package/ffserver/Default)
265 SECTION:=multimedia
266 CATEGORY:=Multimedia
267 TITLE+= streaming server
268 DEPENDS+= +libpthread +libffmpeg-full
269 VARIANT:=full
270 endef
271
272 define Package/ffserver/description
273 $(call Package/ffmpeg/Default/description)
274 .
275 This package contains the FFmpeg streaming server.
276 endef
277
278
279 define Package/libffmpeg/Default
280 $(call Package/ffmpeg/Default)
281 SECTION:=libs
282 CATEGORY:=Libraries
283 TITLE+= libraries
284 DEPENDS+= +libpthread +zlib +libbz2
285 PROVIDES:= libffmpeg
286 endef
287
288
289 define Package/libffmpeg-custom
290 $(call Package/libffmpeg/Default)
291 TITLE+= (custom)
292 DEPENDS+= @DEVEL @!ALL +libopus +libspeex
293 VARIANT:=custom
294 MENU:=1
295 endef
296
297 define Package/libffmpeg-custom/config
298 source "$(SOURCE)/Config.in"
299 endef
300
301 define Package/libffmpeg-custom/description
302 $(call Package/ffmpeg/Default/description)
303 .
304 This package contains customized FFmpeg shared libraries.
305 endef
306
307
308 define Package/libffmpeg-audio-dec
309 $(call Package/libffmpeg/Default)
310 TITLE+= (audio)
311 DEPENDS+= @DEVEL +libopus +libspeex
312 VARIANT:=audio-dec
313 endef
314
315 define Package/libffmpeg-audio-dec/description
316 $(call Package/ffmpeg/Default/description)
317 .
318 This package contains FFmpeg shared libraries for audio decoding
319 endef
320
321
322 define Package/libffmpeg-full
323 $(call Package/libffmpeg/Default)
324 TITLE+= (full)
325 DEPENDS+= @BUILD_PATENTED +alsa-lib
326 VARIANT:=full
327 endef
328
329 define Package/libffmpeg-full/description
330 $(call Package/ffmpeg/Default/description)
331 .
332 This package contains full-featured FFmpeg shared libraries.
333 endef
334
335
336 define Package/libffmpeg-mini
337 $(call Package/libffmpeg/Default)
338 TITLE+= (mini)
339 DEPENDS+= @BUILD_PATENTED
340 VARIANT:=mini
341 endef
342
343 define Package/libffmpeg-mini/description
344 $(call Package/ffmpeg/Default/description)
345 .
346 This package contains minimal-featured FFmpeg shared libraries.
347 endef
348
349
350 FFMPEG_CONFIGURE:= \
351 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
352 LDFLAGS="$(TARGET_LDFLAGS)" \
353 ./configure \
354 --enable-cross-compile \
355 --cross-prefix="$(TARGET_CROSS)" \
356 --arch="$(ARCH)" \
357 --target-os=linux \
358 --prefix="/usr" \
359 --pkg-config="pkg-config" \
360 --enable-shared \
361 --enable-static \
362 --enable-small \
363 --enable-pthreads \
364 --enable-zlib \
365 --disable-runtime-cpudetect \
366 --disable-doc \
367 --disable-debug \
368 \
369 --enable-gpl \
370 --enable-version3 \
371 \
372 --disable-altivec \
373 --disable-amd3dnow \
374 --disable-amd3dnowext \
375 --disable-mmx \
376 --disable-mmxext \
377 --disable-sse \
378 --disable-sse2 \
379 --disable-sse3 \
380 --disable-ssse3 \
381 --disable-sse4 \
382 --disable-sse42 \
383 --disable-avx \
384 --disable-xop \
385 --disable-fma3 \
386 --disable-fma4 \
387 --disable-avx2 \
388 --disable-vfp \
389 --disable-neon \
390 --disable-inline-asm \
391 --disable-yasm \
392 --disable-mips32r2 \
393 --disable-mipsdspr1 \
394 --disable-mipsdspr2 \
395 --disable-mipsfpu \
396 \
397 --disable-dxva2 \
398 --disable-vaapi \
399 --disable-vda \
400 --disable-vdpau \
401 --disable-outdevs
402
403 ifeq ($(BUILD_VARIANT),custom)
404
405 FFMPEG_ENABLE= \
406 $(foreach c, $(2), \
407 $(if $($(3)_$(c)),--enable-$(1)="$(c)") \
408 )
409
410 FFMPEG_CONFIGURE+= \
411 --disable-programs \
412 --disable-avfilter \
413 --disable-postproc \
414 --disable-swresample \
415 --disable-swscale \
416 --disable-everything \
417 $(call FFMPEG_ENABLE,encoder,$(FFMPEG_CUSTOM_ENCODERS),CONFIG_FFMPEG_CUSTOM_ENCODER) \
418 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_CUSTOM_DECODERS),CONFIG_FFMPEG_CUSTOM_DECODER) \
419 $(call FFMPEG_ENABLE,muxer,$(FFMPEG_CUSTOM_MUXERS),CONFIG_FFMPEG_CUSTOM_MUXER) \
420 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_CUSTOM_DEMUXERS),CONFIG_FFMPEG_CUSTOM_DEMUXER) \
421 $(call FFMPEG_ENABLE,parser,$(FFMPEG_CUSTOM_PARSERS),CONFIG_FFMPEG_CUSTOM_PARSER) \
422 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_CUSTOM_PROTOCOLS),CONFIG_FFMPEG_CUSTOM_PROTOCOL) \
423
424 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm),y)
425 FFMPEG_CONFIGURE+= \
426 --enable-decoder=adpcm_ima_wav \
427 --enable-decoder=adpcm_ima_qt \
428 --enable-decoder=adpcm_ms \
429
430 endif
431
432 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libopus),y)
433 FFMPEG_CONFIGURE+= \
434 --enable-libopus --enable-decoder=libopus \
435
436 endif
437
438 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_speex),y)
439 FFMPEG_CONFIGURE+= \
440 --enable-libspeex --enable-decoder=libspeex \
441
442 endif
443
444 endif
445
446 ifeq ($(BUILD_VARIANT),audio-dec)
447
448 FFMPEG_ENABLE= \
449 $(foreach c, $(2), \
450 --enable-$(1)="$(c)" \
451 )
452
453 FFMPEG_CONFIGURE+= \
454 --disable-programs \
455 --disable-avfilter \
456 --disable-postproc \
457 --disable-swresample \
458 --disable-swscale \
459 --disable-everything \
460 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_AUDIO_DECODERS)) \
461 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_AUDIO_DEMUXERS)) \
462 $(call FFMPEG_ENABLE,parser,$(FFMPEG_AUDIO_PARSERS)) \
463 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_AUDIO_PROTOCOLS)) \
464 --enable-libopus --enable-decoder=libopus \
465 --enable-libspeex --enable-decoder=libspeex \
466 --disable-decoder=pcm_bluray,pcm_dvd \
467
468 endif
469
470 ifeq ($(BUILD_VARIANT),mini)
471
472 FFMPEG_ENABLE= \
473 $(foreach c, $(2), \
474 --enable-$(1)="$(c)" \
475 )
476
477 FFMPEG_CONFIGURE+= \
478 --disable-programs \
479 --disable-avdevice \
480 --disable-avfilter \
481 --disable-postproc \
482 --disable-swresample \
483 --disable-swscale \
484 --disable-everything \
485 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_MINI_DECODERS)) \
486 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_MINI_DEMUXERS)) \
487 $(call FFMPEG_ENABLE,parser,$(FFMPEG_MINI_PARSERS)) \
488 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS)) \
489
490 endif
491
492 ifneq ($(CONFIG_TARGET_x86),)
493 TARGET_CFLAGS += -fomit-frame-pointer
494 endif
495
496 define Build/Configure
497 ( cd $(PKG_BUILD_DIR); $(FFMPEG_CONFIGURE) )
498 endef
499
500 define Build/Compile
501 $(MAKE) -C $(PKG_BUILD_DIR) \
502 DESTDIR="$(PKG_INSTALL_DIR)" \
503 all install
504 endef
505
506 define Build/InstallDev/custom
507 $(INSTALL_DIR) $(1)/usr/include
508 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avformat,avutil} $(1)/usr/include/
509 $(INSTALL_DIR) $(1)/usr/lib
510 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.{a,so*} $(1)/usr/lib/
511 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
512 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
513 endef
514
515 define Build/InstallDev/full
516 $(INSTALL_DIR) $(1)/usr/include
517 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale} $(1)/usr/include/
518 $(INSTALL_DIR) $(1)/usr/lib
519 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.{a,so*} $(1)/usr/lib/
520 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
521 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.pc $(1)/usr/lib/pkgconfig/
522 endef
523
524 define Build/InstallDev/mini
525 $(INSTALL_DIR) $(1)/usr/include
526 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avformat,avutil} $(1)/usr/include/
527 $(INSTALL_DIR) $(1)/usr/lib
528 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.{a,so*} $(1)/usr/lib/
529 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
530 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
531 endef
532
533 Build/InstallDev/audio-dec = $(Build/InstallDev/custom)
534
535 # XXX: attempt at installing "best" dev files available
536 ifeq ($(BUILD_VARIANT),custom)
537 # XXX: only install "custom" dev files if -full & -mini are not selected
538 ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
539 Build/InstallDev = $(Build/InstallDev/custom)
540 endif
541 endif
542 ifeq ($(BUILD_VARIANT),audio-dec)
543 # XXX: only install "audio-dec" dev files if -full & -mini are not selected
544 ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
545 Build/InstallDev = $(Build/InstallDev/audio-dec)
546 endif
547 endif
548 ifeq ($(BUILD_VARIANT),full)
549 # XXX: always install "full" dev files if -full is selected
550 Build/InstallDev = $(Build/InstallDev/full)
551 endif
552 ifeq ($(BUILD_VARIANT),mini)
553 # XXX: only install "mini" dev files if -full is not selected
554 ifeq ($(CONFIG_PACKAGE_libffmpeg-full),)
555 Build/InstallDev = $(Build/InstallDev/mini)
556 endif
557 endif
558
559 define Package/ffmpeg/install
560 $(INSTALL_DIR) $(1)/usr/bin
561 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffmpeg $(1)/usr/bin/
562 endef
563
564 define Package/ffprobe/install
565 $(INSTALL_DIR) $(1)/usr/bin
566 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffprobe $(1)/usr/bin/
567 endef
568
569 define Package/ffserver/install
570 $(INSTALL_DIR) $(1)/usr/bin
571 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffserver $(1)/usr/bin/
572 endef
573
574 define Package/libffmpeg-custom/install
575 $(INSTALL_DIR) $(1)/usr/lib
576 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/
577 endef
578
579 define Package/libffmpeg-full/install
580 $(INSTALL_DIR) $(1)/usr/lib
581 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.so.* $(1)/usr/lib/
582 endef
583
584 define Package/libffmpeg-mini/install
585 $(INSTALL_DIR) $(1)/usr/lib
586 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.so.* $(1)/usr/lib/
587 endef
588
589 Package/libffmpeg-audio-dec/install = $(Package/libffmpeg-custom/install)
590
591 $(eval $(call BuildPackage,ffmpeg))
592 $(eval $(call BuildPackage,ffprobe))
593 $(eval $(call BuildPackage,ffserver))
594 $(eval $(call BuildPackage,libffmpeg-custom))
595 $(eval $(call BuildPackage,libffmpeg-full))
596 $(eval $(call BuildPackage,libffmpeg-mini))
597 $(eval $(call BuildPackage,libffmpeg-audio-dec))