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