ffmpeg: remove libavdevice from the libffmpeg-mini variant
[feed/packages.git] / multimedia / ffmpeg / Makefile
1 #
2 # Copyright (C) 2006-2014 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:=0.11.5
12 PKG_RELEASE:=5
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://ffmpeg.org/releases/
16 PKG_MD5SUM:=ea25fc252c132141f12988ed5506bfe8
17 PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
18
19 PKG_LICENSE:=LGPLv2.1+ GPLv2+ LGPLv3
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_ENCODERS:= \
114
115 FFMPEG_MINI_DECODERS:= \
116 aac \
117 ac3 \
118 atrac3 \
119 flac \
120 h263 \
121 h264 \
122 jpegls \
123 mp3 \
124 mpeg1video \
125 mpeg2video \
126 mpeg4 \
127 mpegvideo \
128 png \
129 wmav1 \
130 wmav2 \
131
132 FFMPEG_MINI_MUXERS:= \
133 ffm \
134
135 FFMPEG_MINI_DEMUXERS := \
136 aac \
137 ac3 \
138 asf \
139 avi \
140 ffm \
141 flac \
142 h264 \
143 matroska \
144 mov \
145 mp3 \
146 mpegts \
147 mpegvideo \
148 sdp \
149 rtsp \
150
151 FFMPEG_MINI_PARSERS:= \
152 ac3 \
153 flac \
154 h263 \
155 h264 \
156 mpeg4video \
157 mpegaudio \
158
159 FFMPEG_MINI_PROTOCOLS := \
160 file http rtp tcp udp \
161
162 FFMPEG_AUDIO_DECODERS:= \
163 aac \
164 aac_latm \
165 ac3 \
166 adpcm_* \
167 alac \
168 amrnb \
169 amrwb \
170 ape \
171 atrac3 \
172 flac \
173 mp2 \
174 mp3* \
175 mpc7 \
176 mpc8 \
177 pcm_* \
178 vorbis \
179 wavpack \
180 wmav1 \
181 wmav2 \
182 wmalossless \
183 wmapro \
184 zlib \
185
186 FFMPEG_AUDIO_DEMUXERS:= \
187 aac \
188 ac3 \
189 aiff \
190 amr \
191 ape \
192 avi \
193 flac \
194 ffm \
195 matroska \
196 mp3 \
197 mov \
198 mpc \
199 mpc8 \
200 mpegts \
201 ogg \
202 rm \
203 rtsp \
204 rtp \
205 sdp \
206 wav \
207 wv \
208
209 FFMPEG_AUDIO_PARSERS:= \
210 aac \
211 aac_latm \
212 flac \
213 ac3 \
214 mpegaudio \
215
216 FFMPEG_AUDIO_PROTOCOLS:= \
217 file http rtp tcp udp
218
219
220 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
221
222 PKG_CONFIG_DEPENDS:= \
223 $(patsubst %,CONFIG_FFMPEG_CUSTOM_ENCODER_%,$(FFMPEG_CUSTOM_ENCODERS)) \
224 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DECODER_%,$(FFMPEG_CUSTOM_DECODERS)) \
225 $(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
226 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DEMUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
227 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PARSER_%,$(FFMPEG_CUSTOM_PARSERS)) \
228 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PROTOCOL_%,$(FFMPEG_CUSTOM_PROTOCOLS))
229
230 include $(INCLUDE_DIR)/package.mk
231
232 define Package/ffmpeg/Default
233 TITLE:=FFmpeg
234 URL:=http://ffmpeg.mplayerhq.hu/
235 endef
236
237 define Package/ffmpeg/Default/description
238 FFmpeg is a a software package that can record, convert and stream digital
239 audio and video in numerous formats.
240 endef
241
242
243 define Package/ffmpeg
244 $(call Package/ffmpeg/Default)
245 SECTION:=multimedia
246 CATEGORY:=Multimedia
247 TITLE+= program
248 DEPENDS+= +libpthread +libffmpeg-full
249 VARIANT:=full
250 endef
251
252 define Package/ffmpeg/description
253 $(call Package/ffmpeg/Default/description)
254 .
255 This package contains the FFmpeg command line tool.
256 endef
257
258
259 define Package/ffprobe
260 $(call Package/ffmpeg/Default)
261 SECTION:=multimedia
262 CATEGORY:=Multimedia
263 TITLE+= CLI media identifier
264 DEPENDS+= +libffmpeg-full
265 VARIANT:=full
266 endef
267
268 define Package/ffprobe/description
269 $(call Package/ffmpeg/Default/description)
270 .
271 This package contains the FFprobe command line tool.
272 endef
273
274
275 define Package/ffserver
276 $(call Package/ffserver/Default)
277 SECTION:=multimedia
278 CATEGORY:=Multimedia
279 TITLE+= streaming server
280 DEPENDS+= +libpthread +libffmpeg-full
281 VARIANT:=full
282 endef
283
284 define Package/ffserver/description
285 $(call Package/ffmpeg/Default/description)
286 .
287 This package contains the FFmpeg streaming server.
288 endef
289
290
291 define Package/libffmpeg/Default
292 $(call Package/ffmpeg/Default)
293 SECTION:=libs
294 CATEGORY:=Libraries
295 TITLE+= libraries
296 DEPENDS+= +libpthread +zlib +libbz2
297 PROVIDES:= libffmpeg
298 endef
299
300
301 define Package/libffmpeg-custom
302 $(call Package/libffmpeg/Default)
303 TITLE+= (custom)
304 DEPENDS+= @DEVEL +libspeex
305 VARIANT:=custom
306 MENU:=1
307 endef
308
309 define Package/libffmpeg-custom/config
310 source "$(SOURCE)/Config.in"
311 endef
312
313 define Package/libffmpeg-custom/description
314 $(call Package/ffmpeg/Default/description)
315 .
316 This package contains customized FFmpeg shared libraries.
317 endef
318
319
320 define Package/libffmpeg-audio-dec
321 $(call Package/libffmpeg/Default)
322 TITLE+= (audio)
323 DEPENDS+= @DEVEL +libspeex
324 VARIANT:=audio-dec
325 endef
326
327 define Package/libffmpeg-audio-dec/description
328 $(call Package/ffmpeg/Default/description)
329 .
330 This package contains FFmpeg shared libraries for audio decoding
331 endef
332
333
334 define Package/libffmpeg-full
335 $(call Package/libffmpeg/Default)
336 TITLE+= (full)
337 DEPENDS+= @BUILD_PATENTED +alsa-lib
338 VARIANT:=full
339 endef
340
341 define Package/libffmpeg-full/description
342 $(call Package/ffmpeg/Default/description)
343 .
344 This package contains full-featured FFmpeg shared libraries.
345 endef
346
347
348 define Package/libffmpeg-mini
349 $(call Package/libffmpeg/Default)
350 TITLE+= (mini)
351 DEPENDS+= @BUILD_PATENTED
352 VARIANT:=mini
353 endef
354
355 define Package/libffmpeg-mini/description
356 $(call Package/ffmpeg/Default/description)
357 .
358 This package contains minimal-featured FFmpeg shared libraries.
359 endef
360
361
362 FFMPEG_CONFIGURE:= \
363 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
364 LDFLAGS="$(TARGET_LDFLAGS)" \
365 ./configure \
366 --enable-cross-compile \
367 --cross-prefix="$(TARGET_CROSS)" \
368 --arch="$(ARCH)" \
369 --target-os=linux \
370 --prefix="/usr" \
371 --enable-shared \
372 --enable-static \
373 --disable-debug \
374 --pkg-config="pkg-config" \
375 \
376 --enable-gpl \
377 --enable-version3 \
378 \
379 --disable-altivec \
380 --disable-asm \
381 --disable-doc \
382 --disable-dxva2 \
383 --enable-pthreads \
384 --disable-optimizations \
385 --enable-small \
386 --disable-stripping \
387 --enable-zlib \
388 --disable-outdevs
389
390 ifeq ($(BUILD_VARIANT),custom)
391
392 FFMPEG_ENABLE= \
393 $(foreach c, $(2), \
394 $(if $($(3)_$(c)),--enable-$(1)="$(c)") \
395 )
396
397 FFMPEG_CONFIGURE+= \
398 --disable-ffmpeg \
399 --disable-ffplay \
400 --disable-ffprobe \
401 --disable-ffserver \
402 --disable-avfilter \
403 --disable-postproc \
404 --disable-swresample \
405 --disable-swscale \
406 --disable-everything \
407 $(call FFMPEG_ENABLE,encoder,$(FFMPEG_CUSTOM_ENCODERS),CONFIG_FFMPEG_CUSTOM_ENCODER) \
408 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_CUSTOM_DECODERS),CONFIG_FFMPEG_CUSTOM_DECODER) \
409 $(call FFMPEG_ENABLE,muxer,$(FFMPEG_CUSTOM_MUXERS),CONFIG_FFMPEG_CUSTOM_MUXER) \
410 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_CUSTOM_DEMUXERS),CONFIG_FFMPEG_CUSTOM_DEMUXER) \
411 $(call FFMPEG_ENABLE,parser,$(FFMPEG_CUSTOM_PARSERS),CONFIG_FFMPEG_CUSTOM_PARSER) \
412 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_CUSTOM_PROTOCOLS),CONFIG_FFMPEG_CUSTOM_PROTOCOL) \
413
414 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm),y)
415 FFMPEG_CONFIGURE+= \
416 --enable-decoder=adpcm_ima_wav \
417 --enable-decoder=adpcm_ima_qt \
418 --enable-decoder=adpcm_ms \
419
420 endif
421
422 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_speex),y)
423 FFMPEG_CONFIGURE+= \
424 --enable-libspeex --enable-decoder=libspeex \
425
426 endif
427
428 endif
429
430 ifeq ($(BUILD_VARIANT),audio-dec)
431
432 FFMPEG_ENABLE= \
433 $(foreach c, $(2), \
434 --enable-$(1)="$(c)" \
435 )
436
437 FFMPEG_CONFIGURE+= \
438 --disable-ffmpeg \
439 --disable-ffplay \
440 --disable-ffprobe \
441 --disable-ffserver \
442 --disable-avfilter \
443 --disable-postproc \
444 --disable-swresample \
445 --disable-swscale \
446 --disable-everything \
447 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_AUDIO_DECODERS)) \
448 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_AUDIO_DEMUXERS)) \
449 $(call FFMPEG_ENABLE,parser,$(FFMPEG_AUDIO_PARSERS)) \
450 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_AUDIO_PROTOCOLS)) \
451 --enable-libspeex --enable-decoder=libspeex \
452 --disable-decoder=pcm_bluray,pcm_dvd \
453
454 endif
455
456 ifeq ($(BUILD_VARIANT),mini)
457
458 FFMPEG_ENABLE= \
459 $(foreach c, $(2), \
460 --enable-$(1)="$(c)" \
461 )
462
463 FFMPEG_CONFIGURE+= \
464 --disable-ffmpeg \
465 --disable-ffplay \
466 --disable-ffprobe \
467 --disable-ffserver \
468 --disable-avdevice \
469 --disable-avfilter \
470 --disable-postproc \
471 --disable-swresample \
472 --disable-swscale \
473 --disable-everything \
474 $(call FFMPEG_ENABLE,encoder,$(FFMPEG_MINI_ENCODERS)) \
475 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_MINI_DECODERS)) \
476 $(call FFMPEG_ENABLE,muxer,$(FFMPEG_MINI_MUXERS)) \
477 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_MINI_DEMUXERS)) \
478 $(call FFMPEG_ENABLE,parser,$(FFMPEG_MINI_PARSERS)) \
479 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS)) \
480
481 endif
482
483 ifneq ($(CONFIG_TARGET_x86),)
484 TARGET_CFLAGS += -fomit-frame-pointer
485 endif
486
487 define Build/Configure
488 ( cd $(PKG_BUILD_DIR); $(FFMPEG_CONFIGURE) )
489 endef
490
491 define Build/Compile
492 $(MAKE) -C $(PKG_BUILD_DIR) \
493 DESTDIR="$(PKG_INSTALL_DIR)" \
494 all install
495 endef
496
497 define Build/InstallDev/custom
498 $(INSTALL_DIR) $(1)/usr/include
499 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avformat,avutil} $(1)/usr/include/
500 $(INSTALL_DIR) $(1)/usr/lib
501 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.{a,so*} $(1)/usr/lib/
502 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
503 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
504 endef
505
506 define Build/InstallDev/full
507 $(INSTALL_DIR) $(1)/usr/include
508 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale} $(1)/usr/include/
509 $(INSTALL_DIR) $(1)/usr/lib
510 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.{a,so*} $(1)/usr/lib/
511 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
512 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.pc $(1)/usr/lib/pkgconfig/
513 endef
514
515 Build/InstallDev/mini = $(Build/InstallDev/custom)
516 Build/InstallDev/audio-dec = $(Build/InstallDev/custom)
517
518 # XXX: attempt at installing "best" dev files available
519 ifeq ($(BUILD_VARIANT),custom)
520 # XXX: only install "custom" dev files if -full & -mini are not selected
521 ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
522 Build/InstallDev = $(Build/InstallDev/custom)
523 endif
524 endif
525 ifeq ($(BUILD_VARIANT),audio-dec)
526 # XXX: only install "audio-dec" dev files if -full & -mini are not selected
527 ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
528 Build/InstallDev = $(Build/InstallDev/audio-dec)
529 endif
530 endif
531 ifeq ($(BUILD_VARIANT),full)
532 # XXX: always install "full" dev files if -full is selected
533 Build/InstallDev = $(Build/InstallDev/full)
534 endif
535 ifeq ($(BUILD_VARIANT),mini)
536 # XXX: only install "mini" dev files if -full is not selected
537 ifeq ($(CONFIG_PACKAGE_libffmpeg-full),)
538 Build/InstallDev = $(Build/InstallDev/mini)
539 endif
540 endif
541
542 define Package/ffmpeg/install
543 $(INSTALL_DIR) $(1)/usr/bin
544 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffmpeg $(1)/usr/bin/
545 endef
546
547 define Package/ffprobe/install
548 $(INSTALL_DIR) $(1)/usr/bin
549 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffprobe $(1)/usr/bin/
550 endef
551
552 define Package/ffserver/install
553 $(INSTALL_DIR) $(1)/usr/bin
554 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffserver $(1)/usr/bin/
555 endef
556
557 define Package/libffmpeg-custom/install
558 $(INSTALL_DIR) $(1)/usr/lib
559 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/
560 endef
561
562 define Package/libffmpeg-full/install
563 $(INSTALL_DIR) $(1)/usr/lib
564 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.so.* $(1)/usr/lib/
565 endef
566
567 define Package/libffmpeg-mini/install
568 $(INSTALL_DIR) $(1)/usr/lib
569 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.so.* $(1)/usr/lib/
570 endef
571
572 Package/libffmpeg-audio-dec/install = $(Package/libffmpeg-custom/install)
573
574 $(eval $(call BuildPackage,ffmpeg))
575 $(eval $(call BuildPackage,ffprobe))
576 $(eval $(call BuildPackage,ffserver))
577 $(eval $(call BuildPackage,libffmpeg-custom))
578 $(eval $(call BuildPackage,libffmpeg-full))
579 $(eval $(call BuildPackage,libffmpeg-mini))
580 $(eval $(call BuildPackage,libffmpeg-audio-dec))