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