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