8de7f10b7b3c1c8a210c46b19664799c134add5e
[feed/packages.git] / multimedia / ffmpeg / Makefile
1 #
2 # Copyright (C) 2017-2020 Ian Leonard <antonlacon@gmail.com>
3 # Copyright (C) 2018 Ted Hess <thess@kitschensync.net>
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=ffmpeg
12 PKG_VERSION:=4.3.5
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
16 PKG_SOURCE_URL:=https://ffmpeg.org/releases/
17 PKG_HASH:=8e7a2f6d94b5130edd82d8b55ae75da5fc02f98698e8cc6772c413223b7b9092
18 PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>, \
19 Ian Leonard <antonlacon@gmail.com>
20
21 PKG_LICENSE:=LGPL-2.1-or-later GPL-2.0-or-later LGPL-3.0-or-later
22 PKG_LICENSE_FILES:=COPYING.GPLv2 COPYING.GPLv3 COPYING.LGPLv2.1 COPYING.LGPLv3
23 PKG_CPE_ID:=cpe:/a:ffmpeg:ffmpeg
24
25 FFMPEG_CUSTOM_ENCODERS:= \
26 ac3 \
27 jpegls \
28 mpeg1video \
29 mpeg2video \
30 mpeg4 \
31 pcm_s16be \
32 pcm_s16le \
33 png \
34 vorbis \
35 zlib \
36
37 FFMPEG_CUSTOM_DECODERS:= \
38 aac \
39 ac3 \
40 alac \
41 amrnb \
42 amrwb \
43 ape \
44 atrac3 \
45 flac \
46 gif \
47 h264 \
48 hevc \
49 jpegls \
50 mp2 \
51 mp3 \
52 mpeg1video \
53 mpeg2video \
54 mpeg4 \
55 mpegvideo \
56 mpc7 \
57 mpc8 \
58 pcm_s16be \
59 pcm_s16le \
60 png \
61 vc1 \
62 vorbis \
63 wavpack \
64 wmav1 \
65 wmav2 \
66 zlib \
67
68 FFMPEG_CUSTOM_MUXERS:= \
69 ac3 \
70 ffm \
71 h264 \
72 hevc \
73 mp3 \
74 mp4 \
75 mpeg1video \
76 mpeg2video \
77 mpegts \
78 ogg \
79 rtp \
80
81 FFMPEG_CUSTOM_DEMUXERS:= \
82 aac \
83 ac3 \
84 amr \
85 ape \
86 avi \
87 flac \
88 ffm \
89 h264 \
90 hevc \
91 matroska \
92 mov \
93 mp3 \
94 mpegps \
95 mpegts \
96 mpegvideo \
97 mpc \
98 mpc8 \
99 ogg \
100 rm \
101 rtsp \
102 rtp \
103 sdp \
104 v4l2 \
105 vc1 \
106 wav \
107 wv \
108
109 FFMPEG_CUSTOM_PARSERS:= \
110 aac \
111 flac \
112 ac3 \
113 h264 \
114 hevc \
115 mpegaudio \
116 mpeg4video \
117 mpegvideo \
118 vc1 \
119
120 FFMPEG_CUSTOM_PROTOCOLS:= \
121 file http icecast pipe rtp tcp udp
122
123 FFMPEG_MINI_DECODERS:= \
124 ac3 \
125 flac \
126 jpegls \
127 mp2 \
128 mp3 \
129 mpeg1video \
130 mpeg2video \
131 mpeg4 \
132 mpegvideo \
133 opus \
134 png \
135 vorbis \
136
137 FFMPEG_PATENTED_MINI_DECODERS:= \
138 h264 \
139 hevc \
140 vc1 \
141
142 FFMPEG_MINI_DEMUXERS:= \
143 avi \
144 flac \
145 matroska \
146 mov \
147 mp3 \
148 mpegps \
149 mpegts \
150 mpegvideo \
151 ogg \
152
153 FFMPEG_MINI_PROTOCOLS:= \
154 file
155
156 FFMPEG_AUDIO_DECODERS:= \
157 ac3 \
158 adpcm_* \
159 alac \
160 amrnb \
161 amrwb \
162 ape \
163 atrac3 \
164 flac \
165 mp2 \
166 mp3* \
167 mpc7 \
168 mpc8 \
169 opus \
170 pcm_* \
171 vorbis \
172 wavpack \
173 zlib \
174
175 FFMPEG_AUDIO_DEMUXERS:= \
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_PROTOCOLS:= \
198 file http icecast rtp tcp udp
199
200 FFMPEG_PATENTED_DECODERS:= \
201 atrac3 \
202 h264 \
203 hevc \
204 vc1 \
205
206 FFMPEG_PATENTED_MUXERS:= \
207 h264 \
208 hevc \
209 vc1 \
210
211 FFMPEG_PATENTED_DEMUXERS:=$(FFMPEG_PATENTED_MUXERS)
212
213 FFMPEG_PATENTED_PARSERS:= \
214 h264 \
215 hevc \
216 vc1 \
217
218 PKG_CONFIG_DEPENDS:= \
219 $(patsubst %,CONFIG_FFMPEG_CUSTOM_ENCODER_%,$(FFMPEG_CUSTOM_ENCODERS)) \
220 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DECODER_%,$(FFMPEG_CUSTOM_DECODERS)) \
221 $(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_%,$(FFMPEG_CUSTOM_MUXERS)) \
222 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DEMUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
223 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PARSER_%,$(FFMPEG_CUSTOM_PARSERS)) \
224 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PROTOCOL_%,$(FFMPEG_CUSTOM_PROTOCOLS))
225
226 include $(INCLUDE_DIR)/package.mk
227
228 define Package/ffmpeg/Default
229 TITLE:=FFmpeg
230 URL:=https://ffmpeg.org/
231 DEPENDS+= +libpthread
232 endef
233
234 define Package/ffmpeg/Default/description
235 FFmpeg is a a software package that can record, convert and stream digital
236 audio and video in numerous formats.
237
238 FFmpeg licensing / patent issues are complex. It is the reponsibility of the
239 user to understand any requirements in this regard with its usage. See:
240 https://ffmpeg.org/legal.html for further information.
241 endef
242
243
244 define Package/ffmpeg
245 $(call Package/ffmpeg/Default)
246 SECTION:=multimedia
247 CATEGORY:=Multimedia
248 TITLE+= program
249 DEPENDS+= +libffmpeg-full
250 VARIANT:=full
251 endef
252
253 define Package/ffmpeg-custom
254 $(call Package/ffmpeg/Default)
255 SECTION:=multimedia
256 CATEGORY:=Multimedia
257 TITLE+= program (custom)
258 DEPENDS+= @!ALL libffmpeg-custom
259 VARIANT:=custom
260 endef
261
262 define Package/ffmpeg/description
263 $(call Package/ffmpeg/Default/description)
264 .
265 This package contains the FFmpeg command line tool.
266 endef
267
268 Package/ffmpeg-custom/description = $(Package/ffmpeg/description)
269
270 define Package/ffprobe
271 $(call Package/ffmpeg/Default)
272 SECTION:=multimedia
273 CATEGORY:=Multimedia
274 TITLE+= CLI media identifier
275 DEPENDS+= +libffmpeg-full
276 VARIANT:=full
277 endef
278
279 define Package/ffprobe-custom
280 $(call Package/ffmpeg/Default)
281 SECTION:=multimedia
282 CATEGORY:=Multimedia
283 TITLE+= CLI media identifier (custom)
284 DEPENDS+= @!ALL libffmpeg-custom
285 VARIANT:=custom
286 endef
287
288 define Package/ffprobe/description
289 $(call Package/ffmpeg/Default/description)
290 .
291 This package contains the FFprobe command line tool.
292 endef
293
294 Package/ffprobe-custom/description = $(Package/ffprobe/description)
295
296 define Package/libffmpeg/Default
297 $(call Package/ffmpeg/Default)
298 SECTION:=libs
299 CATEGORY:=Libraries
300 TITLE+= libraries
301 DEPENDS+= +libpthread +zlib +libbz2
302 PROVIDES:= libffmpeg
303 endef
304
305
306 # Package build suppressed when CONFIG_ALL=y
307 define Package/libffmpeg-custom
308 $(call Package/libffmpeg/Default)
309 TITLE+= (custom)
310 DEPENDS+= @!ALL \
311 +FFMPEG_CUSTOM_SELECT_libopus:libopus \
312 +PACKAGE_libx264:libx264 +PACKAGE_lame-lib:lame-lib \
313 +FFMPEG_CUSTOM_SELECT_libshine:shine \
314 +PACKAGE_fdk-aac:fdk-aac
315 VARIANT:=custom
316 MENU:=1
317 endef
318
319 define Package/libffmpeg-custom/config
320 source "$(SOURCE)/Config.in"
321 endef
322
323 define Package/libffmpeg-custom/description
324 $(call Package/ffmpeg/Default/description)
325 .
326 This package contains customized FFmpeg shared libraries.
327 endef
328
329
330 define Package/libffmpeg-audio-dec
331 $(call Package/libffmpeg/Default)
332 TITLE+= (audio)
333 VARIANT:=audio-dec
334 CONFLICTS:=libffmpeg-full
335 endef
336
337 define Package/libffmpeg-audio-dec/description
338 $(call Package/ffmpeg/Default/description)
339 .
340 This package contains FFmpeg shared libraries for audio decoding
341 endef
342
343
344 define Package/libffmpeg-full
345 $(call Package/libffmpeg/Default)
346 TITLE+= (full)
347 DEPENDS+= +alsa-lib +libgnutls +PACKAGE_libopus:libopus \
348 +SOFT_FLOAT:shine \
349 +!SOFT_FLOAT:lame-lib \
350 +PACKAGE_libx264:libx264 \
351 +!PACKAGE_libx264:fdk-aac
352 VARIANT:=full
353 PROVIDES+=libffmpeg-mini libffmpeg-audio-dec
354 endef
355
356
357 define Package/libffmpeg-full/description
358 $(call Package/ffmpeg/Default/description)
359 .
360 This package contains full-featured FFmpeg shared libraries.
361 endef
362
363
364 define Package/libffmpeg-mini
365 $(call Package/libffmpeg/Default)
366 TITLE+= (mini)
367 VARIANT:=mini
368 CONFLICTS:=libffmpeg-full
369 endef
370
371 define Package/libffmpeg-mini/description
372 $(call Package/ffmpeg/Default/description)
373 .
374 This package contains minimal-featured FFmpeg shared libraries.
375 endef
376
377
378 # Strip off FPU notation
379 REAL_CPU_TYPE:=$(firstword $(subst +, ,$(CONFIG_CPU_TYPE)))
380 # Fixup cpu types recogized by ffmpeg configure
381 REAL_CPU_TYPE:=$(subst octeonplus,octeon+,$(REAL_CPU_TYPE))
382
383 FFMPEG_CONFIGURE:= \
384 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
385 LDFLAGS="$(TARGET_LDFLAGS)" \
386 ./configure \
387 --enable-cross-compile \
388 --cross-prefix="$(TARGET_CROSS)" \
389 --arch="$(ARCH)" \
390 $(if $(REAL_CPU_TYPE),--cpu=$(call qstrip,$(REAL_CPU_TYPE)),) \
391 --target-os=linux \
392 --prefix="/usr" \
393 --pkg-config="pkg-config" \
394 --enable-shared \
395 --enable-static \
396 --enable-pthreads \
397 --enable-zlib \
398 --disable-doc \
399 --disable-debug \
400 \
401 --disable-lzma \
402 --disable-vaapi \
403 --disable-vdpau \
404 --disable-outdevs
405
406 ifeq ($(CONFIG_SOFT_FLOAT),y)
407 FFMPEG_CONFIGURE+= \
408 --disable-altivec \
409 --disable-vsx \
410 --disable-power8 \
411 --disable-armv5te \
412 --disable-armv6 \
413 --disable-armv6t2 \
414 --disable-fast-unaligned \
415 --disable-runtime-cpudetect
416
417 else ifneq ($(findstring arm,$(CONFIG_ARCH))$(findstring aarch64,$(CONFIG_ARCH)),)
418 FFMPEG_CONFIGURE+= \
419 --disable-runtime-cpudetect
420 # XXX: GitHub issue 3320 ppc cpu with fpu but no altivec (WNDR4700)
421 else ifneq ($(findstring powerpc,$(CONFIG_ARCH)),)
422 FFMPEG_CONFIGURE+= \
423 --disable-altivec
424 endif
425
426 # selectively disable optimizations according to arch/cpu type
427 ifneq ($(findstring arm,$(CONFIG_ARCH)),)
428 FFMPEG_CONFIGURE+= --enable-lto
429
430 ifneq ($(findstring vfp,$(CONFIG_CPU_TYPE)),)
431 FFMPEG_CONFIGURE+= --enable-vfp
432 else
433 FFMPEG_CONFIGURE+= --disable-vfp
434 endif
435 ifneq ($(findstring neon,$(CONFIG_CPU_TYPE)),)
436 FFMPEG_CONFIGURE+= \
437 --enable-neon \
438 --enable-vfp
439 else
440 FFMPEG_CONFIGURE+= --disable-neon
441 endif
442 endif
443
444 ifneq ($(findstring aarch64,$(CONFIG_ARCH)),)
445 FFMPEG_CONFIGURE+= \
446 --enable-lto \
447 --enable-neon \
448 --enable-vfp
449 endif
450
451 ifeq ($(ARCH),x86_64)
452 FFMPEG_CONFIGURE+= --enable-lto
453 endif
454
455 ifeq ($(CONFIG_FFMPEG_X86ASM),y)
456 FFMPEG_CONFIGURE += --enable-x86asm
457 else
458 FFMPEG_CONFIGURE += --disable-x86asm
459 endif
460
461 ifeq ($(BUILD_VARIANT),full)
462
463 FFMPEG_DISABLE= \
464 $(foreach c, $(2), \
465 --disable-$(1)="$(c)" \
466 )
467
468 FFMPEG_CONFIGURE+= \
469 --enable-gnutls \
470 $(if $(CONFIG_BUILD_PATENTED),, \
471 $(call FFMPEG_DISABLE,decoder,$(FFMPEG_PATENTED_DECODERS)) \
472 $(call FFMPEG_DISABLE,muxer,$(FFMPEG_PATENTED_MUXERS)) \
473 $(call FFMPEG_DISABLE,demuxer,$(FFMPEG_PATENTED_DEMUXERS)) \
474 $(call FFMPEG_DISABLE,parser,$(FFMPEG_PATENTED_PARSERS))) \
475 $(if $(CONFIG_PACKAGE_libopus),--enable-libopus)
476 ifeq ($(CONFIG_SOFT_FLOAT),y)
477 FFMPEG_CONFIGURE+= \
478 --enable-small \
479 \
480 $(if $(CONFIG_PACKAGE_shine),--enable-libshine)
481 else
482 ifeq ($(ARCH),x86_64)
483 FFMPEG_CONFIGURE+= --enable-hardcoded-tables
484 else
485 FFMPEG_CONFIGURE+= --enable-small
486 endif
487 FFMPEG_CONFIGURE+= $(if $(CONFIG_PACKAGE_lame-lib),--enable-libmp3lame)
488 endif
489 # x264 support and fdk-aac support can't coexist and be distributed.
490 # Prioritize x264 over fdk-aac in default builds (maintain status-quo).
491 ifneq ($(CONFIG_PACKAGE_libx264),)
492 FFMPEG_CONFIGURE+= \
493 --enable-gpl \
494 --enable-libx264
495 else
496 FFMPEG_CONFIGURE+= $(if $(CONFIG_PACKAGE_fdk-aac),--enable-libfdk-aac)
497 endif
498 endif
499
500 ifeq ($(BUILD_VARIANT),custom)
501
502 FFMPEG_ENABLE= \
503 $(foreach c, $(2), \
504 $(if $($(3)_$(c)),--enable-$(1)="$(c)") \
505 )
506
507 ifeq ($(CONFIG_FFMPEG_CUSTOM_LARGE),y)
508 FFMPEG_CONFIGURE+= \
509 --enable-hardcoded-tables
510 else
511 FFMPEG_CONFIGURE+= \
512 --enable-small
513 endif
514
515 ifeq ($(CONFIG_FFMPEG_CUSTOM_GPL),y)
516 FFMPEG_CONFIGURE+= --enable-gpl
517 endif
518
519 ifeq ($(CONFIG_FFMPEG_CUSTOM_GPLV3),y)
520 FFMPEG_CONFIGURE+= --enable-version3
521 endif
522
523 ifeq ($(CONFIG_FFMPEG_CUSTOM_NONFREE),y)
524 FFMPEG_CONFIGURE+= --enable-nonfree
525 endif
526
527 ifneq ($(CONFIG_FFMPEG_CUSTOM_PROGRAMS),y)
528 FFMPEG_CONFIGURE+= \
529 --disable-programs \
530 --disable-avfilter \
531 --disable-swresample
532 endif
533
534 FFMPEG_CONFIGURE+= \
535 --disable-swscale \
536 --disable-everything \
537 $(call FFMPEG_ENABLE,encoder,$(FFMPEG_CUSTOM_ENCODERS),CONFIG_FFMPEG_CUSTOM_ENCODER) \
538 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_CUSTOM_DECODERS),CONFIG_FFMPEG_CUSTOM_DECODER) \
539 $(call FFMPEG_ENABLE,muxer,$(FFMPEG_CUSTOM_MUXERS),CONFIG_FFMPEG_CUSTOM_MUXER) \
540 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_CUSTOM_DEMUXERS),CONFIG_FFMPEG_CUSTOM_DEMUXER) \
541 $(call FFMPEG_ENABLE,parser,$(FFMPEG_CUSTOM_PARSERS),CONFIG_FFMPEG_CUSTOM_PARSER) \
542 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_CUSTOM_PROTOCOLS),CONFIG_FFMPEG_CUSTOM_PROTOCOL) \
543
544 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm),y)
545 FFMPEG_CONFIGURE+= \
546 --enable-decoder=adpcm_ima_wav \
547 --enable-decoder=adpcm_ima_qt \
548 --enable-decoder=adpcm_ms
549 endif
550
551 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libfdk-aac),y)
552 FFMPEG_CONFIGURE+= \
553 --enable-libfdk-aac --enable-encoder=libfdk_aac
554 endif
555
556 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libmp3lame),y)
557 FFMPEG_CONFIGURE+= \
558 --enable-libmp3lame --enable-encoder=libmp3lame
559 endif
560
561 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libopus),y)
562 FFMPEG_CONFIGURE+= \
563 --enable-libopus --enable-decoder=libopus --enable-encoder=libopus
564 endif
565
566 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libshine),y)
567 FFMPEG_CONFIGURE+= \
568 --enable-libshine --enable-encoder=libshine
569 endif
570
571 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264),y)
572 FFMPEG_CONFIGURE+= \
573 --enable-libx264 --enable-encoder=libx264
574 else
575 FFMPEG_CONFIGURE+= --disable-postproc
576 endif
577
578 endif
579
580 ifeq ($(BUILD_VARIANT),audio-dec)
581
582 FFMPEG_ENABLE= \
583 $(foreach c, $(2), \
584 --enable-$(1)="$(c)" \
585 )
586
587 FFMPEG_CONFIGURE+= \
588 --enable-small \
589 --enable-gpl \
590 \
591 --disable-programs \
592 --disable-avfilter \
593 --disable-postproc \
594 --disable-swresample \
595 --disable-swscale \
596 --disable-everything \
597 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_AUDIO_DECODERS)) \
598 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_AUDIO_DEMUXERS)) \
599 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_AUDIO_PROTOCOLS)) \
600 --disable-decoder=pcm_bluray,pcm_dvd
601 endif
602
603 ifeq ($(BUILD_VARIANT),mini)
604
605 FFMPEG_ENABLE= \
606 $(foreach c, $(2), \
607 --enable-$(1)="$(c)" \
608 )
609
610 FFMPEG_CONFIGURE+= \
611 --enable-small \
612 \
613 --disable-programs \
614 --disable-avdevice \
615 --disable-avfilter \
616 --disable-postproc \
617 --disable-swresample \
618 --disable-swscale \
619 --disable-everything \
620 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_MINI_DECODERS)) \
621 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_MINI_DEMUXERS)) \
622 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS)) \
623 $(if $(CONFIG_BUILD_PATENTED), \
624 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_PATENTED_MINI_DECODERS)))
625 endif
626
627 ifneq ($(CONFIG_TARGET_x86),)
628 TARGET_CFLAGS+= -fomit-frame-pointer
629 endif
630
631 define Build/Configure
632 ( cd $(PKG_BUILD_DIR); $(FFMPEG_CONFIGURE) )
633 endef
634
635 define Build/Compile
636 $(MAKE) -C $(PKG_BUILD_DIR) \
637 DESTDIR="$(PKG_INSTALL_DIR)" \
638 all install
639 endef
640
641 define Build/InstallDev/custom
642 $(INSTALL_DIR) $(1)/usr/include
643 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avformat,avutil} $(1)/usr/include/
644 $(INSTALL_DIR) $(1)/usr/lib
645 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.{a,so*} $(1)/usr/lib/
646 ifeq ($(CONFIG_FFMPEG_CUSTOM_PROGRAMS),y)
647 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avfilter,swresample}.{a,so*} $(1)/usr/lib/
648 endif
649 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
650 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
651 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264),y)
652 $(CP) $(PKG_INSTALL_DIR)/usr/include/libpostproc $(1)/usr/include/
653 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.{a,so*} $(1)/usr/lib/
654 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpostproc.pc $(1)/usr/lib/pkgconfig/
655 endif
656 endef
657
658 # Only ffmpeg with libx264 is GPL (yes libpostproc); all other builds are lgpl (no libpostproc)
659 define Build/InstallDev/full
660 $(INSTALL_DIR) $(1)/usr/include
661 $(INSTALL_DIR) $(1)/usr/lib
662 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
663 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avutil,swresample,swscale} $(1)/usr/include/
664 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,swresample,swscale}.{a,so*} $(1)/usr/lib/
665 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avutil,swresample,swscale}.pc $(1)/usr/lib/pkgconfig/
666 ifneq ($(CONFIG_PACKAGE_libx264),)
667 $(CP) $(PKG_INSTALL_DIR)/usr/include/libpostproc $(1)/usr/include/
668 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.{a,so*} $(1)/usr/lib/
669 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpostproc.pc $(1)/usr/lib/pkgconfig/
670 endif
671 endef
672
673 define Build/InstallDev/mini
674 $(INSTALL_DIR) $(1)/usr/include
675 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avformat,avutil} $(1)/usr/include/
676 $(INSTALL_DIR) $(1)/usr/lib
677 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.{a,so*} $(1)/usr/lib/
678 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
679 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
680 endef
681
682 Build/InstallDev/audio-dec = $(Build/InstallDev/custom)
683
684 # XXX: attempt at installing "best" dev files available
685 ifeq ($(BUILD_VARIANT),custom)
686 # XXX: only install "custom" dev files if -full & -mini are not selected
687 ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
688 Build/InstallDev = $(Build/InstallDev/custom)
689 endif
690 endif
691 ifeq ($(BUILD_VARIANT),audio-dec)
692 # XXX: only install "audio-dec" dev files if -full & -mini are not selected
693 ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
694 Build/InstallDev = $(Build/InstallDev/audio-dec)
695 endif
696 endif
697 ifeq ($(BUILD_VARIANT),full)
698 # XXX: always install "full" dev files if -full is selected
699 Build/InstallDev = $(Build/InstallDev/full)
700 endif
701 ifeq ($(BUILD_VARIANT),mini)
702 # XXX: only install "mini" dev files if -full is not selected
703 ifeq ($(CONFIG_PACKAGE_libffmpeg-full),)
704 Build/InstallDev = $(Build/InstallDev/mini)
705 endif
706 endif
707
708 define Package/ffmpeg/install
709 $(INSTALL_DIR) $(1)/usr/bin
710 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffmpeg $(1)/usr/bin/
711 endef
712
713 Package/ffmpeg-custom/install = $(Package/ffmpeg/install)
714
715 define Package/ffprobe/install
716 $(INSTALL_DIR) $(1)/usr/bin
717 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffprobe $(1)/usr/bin/
718 endef
719
720 Package/ffprobe-custom/install = $(Package/ffprobe/install)
721
722 define Package/libffmpeg-custom/install
723 $(INSTALL_DIR) $(1)/usr/lib
724 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/
725 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264),y)
726 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.so.* $(1)/usr/lib/
727 endif
728 ifeq ($(CONFIG_FFMPEG_CUSTOM_PROGRAMS),y)
729 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avfilter,swresample}.so.* $(1)/usr/lib/
730 endif
731 endef
732
733 # Only ffmpeg with libx264 is GPL (yes libpostproc); all other builds are lgpl (no libpostproc)
734 define Package/libffmpeg-full/install
735 $(INSTALL_DIR) $(1)/usr/lib
736 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,swresample,swscale}.so.* $(1)/usr/lib/
737 ifneq ($(CONFIG_PACKAGE_libx264),)
738 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.so.* $(1)/usr/lib/
739 endif
740 endef
741
742 define Package/libffmpeg-mini/install
743 $(INSTALL_DIR) $(1)/usr/lib
744 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.so.* $(1)/usr/lib/
745 endef
746
747 Package/libffmpeg-audio-dec/install = $(Package/libffmpeg-custom/install)
748
749 $(eval $(call BuildPackage,ffmpeg))
750 $(eval $(call BuildPackage,ffprobe))
751 $(eval $(call BuildPackage,ffmpeg-custom))
752 $(eval $(call BuildPackage,ffprobe-custom))
753 $(eval $(call BuildPackage,libffmpeg-audio-dec))
754 $(eval $(call BuildPackage,libffmpeg-full))
755 $(eval $(call BuildPackage,libffmpeg-mini))
756 $(eval $(call BuildPackage,libffmpeg-custom))