555a13aeaf51862e0fdad5e43a69f734ca540d26
[openwrt/svn-archive/archive.git] / multimedia / ffmpeg / Makefile
1 #
2 # Copyright (C) 2006-2011 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:=0.5.2
12 PKG_RELEASE:=6
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://ffmpeg.org/releases/
16 PKG_MD5SUM:=451eb428ca97a72c00555d50944cdb24
17
18 FFMPEG_ENCODERS:= \
19 ac3 \
20 jpegls \
21 mpeg1video \
22 mpeg2video \
23 mpeg4 \
24 pcm_s16be \
25 pcm_s16le \
26 png \
27 vorbis \
28 zlib \
29
30 FFMPEG_DECODERS:= \
31 aac \
32 ac3 \
33 atrac3 \
34 gif \
35 h264 \
36 jpegls \
37 mp2 \
38 mp3 \
39 mpeg1video \
40 mpeg2video \
41 mpeg4 \
42 mpeg4aac \
43 mpegvideo \
44 pcm_s16be \
45 pcm_s16le \
46 png \
47 vorbis \
48 wmav1 \
49 wmav2 \
50 zlib \
51
52 FFMPEG_MUXERS:= \
53 ac3 \
54 ffm \
55 h264 \
56 mp3 \
57 mp4 \
58 mpeg1video \
59 mpeg2video \
60 mpegts \
61 ogg \
62 oss \
63 rtp \
64
65 FFMPEG_DEMUXERS:= \
66 ac3 \
67 ffm \
68 h264 \
69 mp3 \
70 mpegps \
71 mpegts \
72 mpegvideo \
73 ogg \
74 rm \
75 rtsp \
76 sdp \
77 v4l2 \
78
79 FFMPEG_PARSERS:= \
80 aac \
81 ac3 \
82 h264 \
83 mpegaudio \
84 mpegvideo \
85 mpeg4video \
86
87 FFMPEG_PROTOCOLS:= \
88 file http pipe rtp tcp udp
89
90 PKG_CONFIG_DEPENDS:= \
91 $(patsubst %,CONFIG_FFMPEG_ENCODER_%,$(FFMPEG_ENCODERS)) \
92 $(patsubst %,CONFIG_FFMPEG_DECODER_%,$(FFMPEG_DECODERS)) \
93 $(patsubst %,CONFIG_FFMPEG_MUXER_%,$(FFMPEG_DEMUXERS)) \
94 $(patsubst %,CONFIG_FFMPEG_DEMUXER_%,$(FFMPEG_DEMUXERS)) \
95 $(patsubst %,CONFIG_FFMPEG_PARSER_%,$(FFMPEG_PARSERS)) \
96 $(patsubst %,CONFIG_FFMPEG_PROTOCOL_%,$(FFMPEG_PROTOCOLS))
97
98 include $(INCLUDE_DIR)/package.mk
99
100 define Package/ffmpeg/Default
101 TITLE:=FFmpeg
102 URL:=http://ffmpeg.mplayerhq.hu/
103 endef
104
105 define Package/ffmpeg/Default/description
106 FFmpeg is a a software package that can record, convert and stream digital
107 audio and video in numerous formats.
108 endef
109
110 define Package/ffmpeg
111 $(call Package/ffmpeg/Default)
112 SECTION:=multimedia
113 CATEGORY:=Multimedia
114 TITLE+= program
115 DEPENDS+= +libpthread +libffmpeg +libpostproc +libswscale
116 endef
117
118 define Package/ffmpeg/description
119 $(call Package/ffmpeg/Default/description)
120 .
121 This package contains the FFmpeg command line tool.
122 endef
123
124 define Package/ffserver
125 $(call Package/ffserver/Default)
126 SECTION:=multimedia
127 CATEGORY:=Multimedia
128 TITLE+= streaming server
129 DEPENDS+= +libpthread +libffmpeg +@FFMPEG_FFSERVER_SUPPORT
130 endef
131
132 define Package/ffserver/description
133 $(call Package/ffmpeg/Default/description)
134 .
135 This package contains the FFmpeg streaming server.
136 endef
137
138 define Package/libffmpeg
139 $(call Package/ffmpeg/Default)
140 SECTION:=libs
141 CATEGORY:=Libraries
142 TITLE+= libraries
143 DEPENDS+= +libpthread +zlib
144 MENU:=1
145 endef
146
147 define Package/libffmpeg/config
148 source "$(SOURCE)/Config.in"
149 endef
150
151 define Package/libffmeg/description
152 $(call Package/ffmpeg/Default/description)
153 .
154 This package contains FFmpeg shared libraries.
155 endef
156
157 define Package/libpostproc
158 SECTION:=libs
159 CATEGORY:=Libraries
160 TITLE:=libpostproc
161 URL:=http://ffmpeg.mplayerhq.hu/
162 DEPENDS:=+libffmpeg
163 endef
164
165 define Package/libswscale
166 SECTION:=libs
167 CATEGORY:=Libraries
168 TITLE:=libswscale
169 URL:=http://ffmpeg.mplayerhq.hu/
170 DEPENDS:=+libffmpeg
171 endef
172
173 FILTER_CONFIG= \
174 $(foreach c, $(3), \
175 $(if $(CONFIG_FFMPEG_$(1)_$(c)),--enable-$(2)="$(c)") \
176 )
177
178 FFMPEG_CONFIGURE_ENCODERS:=$(call FILTER_CONFIG,ENCODER,encoder,$(FFMPEG_ENCODERS))
179 FFMPEG_CONFIGURE_DECODERS:=$(call FILTER_CONFIG,DECODER,decoder,$(FFMPEG_DECODERS))
180 FFMPEG_CONFIGURE_MUXERS:=$(call FILTER_CONFIG,MUXER,muxer,$(FFMPEG_MUXERS))
181 FFMPEG_CONFIGURE_DEMUXERS:=$(call FILTER_CONFIG,DEMUXER,demuxer,$(FFMPEG_DEMUXERS))
182 FFMPEG_CONFIGURE_PARSERS:=$(call FILTER_CONFIG,PARSER,parser,$(FFMPEG_PARSERS))
183 FFMPEG_CONFIGURE_PROTOCOLS:=$(call FILTER_CONFIG,PROTOCOL,protocol,$(FFMPEG_PROTOCOLS))
184
185 ifneq ($(CONFIG_TARGET_x86),)
186 TARGET_CFLAGS += -fomit-frame-pointer
187 endif
188
189 # XXX: add --disable-mmx & --disable-mmx2 to fix build failure on x86
190 # libpostproc/postprocess_template.c:2195: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
191 # libpostproc/postprocess_template.c:3124: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
192 # libpostproc/postprocess_template.c:3207: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
193
194 define Build/Configure
195 # this is *NOT* GNU configure
196 ( cd $(PKG_BUILD_DIR); \
197 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
198 LDFLAGS="$(TARGET_LDFLAGS)" \
199 ./configure \
200 --enable-cross-compile \
201 --cross-prefix="$(TARGET_CROSS)" \
202 --arch="$(ARCH)" \
203 --prefix="/usr" \
204 --enable-shared \
205 --enable-static \
206 --disable-debug \
207 --enable-gpl \
208 --disable-libfaad \
209 --disable-mmx \
210 --disable-mmx2 \
211 --enable-pthreads \
212 --disable-optimizations \
213 --enable-small \
214 --disable-stripping \
215 --disable-vhook \
216 --enable-zlib \
217 --enable-postproc \
218 --enable-swscale \
219 \
220 $(if $(CONFIG_PACKAGE_ffmpeg),,--disable-ffmpeg) \
221 $(if $(CONFIG_PACKAGE_ffserver),,--disable-ffserver) \
222 $(if $(CONFIG_FFMPEG_IPV6),,--disable-ipv6) \
223 \
224 --disable-bsfs \
225 --disable-devices \
226 --disable-encoders \
227 $(FFMPEG_CONFIGURE_ENCODERS) \
228 --disable-decoders \
229 $(FFMPEG_CONFIGURE_DECODERS) \
230 --disable-muxers \
231 $(FFMPEG_CONFIGURE_MUXERS) \
232 --disable-demuxers \
233 $(FFMPEG_CONFIGURE_DEMUXERS) \
234 --disable-parsers \
235 $(FFMPEG_CONFIGURE_PARSERS) \
236 --disable-protocols \
237 $(FFMPEG_CONFIGURE_PROTOCOLS) \
238 )
239 endef
240
241 define Build/Compile
242 $(MAKE) -C $(PKG_BUILD_DIR) \
243 DESTDIR="$(PKG_INSTALL_DIR)" \
244 all install
245 endef
246
247 define Build/InstallDev
248 $(INSTALL_DIR) $(1)/usr/include
249 $(CP) $(PKG_INSTALL_DIR)/usr/include/libav{codec,device,format,util} $(1)/usr/include/
250 $(CP) $(PKG_INSTALL_DIR)/usr/include/libpostproc $(1)/usr/include/
251 $(INSTALL_DIR) $(1)/usr/lib
252 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libav{codec,device,format,util}.{a,so*} $(1)/usr/lib/
253 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.{a,so*} $(1)/usr/lib/
254 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libswscale.{a,so*} $(1)/usr/lib/
255 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
256 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libav{codec,device,format,util}.pc $(1)/usr/lib/pkgconfig/
257 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpostproc.pc $(1)/usr/lib/pkgconfig/
258 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libswscale.pc $(1)/usr/lib/pkgconfig/
259 endef
260
261 define Package/ffmpeg/install
262 $(INSTALL_DIR) $(1)/usr/bin
263 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffmpeg $(1)/usr/bin/
264 endef
265
266 define Package/ffserver/install
267 $(INSTALL_DIR) $(1)/usr/bin
268 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffserver $(1)/usr/bin/
269 endef
270
271 define Package/libffmpeg/install
272 $(INSTALL_DIR) $(1)/usr/lib
273 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libav{codec,device,format,util}.so.* $(1)/usr/lib/
274 endef
275
276 define Package/libpostproc/install
277 $(INSTALL_DIR) $(1)/usr/lib
278 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.so.* $(1)/usr/lib/
279 endef
280
281 define Package/libswscale/install
282 $(INSTALL_DIR) $(1)/usr/lib
283 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libswscale.so.* $(1)/usr/lib/
284 endef
285
286 $(eval $(call BuildPackage,ffmpeg))
287 $(eval $(call BuildPackage,ffserver))
288 $(eval $(call BuildPackage,libffmpeg))
289 $(eval $(call BuildPackage,libpostproc))
290 $(eval $(call BuildPackage,libswscale))