libmicrohttpd: build parallel
[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.7.2
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:=7eb2140bab9f0a8669b65b50c8e4cfb5
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 opus \
166 pcm_* \
167 vorbis \
168 wavpack \
169 wmav1 \
170 wmav2 \
171 wmalossless \
172 wmapro \
173 zlib \
174
175 FFMPEG_AUDIO_DEMUXERS:= \
176 aac \
177 ac3 \
178 aiff \
179 amr \
180 ape \
181 avi \
182 flac \
183 ffm \
184 matroska \
185 mp3 \
186 mov \
187 mpc \
188 mpc8 \
189 mpegts \
190 ogg \
191 rm \
192 rtsp \
193 rtp \
194 sdp \
195 wav \
196 wv \
197
198 FFMPEG_AUDIO_PARSERS:= \
199 aac \
200 aac_latm \
201 ac3 \
202 flac \
203 mpegaudio \
204 opus \
205
206 FFMPEG_AUDIO_PROTOCOLS:= \
207 file http icecast rtp tcp udp
208
209
210 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
211
212 PKG_CONFIG_DEPENDS:= \
213 $(patsubst %,CONFIG_FFMPEG_CUSTOM_ENCODER_%,$(FFMPEG_CUSTOM_ENCODERS)) \
214 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DECODER_%,$(FFMPEG_CUSTOM_DECODERS)) \
215 $(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
216 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DEMUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
217 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PARSER_%,$(FFMPEG_CUSTOM_PARSERS)) \
218 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PROTOCOL_%,$(FFMPEG_CUSTOM_PROTOCOLS))
219
220 include $(INCLUDE_DIR)/package.mk
221
222 define Package/ffmpeg/Default
223 TITLE:=FFmpeg
224 URL:=http://ffmpeg.mplayerhq.hu/
225 endef
226
227 define Package/ffmpeg/Default/description
228 FFmpeg is a a software package that can record, convert and stream digital
229 audio and video in numerous formats.
230 endef
231
232
233 define Package/ffmpeg
234 $(call Package/ffmpeg/Default)
235 SECTION:=multimedia
236 CATEGORY:=Multimedia
237 TITLE+= program
238 DEPENDS+= +libpthread +libffmpeg-full
239 VARIANT:=full
240 endef
241
242 define Package/ffmpeg/description
243 $(call Package/ffmpeg/Default/description)
244 .
245 This package contains the FFmpeg command line tool.
246 endef
247
248
249 define Package/ffprobe
250 $(call Package/ffmpeg/Default)
251 SECTION:=multimedia
252 CATEGORY:=Multimedia
253 TITLE+= CLI media identifier
254 DEPENDS+= +libffmpeg-full
255 VARIANT:=full
256 endef
257
258 define Package/ffprobe/description
259 $(call Package/ffmpeg/Default/description)
260 .
261 This package contains the FFprobe command line tool.
262 endef
263
264
265 define Package/ffserver
266 $(call Package/ffserver/Default)
267 SECTION:=multimedia
268 CATEGORY:=Multimedia
269 TITLE+= streaming server
270 DEPENDS+= +libpthread +libffmpeg-full
271 VARIANT:=full
272 endef
273
274 define Package/ffserver/description
275 $(call Package/ffmpeg/Default/description)
276 .
277 This package contains the FFmpeg streaming server.
278 endef
279
280
281 define Package/libffmpeg/Default
282 $(call Package/ffmpeg/Default)
283 SECTION:=libs
284 CATEGORY:=Libraries
285 TITLE+= libraries
286 DEPENDS+= +libpthread +zlib +libbz2
287 PROVIDES:= libffmpeg
288 endef
289
290
291 define Package/libffmpeg-custom
292 $(call Package/libffmpeg/Default)
293 TITLE+= (custom)
294 DEPENDS+= @DEVEL @!ALL +libopus +libspeex
295 VARIANT:=custom
296 MENU:=1
297 endef
298
299 define Package/libffmpeg-custom/config
300 source "$(SOURCE)/Config.in"
301 endef
302
303 define Package/libffmpeg-custom/description
304 $(call Package/ffmpeg/Default/description)
305 .
306 This package contains customized FFmpeg shared libraries.
307 endef
308
309
310 define Package/libffmpeg-audio-dec
311 $(call Package/libffmpeg/Default)
312 TITLE+= (audio)
313 DEPENDS+= @BUILD_PATENTED +libspeex
314 VARIANT:=audio-dec
315 endef
316
317 define Package/libffmpeg-audio-dec/description
318 $(call Package/ffmpeg/Default/description)
319 .
320 This package contains FFmpeg shared libraries for audio decoding
321 endef
322
323
324 define Package/libffmpeg-full
325 $(call Package/libffmpeg/Default)
326 TITLE+= (full)
327 DEPENDS+= @BUILD_PATENTED +alsa-lib
328 VARIANT:=full
329 endef
330
331 define Package/libffmpeg-full/description
332 $(call Package/ffmpeg/Default/description)
333 .
334 This package contains full-featured FFmpeg shared libraries.
335 endef
336
337
338 define Package/libffmpeg-mini
339 $(call Package/libffmpeg/Default)
340 TITLE+= (mini)
341 DEPENDS+= @BUILD_PATENTED
342 VARIANT:=mini
343 endef
344
345 define Package/libffmpeg-mini/description
346 $(call Package/ffmpeg/Default/description)
347 .
348 This package contains minimal-featured FFmpeg shared libraries.
349 endef
350
351
352 FFMPEG_CONFIGURE:= \
353 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
354 LDFLAGS="$(TARGET_LDFLAGS)" \
355 ./configure \
356 --enable-cross-compile \
357 --cross-prefix="$(TARGET_CROSS)" \
358 --arch="$(ARCH)" \
359 --target-os=linux \
360 --prefix="/usr" \
361 --pkg-config="pkg-config" \
362 --enable-shared \
363 --enable-static \
364 --enable-small \
365 --enable-pthreads \
366 --enable-zlib \
367 --disable-runtime-cpudetect \
368 --disable-doc \
369 --disable-debug \
370 \
371 --enable-gpl \
372 --enable-version3 \
373 \
374 --disable-altivec \
375 --disable-amd3dnow \
376 --disable-amd3dnowext \
377 --disable-mmx \
378 --disable-mmxext \
379 --disable-sse \
380 --disable-sse2 \
381 --disable-sse3 \
382 --disable-ssse3 \
383 --disable-sse4 \
384 --disable-sse42 \
385 --disable-avx \
386 --disable-xop \
387 --disable-fma3 \
388 --disable-fma4 \
389 --disable-avx2 \
390 --disable-vfp \
391 --disable-neon \
392 --disable-inline-asm \
393 --disable-yasm \
394 --disable-mips32r2 \
395 --disable-mipsdspr1 \
396 --disable-mipsdspr2 \
397 --disable-mipsfpu \
398 \
399 --disable-dxva2 \
400 --disable-lzma \
401 --disable-vaapi \
402 --disable-vda \
403 --disable-vdpau \
404 --disable-outdevs
405
406 ifeq ($(BUILD_VARIANT),custom)
407
408 FFMPEG_ENABLE= \
409 $(foreach c, $(2), \
410 $(if $($(3)_$(c)),--enable-$(1)="$(c)") \
411 )
412
413 FFMPEG_CONFIGURE+= \
414 --disable-programs \
415 --disable-avfilter \
416 --disable-postproc \
417 --disable-swresample \
418 --disable-swscale \
419 --disable-everything \
420 $(call FFMPEG_ENABLE,encoder,$(FFMPEG_CUSTOM_ENCODERS),CONFIG_FFMPEG_CUSTOM_ENCODER) \
421 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_CUSTOM_DECODERS),CONFIG_FFMPEG_CUSTOM_DECODER) \
422 $(call FFMPEG_ENABLE,muxer,$(FFMPEG_CUSTOM_MUXERS),CONFIG_FFMPEG_CUSTOM_MUXER) \
423 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_CUSTOM_DEMUXERS),CONFIG_FFMPEG_CUSTOM_DEMUXER) \
424 $(call FFMPEG_ENABLE,parser,$(FFMPEG_CUSTOM_PARSERS),CONFIG_FFMPEG_CUSTOM_PARSER) \
425 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_CUSTOM_PROTOCOLS),CONFIG_FFMPEG_CUSTOM_PROTOCOL) \
426
427 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm),y)
428 FFMPEG_CONFIGURE+= \
429 --enable-decoder=adpcm_ima_wav \
430 --enable-decoder=adpcm_ima_qt \
431 --enable-decoder=adpcm_ms \
432
433 endif
434
435 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libopus),y)
436 FFMPEG_CONFIGURE+= \
437 --enable-libopus --enable-decoder=libopus \
438
439 endif
440
441 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_speex),y)
442 FFMPEG_CONFIGURE+= \
443 --enable-libspeex --enable-decoder=libspeex \
444
445 endif
446
447 endif
448
449 ifeq ($(BUILD_VARIANT),audio-dec)
450
451 FFMPEG_ENABLE= \
452 $(foreach c, $(2), \
453 --enable-$(1)="$(c)" \
454 )
455
456 FFMPEG_CONFIGURE+= \
457 --disable-programs \
458 --disable-avfilter \
459 --disable-postproc \
460 --disable-swresample \
461 --disable-swscale \
462 --disable-everything \
463 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_AUDIO_DECODERS)) \
464 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_AUDIO_DEMUXERS)) \
465 $(call FFMPEG_ENABLE,parser,$(FFMPEG_AUDIO_PARSERS)) \
466 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_AUDIO_PROTOCOLS)) \
467 --enable-libspeex --enable-decoder=libspeex \
468 --disable-decoder=pcm_bluray,pcm_dvd \
469
470 endif
471
472 ifeq ($(BUILD_VARIANT),mini)
473
474 FFMPEG_ENABLE= \
475 $(foreach c, $(2), \
476 --enable-$(1)="$(c)" \
477 )
478
479 FFMPEG_CONFIGURE+= \
480 --disable-programs \
481 --disable-avdevice \
482 --disable-avfilter \
483 --disable-postproc \
484 --disable-swresample \
485 --disable-swscale \
486 --disable-everything \
487 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_MINI_DECODERS)) \
488 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_MINI_DEMUXERS)) \
489 $(call FFMPEG_ENABLE,parser,$(FFMPEG_MINI_PARSERS)) \
490 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS)) \
491
492 endif
493
494 ifneq ($(CONFIG_TARGET_x86),)
495 TARGET_CFLAGS += -fomit-frame-pointer
496 endif
497
498 define Build/Configure
499 ( cd $(PKG_BUILD_DIR); $(FFMPEG_CONFIGURE) )
500 endef
501
502 define Build/Compile
503 $(MAKE) -C $(PKG_BUILD_DIR) \
504 DESTDIR="$(PKG_INSTALL_DIR)" \
505 all install
506 endef
507
508 define Build/InstallDev/custom
509 $(INSTALL_DIR) $(1)/usr/include
510 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avformat,avutil} $(1)/usr/include/
511 $(INSTALL_DIR) $(1)/usr/lib
512 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.{a,so*} $(1)/usr/lib/
513 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
514 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
515 endef
516
517 define Build/InstallDev/full
518 $(INSTALL_DIR) $(1)/usr/include
519 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale} $(1)/usr/include/
520 $(INSTALL_DIR) $(1)/usr/lib
521 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.{a,so*} $(1)/usr/lib/
522 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
523 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.pc $(1)/usr/lib/pkgconfig/
524 endef
525
526 define Build/InstallDev/mini
527 $(INSTALL_DIR) $(1)/usr/include
528 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avformat,avutil} $(1)/usr/include/
529 $(INSTALL_DIR) $(1)/usr/lib
530 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.{a,so*} $(1)/usr/lib/
531 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
532 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
533 endef
534
535 Build/InstallDev/audio-dec = $(Build/InstallDev/custom)
536
537 # XXX: attempt at installing "best" dev files available
538 ifeq ($(BUILD_VARIANT),custom)
539 # XXX: only install "custom" dev files if -full & -mini are not selected
540 ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
541 Build/InstallDev = $(Build/InstallDev/custom)
542 endif
543 endif
544 ifeq ($(BUILD_VARIANT),audio-dec)
545 # XXX: only install "audio-dec" dev files if -full & -mini are not selected
546 ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
547 Build/InstallDev = $(Build/InstallDev/audio-dec)
548 endif
549 endif
550 ifeq ($(BUILD_VARIANT),full)
551 # XXX: always install "full" dev files if -full is selected
552 Build/InstallDev = $(Build/InstallDev/full)
553 endif
554 ifeq ($(BUILD_VARIANT),mini)
555 # XXX: only install "mini" dev files if -full is not selected
556 ifeq ($(CONFIG_PACKAGE_libffmpeg-full),)
557 Build/InstallDev = $(Build/InstallDev/mini)
558 endif
559 endif
560
561 define Package/ffmpeg/install
562 $(INSTALL_DIR) $(1)/usr/bin
563 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffmpeg $(1)/usr/bin/
564 endef
565
566 define Package/ffprobe/install
567 $(INSTALL_DIR) $(1)/usr/bin
568 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffprobe $(1)/usr/bin/
569 endef
570
571 define Package/ffserver/install
572 $(INSTALL_DIR) $(1)/usr/bin
573 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffserver $(1)/usr/bin/
574 endef
575
576 define Package/libffmpeg-custom/install
577 $(INSTALL_DIR) $(1)/usr/lib
578 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/
579 endef
580
581 define Package/libffmpeg-full/install
582 $(INSTALL_DIR) $(1)/usr/lib
583 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.so.* $(1)/usr/lib/
584 endef
585
586 define Package/libffmpeg-mini/install
587 $(INSTALL_DIR) $(1)/usr/lib
588 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.so.* $(1)/usr/lib/
589 endef
590
591 Package/libffmpeg-audio-dec/install = $(Package/libffmpeg-custom/install)
592
593 $(eval $(call BuildPackage,ffmpeg))
594 $(eval $(call BuildPackage,ffprobe))
595 $(eval $(call BuildPackage,ffserver))
596 $(eval $(call BuildPackage,libffmpeg-custom))
597 $(eval $(call BuildPackage,libffmpeg-full))
598 $(eval $(call BuildPackage,libffmpeg-mini))
599 $(eval $(call BuildPackage,libffmpeg-audio-dec))