2 # Copyright (C) 2006-2012 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://ffmpeg.org/releases/
16 PKG_MD5SUM:=31da4d5610d7138761e23fab8fe3a84d
18 PKG_LICENSE:=LGPLv2.1+ GPLv2+ LGPLv3
19 PKG_LICENSE_FILES:=COPYING.GPLv2 COPYING.GPLv3 COPYING.LGPLv2.1 COPYING.LGPLv3
21 FFMPEG_CUSTOM_ENCODERS:= \
33 FFMPEG_CUSTOM_DECODERS:= \
55 FFMPEG_CUSTOM_MUXERS:= \
67 FFMPEG_CUSTOM_DEMUXERS:= \
86 FFMPEG_CUSTOM_PARSERS:= \
94 FFMPEG_CUSTOM_PROTOCOLS:= \
95 file http pipe rtp tcp udp
97 FFMPEG_MINI_ENCODERS:= \
99 FFMPEG_MINI_DECODERS:= \
116 FFMPEG_MINI_MUXERS:= \
119 FFMPEG_MINI_DEMUXERS := \
134 FFMPEG_MINI_PARSERS:= \
142 FFMPEG_MINI_PROTOCOLS := \
143 file http rtp tcp udp \
145 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
147 PKG_CONFIG_DEPENDS:= \
148 $(patsubst %,CONFIG_FFMPEG_CUSTOM_ENCODER_%,$(FFMPEG_CUSTOM_ENCODERS)) \
149 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DECODER_%,$(FFMPEG_CUSTOM_DECODERS)) \
150 $(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
151 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DEMUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
152 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PARSER_%,$(FFMPEG_CUSTOM_PARSERS)) \
153 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PROTOCOL_%,$(FFMPEG_CUSTOM_PROTOCOLS))
155 include $(INCLUDE_DIR)/package.mk
157 define Package/ffmpeg/Default
159 URL:=http://ffmpeg.mplayerhq.hu/
162 define Package/ffmpeg/Default/description
163 FFmpeg is a a software package that can record, convert and stream digital
164 audio and video in numerous formats.
168 define Package/ffmpeg
169 $(call Package/ffmpeg/Default)
173 DEPENDS+= +libpthread +libffmpeg-full
177 define Package/ffmpeg/description
178 $(call Package/ffmpeg/Default/description)
180 This package contains the FFmpeg command line tool.
184 define Package/ffprobe
185 $(call Package/ffmpeg/Default)
188 TITLE+= CLI media identifier
189 DEPENDS+= +libffmpeg-full
193 define Package/ffprobe/description
194 $(call Package/ffmpeg/Default/description)
196 This package contains the FFprobe command line tool.
200 define Package/ffserver
201 $(call Package/ffserver/Default)
204 TITLE+= streaming server
205 DEPENDS+= +libpthread +libffmpeg-full
209 define Package/ffserver/description
210 $(call Package/ffmpeg/Default/description)
212 This package contains the FFmpeg streaming server.
216 define Package/libffmpeg/Default
217 $(call Package/ffmpeg/Default)
221 DEPENDS+= +libpthread +zlib +libbz2
226 define Package/libffmpeg-custom
227 $(call Package/libffmpeg/Default)
234 define Package/libffmpeg-custom/config
235 source "$(SOURCE)/Config.in"
238 define Package/libffmpeg-custom/description
239 $(call Package/ffmpeg/Default/description)
241 This package contains customized FFmpeg shared libraries.
245 define Package/libffmpeg-full
246 $(call Package/libffmpeg/Default)
248 DEPENDS+= @BUILD_PATENTED +alsa-lib
252 define Package/libffmpeg-full/description
253 $(call Package/ffmpeg/Default/description)
255 This package contains full-featured FFmpeg shared libraries.
259 define Package/libffmpeg-mini
260 $(call Package/libffmpeg/Default)
262 DEPENDS+= @BUILD_PATENTED
266 define Package/libffmpeg-mini/description
267 $(call Package/ffmpeg/Default/description)
269 This package contains minimal-featured FFmpeg shared libraries.
274 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
275 LDFLAGS="$(TARGET_LDFLAGS)" \
277 --enable-cross-compile \
278 --cross-prefix="$(TARGET_CROSS)" \
285 --pkg-config="pkg-config" \
294 --disable-optimizations \
296 --disable-stripping \
300 ifeq ($(BUILD_VARIANT),custom)
304 $(if $($(3)_$(c)),--enable-$(1)="$(c)") \
315 --disable-everything \
316 $(call FFMPEG_ENABLE,encoder,$(FFMPEG_CUSTOM_ENCODERS),CONFIG_FFMPEG_CUSTOM_ENCODER) \
317 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_CUSTOM_DECODERS),CONFIG_FFMPEG_CUSTOM_DECODER) \
318 $(call FFMPEG_ENABLE,muxer,$(FFMPEG_CUSTOM_MUXERS),CONFIG_FFMPEG_CUSTOM_MUXER) \
319 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_CUSTOM_DEMUXERS),CONFIG_FFMPEG_CUSTOM_DEMUXER) \
320 $(call FFMPEG_ENABLE,parser,$(FFMPEG_CUSTOM_PARSERS),CONFIG_FFMPEG_CUSTOM_PARSER) \
321 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_CUSTOM_PROTOCOLS),CONFIG_FFMPEG_CUSTOM_PROTOCOL) \
325 ifeq ($(BUILD_VARIANT),mini)
329 --enable-$(1)="$(c)" \
340 --disable-everything \
341 $(call FFMPEG_ENABLE,encoder,$(FFMPEG_MINI_ENCODERS)) \
342 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_MINI_DECODERS)) \
343 $(call FFMPEG_ENABLE,muxer,$(FFMPEG_MINI_MUXERS)) \
344 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_MINI_DEMUXERS)) \
345 $(call FFMPEG_ENABLE,parser,$(FFMPEG_MINI_PARSERS)) \
346 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS)) \
350 ifneq ($(CONFIG_TARGET_x86),)
351 TARGET_CFLAGS += -fomit-frame-pointer
354 define Build/Configure
355 ( cd $(PKG_BUILD_DIR); $(FFMPEG_CONFIGURE) )
359 $(MAKE) -C $(PKG_BUILD_DIR) \
360 DESTDIR="$(PKG_INSTALL_DIR)" \
364 define Build/InstallDev/custom
365 $(INSTALL_DIR) $(1)/usr/include
366 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avformat,avutil} $(1)/usr/include/
367 $(INSTALL_DIR) $(1)/usr/lib
368 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.{a,so*} $(1)/usr/lib/
369 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
370 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
373 define Build/InstallDev/full
374 $(INSTALL_DIR) $(1)/usr/include
375 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swscale} $(1)/usr/include/
376 $(INSTALL_DIR) $(1)/usr/lib
377 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swscale}.{a,so*} $(1)/usr/lib/
378 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
379 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swscale}.pc $(1)/usr/lib/pkgconfig/
382 Build/InstallDev/mini = $(Build/InstallDev/custom)
384 # XXX: attempt at installing "best" dev files available
385 ifeq ($(BUILD_VARIANT),custom)
386 # XXX: only install "custom" dev files if -full & -mini are not selected
387 ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
388 Build/InstallDev = $(Build/InstallDev/custom)
391 ifeq ($(BUILD_VARIANT),full)
392 # XXX: always install "full" dev files if -full is selected
393 Build/InstallDev = $(Build/InstallDev/full)
395 ifeq ($(BUILD_VARIANT),mini)
396 # XXX: only install "mini" dev files if -full is not selected
397 ifeq ($(CONFIG_PACKAGE_libffmpeg-full),)
398 Build/InstallDev = $(Build/InstallDev/mini)
402 define Package/ffmpeg/install
403 $(INSTALL_DIR) $(1)/usr/bin
404 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffmpeg $(1)/usr/bin/
407 define Package/ffprobe/install
408 $(INSTALL_DIR) $(1)/usr/bin
409 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffprobe $(1)/usr/bin/
412 define Package/ffserver/install
413 $(INSTALL_DIR) $(1)/usr/bin
414 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffserver $(1)/usr/bin/
417 define Package/libffmpeg-custom/install
418 $(INSTALL_DIR) $(1)/usr/lib
419 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/
422 define Package/libffmpeg-full/install
423 $(INSTALL_DIR) $(1)/usr/lib
424 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swscale}.so.* $(1)/usr/lib/
427 Package/libffmpeg-mini/install = $(Package/libffmpeg-custom/install)
429 $(eval $(call BuildPackage,ffmpeg))
430 $(eval $(call BuildPackage,ffprobe))
431 $(eval $(call BuildPackage,ffserver))
432 $(eval $(call BuildPackage,libffmpeg-custom))
433 $(eval $(call BuildPackage,libffmpeg-full))
434 $(eval $(call BuildPackage,libffmpeg-mini))