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