413 lines
8.7 KiB
Makefile
Raw Normal View History

#
# Copyright (C) 2006-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=ffmpeg
PKG_VERSION:=0.8.2
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://ffmpeg.org/releases/
PKG_MD5SUM:=967d481c98161582d149aced6e3b2f31
FFMPEG_CUSTOM_ENCODERS:= \
ac3 \
jpegls \
mpeg1video \
mpeg2video \
mpeg4 \
pcm_s16be \
pcm_s16le \
png \
vorbis \
zlib \
FFMPEG_CUSTOM_DECODERS:= \
aac \
ac3 \
atrac3 \
flac \
gif \
h264 \
jpegls \
mp2 \
mp3 \
mpeg1video \
mpeg2video \
mpeg4 \
mpegvideo \
pcm_s16be \
pcm_s16le \
png \
vorbis \
wmav1 \
wmav2 \
zlib \
FFMPEG_CUSTOM_MUXERS:= \
ac3 \
ffm \
h264 \
mp3 \
mp4 \
mpeg1video \
mpeg2video \
mpegts \
ogg \
rtp \
FFMPEG_CUSTOM_DEMUXERS:= \
aac \
ac3 \
avi \
flac \
ffm \
h264 \
matroska \
mov \
mp3 \
mpegps \
mpegts \
mpegvideo \
ogg \
rm \
rtsp \
sdp \
v4l2 \
FFMPEG_CUSTOM_PARSERS:= \
aac \
ac3 \
h264 \
mpegaudio \
mpeg4video \
mpegvideo \
FFMPEG_CUSTOM_PROTOCOLS:= \
file http pipe rtp tcp udp
FFMPEG_MINI_ENCODERS:= \
FFMPEG_MINI_DECODERS:= \
aac \
ac3 \
atrac3 \
flac \
h263 \
h264 \
jpegls \
mp3 \
mpeg1video \
mpeg2video \
mpeg4 \
mpegvideo \
png \
wmav1 \
wmav2 \
FFMPEG_MINI_MUXERS:= \
ffm \
FFMPEG_MINI_DEMUXERS := \
aac \
ac3 \
asf \
avi \
ffm \
flac \
h264 \
matroska \
mov \
mp3 \
mpegts \
mpegvideo \
rtsp \
FFMPEG_MINI_PARSERS:= \
ac3 \
flac \
h263 \
h264 \
mpeg4video \
mpegaudio \
FFMPEG_MINI_PROTOCOLS := \
file http rtp tcp udp \
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
PKG_CONFIG_DEPENDS:= \
$(patsubst %,CONFIG_FFMPEG_CUSTOM_ENCODER_%,$(FFMPEG_CUSTOM_ENCODERS)) \
$(patsubst %,CONFIG_FFMPEG_CUSTOM_DECODER_%,$(FFMPEG_CUSTOM_DECODERS)) \
$(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
$(patsubst %,CONFIG_FFMPEG_CUSTOM_DEMUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
$(patsubst %,CONFIG_FFMPEG_CUSTOM_PARSER_%,$(FFMPEG_CUSTOM_PARSERS)) \
$(patsubst %,CONFIG_FFMPEG_CUSTOM_PROTOCOL_%,$(FFMPEG_CUSTOM_PROTOCOLS))
include $(INCLUDE_DIR)/package.mk
define Package/ffmpeg/Default
TITLE:=FFmpeg
URL:=http://ffmpeg.mplayerhq.hu/
endef
define Package/ffmpeg/Default/description
FFmpeg is a a software package that can record, convert and stream digital
audio and video in numerous formats.
endef
define Package/ffmpeg
$(call Package/ffmpeg/Default)
SECTION:=multimedia
CATEGORY:=Multimedia
TITLE+= program
DEPENDS+= +libpthread +libffmpeg
VARIANT:=full
endef
define Package/ffmpeg/description
$(call Package/ffmpeg/Default/description)
.
This package contains the FFmpeg command line tool.
endef
define Package/ffprobe
$(call Package/ffmpeg/Default)
SECTION:=multimedia
CATEGORY:=Multimedia
TITLE+= CLI media identifier
DEPENDS+= +libffmpeg
VARIANT:=full
endef
define Package/ffprobe/description
$(call Package/ffmpeg/Default/description)
.
This package contains the FFprobe command line tool.
endef
define Package/ffserver
$(call Package/ffserver/Default)
SECTION:=multimedia
CATEGORY:=Multimedia
TITLE+= streaming server
DEPENDS+= +libpthread +libffmpeg
VARIANT:=full
endef
define Package/ffserver/description
$(call Package/ffmpeg/Default/description)
.
This package contains the FFmpeg streaming server.
endef
define Package/libffmpeg/Default
$(call Package/ffmpeg/Default)
SECTION:=libs
CATEGORY:=Libraries
TITLE+= libraries
DEPENDS+= +libpthread +zlib
PROVIDES:= libffmpeg
endef
define Package/libffmpeg-custom
$(call Package/libffmpeg/Default)
TITLE+= (mini)
DEPENDS+= @DEVEL
VARIANT:=custom
MENU:=1
endef
define Package/libffmpeg-custom/config
source "$(SOURCE)/Config.in"
endef
define Package/libffmpeg-custom/description
$(call Package/ffmpeg/Default/description)
.
This package contains customized FFmpeg shared libraries.
endef
define Package/libffmpeg-full
$(call Package/libffmpeg/Default)
TITLE+= (full)
DEPENDS+= @BUILD_PATENTED +alsa-libs
VARIANT:=full
endef
define Package/libffmpeg-full/description
$(call Package/ffmpeg/Default/description)
.
This package contains full-featured FFmpeg shared libraries.
endef
define Package/libffmpeg-mini
$(call Package/libffmpeg/Default)
TITLE+= (mini)
DEPENDS+= @BUILD_PATENTED
VARIANT:=mini
endef
define Package/libffmpeg-mini/description
$(call Package/ffmpeg/Default/description)
.
This package contains minimal-featured FFmpeg shared libraries.
endef
# XXX: add --disable-mmx & --disable-mmx2 to fix build failure on x86
# libpostproc/postprocess_template.c:2195: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
# libpostproc/postprocess_template.c:3124: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
# libpostproc/postprocess_template.c:3207: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
FFMPEG_CONFIGURE:= \
CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
LDFLAGS="$(TARGET_LDFLAGS)" \
PKG_CONFIG="pkg-config" \
./configure \
--enable-cross-compile \
--cross-prefix="$(TARGET_CROSS)" \
--arch="$(ARCH)" \
--target-os=linux \
--prefix="/usr" \
--enable-shared \
--enable-static \
--disable-debug \
\
--enable-gpl \
--enable-version3 \
\
--disable-doc \
--disable-dxva2 \
--disable-mmx \
--disable-mmx2 \
--enable-pthreads \
--disable-optimizations \
--enable-small \
--disable-stripping \
--enable-zlib \
ifeq ($(BUILD_VARIANT),custom)
FFMPEG_ENABLE= \
$(foreach c, $(2), \
$(if $($(3)_$(c)),--enable-$(1)="$(c)") \
)
FFMPEG_CONFIGURE+= \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-avfilter \
--disable-postproc \
--disable-swscale \
--disable-everything \
$(call FFMPEG_ENABLE,encoder,$(FFMPEG_CUSTOM_ENCODERS),CONFIG_FFMPEG_ENCODER) \
$(call FFMPEG_ENABLE,decoder,$(FFMPEG_CUSTOM_DECODERS),CONFIG_FFMPEG_DECODER) \
$(call FFMPEG_ENABLE,muxer,$(FFMPEG_CUSTOM_MUXERS),CONFIG_FFMPEG_MUXER) \
$(call FFMPEG_ENABLE,demuxer,$(FFMPEG_CUSTOM_DEMUXERS),CONFIG_FFMPEG_DEMUXER) \
$(call FFMPEG_ENABLE,parser,$(FFMPEG_CUSTOM_PARSERS),CONFIG_FFMPEG_PARSER) \
$(call FFMPEG_ENABLE,protocol,$(FFMPEG_CUSTOM_PROTOCOLS),CONFIG_FFMPEG_PROTOCOL) \
endif
ifeq ($(BUILD_VARIANT),mini)
FFMPEG_ENABLE= \
$(foreach c, $(2), \
--enable-$(1)="$(c)" \
)
FFMPEG_CONFIGURE+= \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-avfilter \
--disable-postproc \
--disable-swscale \
--disable-everything \
$(call FFMPEG_ENABLE,encoder,$(FFMPEG_MINI_ENCODERS)) \
$(call FFMPEG_ENABLE,decoder,$(FFMPEG_MINI_DECODERS)) \
$(call FFMPEG_ENABLE,muxer,$(FFMPEG_MINI_MUXERS)) \
$(call FFMPEG_ENABLE,demuxer,$(FFMPEG_MINI_DEMUXERS)) \
$(call FFMPEG_ENABLE,parser,$(FFMPEG_MINI_PARSERS)) \
$(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS)) \
endif
ifneq ($(CONFIG_TARGET_x86),)
TARGET_CFLAGS += -fomit-frame-pointer
endif
define Build/Configure
( cd $(PKG_BUILD_DIR); $(FFMPEG_CONFIGURE) )
endef
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
DESTDIR="$(PKG_INSTALL_DIR)" \
all install
endef
ifeq ($(BUILD_VARIANT),full)
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swscale} $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swscale}.{a,so*} $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swscale}.pc $(1)/usr/lib/pkgconfig/
endef
endif
define Package/ffmpeg/install
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_INSTALL_DIR)/usr/bin/ffmpeg $(1)/usr/bin/
endef
define Package/ffprobe/install
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_INSTALL_DIR)/usr/bin/ffprobe $(1)/usr/bin/
endef
define Package/ffserver/install
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_INSTALL_DIR)/usr/bin/ffserver $(1)/usr/bin/
endef
define Package/libffmpeg-custom/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/
endef
define Package/libffmpeg-full/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swscale}.so.* $(1)/usr/lib/
endef
define Package/libffmpeg-mini/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,ffmpeg))
$(eval $(call BuildPackage,ffprobe))
$(eval $(call BuildPackage,ffserver))
$(eval $(call BuildPackage,libffmpeg-custom))
$(eval $(call BuildPackage,libffmpeg-full))
$(eval $(call BuildPackage,libffmpeg-mini))