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