usbip: move to github (closes #1259)
[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.6.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:=e2cc3c209f91393d35ab58598e41cf22
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 icecast 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 icecast 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-lzma \
399 --disable-vaapi \
400 --disable-vda \
401 --disable-vdpau \
402 --disable-outdevs
403
404 ifeq ($(BUILD_VARIANT),custom)
405
406 FFMPEG_ENABLE= \
407 $(foreach c, $(2), \
408 $(if $($(3)_$(c)),--enable-$(1)="$(c)") \
409 )
410
411 FFMPEG_CONFIGURE+= \
412 --disable-programs \
413 --disable-avfilter \
414 --disable-postproc \
415 --disable-swresample \
416 --disable-swscale \
417 --disable-everything \
418 $(call FFMPEG_ENABLE,encoder,$(FFMPEG_CUSTOM_ENCODERS),CONFIG_FFMPEG_CUSTOM_ENCODER) \
419 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_CUSTOM_DECODERS),CONFIG_FFMPEG_CUSTOM_DECODER) \
420 $(call FFMPEG_ENABLE,muxer,$(FFMPEG_CUSTOM_MUXERS),CONFIG_FFMPEG_CUSTOM_MUXER) \
421 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_CUSTOM_DEMUXERS),CONFIG_FFMPEG_CUSTOM_DEMUXER) \
422 $(call FFMPEG_ENABLE,parser,$(FFMPEG_CUSTOM_PARSERS),CONFIG_FFMPEG_CUSTOM_PARSER) \
423 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_CUSTOM_PROTOCOLS),CONFIG_FFMPEG_CUSTOM_PROTOCOL) \
424
425 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm),y)
426 FFMPEG_CONFIGURE+= \
427 --enable-decoder=adpcm_ima_wav \
428 --enable-decoder=adpcm_ima_qt \
429 --enable-decoder=adpcm_ms \
430
431 endif
432
433 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libopus),y)
434 FFMPEG_CONFIGURE+= \
435 --enable-libopus --enable-decoder=libopus \
436
437 endif
438
439 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_speex),y)
440 FFMPEG_CONFIGURE+= \
441 --enable-libspeex --enable-decoder=libspeex \
442
443 endif
444
445 endif
446
447 ifeq ($(BUILD_VARIANT),audio-dec)
448
449 FFMPEG_ENABLE= \
450 $(foreach c, $(2), \
451 --enable-$(1)="$(c)" \
452 )
453
454 FFMPEG_CONFIGURE+= \
455 --disable-programs \
456 --disable-avfilter \
457 --disable-postproc \
458 --disable-swresample \
459 --disable-swscale \
460 --disable-everything \
461 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_AUDIO_DECODERS)) \
462 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_AUDIO_DEMUXERS)) \
463 $(call FFMPEG_ENABLE,parser,$(FFMPEG_AUDIO_PARSERS)) \
464 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_AUDIO_PROTOCOLS)) \
465 --enable-libopus --enable-decoder=libopus \
466 --enable-libspeex --enable-decoder=libspeex \
467 --disable-decoder=pcm_bluray,pcm_dvd \
468
469 endif
470
471 ifeq ($(BUILD_VARIANT),mini)
472
473 FFMPEG_ENABLE= \
474 $(foreach c, $(2), \
475 --enable-$(1)="$(c)" \
476 )
477
478 FFMPEG_CONFIGURE+= \
479 --disable-programs \
480 --disable-avdevice \
481 --disable-avfilter \
482 --disable-postproc \
483 --disable-swresample \
484 --disable-swscale \
485 --disable-everything \
486 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_MINI_DECODERS)) \
487 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_MINI_DEMUXERS)) \
488 $(call FFMPEG_ENABLE,parser,$(FFMPEG_MINI_PARSERS)) \
489 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS)) \
490
491 endif
492
493 ifneq ($(CONFIG_TARGET_x86),)
494 TARGET_CFLAGS += -fomit-frame-pointer
495 endif
496
497 define Build/Configure
498 ( cd $(PKG_BUILD_DIR); $(FFMPEG_CONFIGURE) )
499 endef
500
501 define Build/Compile
502 $(MAKE) -C $(PKG_BUILD_DIR) \
503 DESTDIR="$(PKG_INSTALL_DIR)" \
504 all install
505 endef
506
507 define Build/InstallDev/custom
508 $(INSTALL_DIR) $(1)/usr/include
509 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avformat,avutil} $(1)/usr/include/
510 $(INSTALL_DIR) $(1)/usr/lib
511 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.{a,so*} $(1)/usr/lib/
512 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
513 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
514 endef
515
516 define Build/InstallDev/full
517 $(INSTALL_DIR) $(1)/usr/include
518 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale} $(1)/usr/include/
519 $(INSTALL_DIR) $(1)/usr/lib
520 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.{a,so*} $(1)/usr/lib/
521 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
522 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.pc $(1)/usr/lib/pkgconfig/
523 endef
524
525 define Build/InstallDev/mini
526 $(INSTALL_DIR) $(1)/usr/include
527 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avformat,avutil} $(1)/usr/include/
528 $(INSTALL_DIR) $(1)/usr/lib
529 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.{a,so*} $(1)/usr/lib/
530 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
531 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
532 endef
533
534 Build/InstallDev/audio-dec = $(Build/InstallDev/custom)
535
536 # XXX: attempt at installing "best" dev files available
537 ifeq ($(BUILD_VARIANT),custom)
538 # XXX: only install "custom" dev files if -full & -mini are not selected
539 ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
540 Build/InstallDev = $(Build/InstallDev/custom)
541 endif
542 endif
543 ifeq ($(BUILD_VARIANT),audio-dec)
544 # XXX: only install "audio-dec" dev files if -full & -mini are not selected
545 ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
546 Build/InstallDev = $(Build/InstallDev/audio-dec)
547 endif
548 endif
549 ifeq ($(BUILD_VARIANT),full)
550 # XXX: always install "full" dev files if -full is selected
551 Build/InstallDev = $(Build/InstallDev/full)
552 endif
553 ifeq ($(BUILD_VARIANT),mini)
554 # XXX: only install "mini" dev files if -full is not selected
555 ifeq ($(CONFIG_PACKAGE_libffmpeg-full),)
556 Build/InstallDev = $(Build/InstallDev/mini)
557 endif
558 endif
559
560 define Package/ffmpeg/install
561 $(INSTALL_DIR) $(1)/usr/bin
562 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffmpeg $(1)/usr/bin/
563 endef
564
565 define Package/ffprobe/install
566 $(INSTALL_DIR) $(1)/usr/bin
567 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffprobe $(1)/usr/bin/
568 endef
569
570 define Package/ffserver/install
571 $(INSTALL_DIR) $(1)/usr/bin
572 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffserver $(1)/usr/bin/
573 endef
574
575 define Package/libffmpeg-custom/install
576 $(INSTALL_DIR) $(1)/usr/lib
577 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/
578 endef
579
580 define Package/libffmpeg-full/install
581 $(INSTALL_DIR) $(1)/usr/lib
582 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.so.* $(1)/usr/lib/
583 endef
584
585 define Package/libffmpeg-mini/install
586 $(INSTALL_DIR) $(1)/usr/lib
587 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.so.* $(1)/usr/lib/
588 endef
589
590 Package/libffmpeg-audio-dec/install = $(Package/libffmpeg-custom/install)
591
592 $(eval $(call BuildPackage,ffmpeg))
593 $(eval $(call BuildPackage,ffprobe))
594 $(eval $(call BuildPackage,ffserver))
595 $(eval $(call BuildPackage,libffmpeg-custom))
596 $(eval $(call BuildPackage,libffmpeg-full))
597 $(eval $(call BuildPackage,libffmpeg-mini))
598 $(eval $(call BuildPackage,libffmpeg-audio-dec))