eabdde5d8fa3a67b2574618762c4ed2a5b4a1982
[packages.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:=5
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
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 # XXX: add --disable-mmx & --disable-mmx2 to fix build failure on x86
186 # libpostproc/postprocess_template.c:2195: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
187 # libpostproc/postprocess_template.c:3124: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
188 # libpostproc/postprocess_template.c:3207: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
189
190 define Build/Configure
191         # this is *NOT* GNU configure
192         ( cd $(PKG_BUILD_DIR); \
193                 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
194                 LDFLAGS="$(TARGET_LDFLAGS)" \
195                 ./configure \
196                 --enable-cross-compile \
197                 --cross-prefix="$(TARGET_CROSS)" \
198                 --arch="$(ARCH)" \
199                 --prefix="/usr" \
200                 --enable-shared \
201                 --enable-static \
202                 --disable-debug \
203                 --enable-gpl \
204                 --disable-libfaad \
205                 --disable-mmx \
206                 --disable-mmx2 \
207                 --enable-pthreads \
208                 --disable-optimizations \
209                 --enable-small \
210                 --disable-stripping \
211                 --disable-vhook \
212                 --enable-zlib \
213                 --enable-postproc \
214                 --enable-swscale \
215                 \
216                 $(if $(CONFIG_PACKAGE_ffmpeg),,--disable-ffmpeg) \
217                 $(if $(CONFIG_PACKAGE_ffserver),,--disable-ffserver) \
218                 $(if $(CONFIG_FFMPEG_IPV6),,--disable-ipv6) \
219                 \
220                 --disable-bsfs \
221                 --disable-devices \
222                 --disable-encoders \
223                 $(FFMPEG_CONFIGURE_ENCODERS) \
224                 --disable-decoders \
225                 $(FFMPEG_CONFIGURE_DECODERS) \
226                 --disable-muxers \
227                 $(FFMPEG_CONFIGURE_MUXERS) \
228                 --disable-demuxers \
229                 $(FFMPEG_CONFIGURE_DEMUXERS) \
230                 --disable-parsers \
231                 $(FFMPEG_CONFIGURE_PARSERS) \
232                 --disable-protocols \
233                 $(FFMPEG_CONFIGURE_PROTOCOLS) \
234         )
235 endef
236
237 define Build/Compile
238         $(MAKE) -C $(PKG_BUILD_DIR) \
239                 DESTDIR="$(PKG_INSTALL_DIR)" \
240                 all install
241 endef
242
243 define Build/InstallDev
244         $(INSTALL_DIR) $(1)/usr/include
245         $(CP) $(PKG_INSTALL_DIR)/usr/include/libav{codec,device,format,util} $(1)/usr/include/
246         $(CP) $(PKG_INSTALL_DIR)/usr/include/libpostproc $(1)/usr/include/
247         $(INSTALL_DIR) $(1)/usr/lib
248         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libav{codec,device,format,util}.{a,so*} $(1)/usr/lib/
249         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.{a,so*} $(1)/usr/lib/
250         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libswscale.{a,so*} $(1)/usr/lib/
251         $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
252         $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libav{codec,device,format,util}.pc $(1)/usr/lib/pkgconfig/
253         $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpostproc.pc $(1)/usr/lib/pkgconfig/
254         $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libswscale.pc $(1)/usr/lib/pkgconfig/
255 endef
256
257 define Package/ffmpeg/install
258         $(INSTALL_DIR) $(1)/usr/bin
259         $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffmpeg $(1)/usr/bin/
260 endef
261
262 define Package/ffserver/install
263         $(INSTALL_DIR) $(1)/usr/bin
264         $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffserver $(1)/usr/bin/
265 endef
266
267 define Package/libffmpeg/install
268         $(INSTALL_DIR) $(1)/usr/lib
269         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libav{codec,device,format,util}.so.* $(1)/usr/lib/
270 endef
271
272 define Package/libpostproc/install
273         $(INSTALL_DIR) $(1)/usr/lib
274         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.so.* $(1)/usr/lib/
275 endef
276
277 define Package/libswcale/install
278         $(INSTALL_DIR) $(1)/usr/lib
279         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libswscale.so.* $(1)/usr/lib/
280 endef
281
282 $(eval $(call BuildPackage,ffmpeg))
283 $(eval $(call BuildPackage,ffserver))
284 $(eval $(call BuildPackage,libffmpeg))
285 $(eval $(call BuildPackage,libpostproc))
286 $(eval $(call BuildPackage,libswscale))