ffmpeg: disable output devices to prevent it from picking up stuff like sdl
[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.7
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:=31da4d5610d7138761e23fab8fe3a84d
17
18 FFMPEG_CUSTOM_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_CUSTOM_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_CUSTOM_MUXERS:= \
53 ac3 \
54 ffm \
55 h264 \
56 mp3 \
57 mp4 \
58 mpeg1video \
59 mpeg2video \
60 mpegts \
61 ogg \
62 rtp \
63
64 FFMPEG_CUSTOM_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_CUSTOM_PARSERS:= \
84 aac \
85 ac3 \
86 h264 \
87 mpegaudio \
88 mpeg4video \
89 mpegvideo \
90
91 FFMPEG_CUSTOM_PROTOCOLS:= \
92 file http pipe rtp tcp udp
93
94 FFMPEG_MINI_ENCODERS:= \
95
96 FFMPEG_MINI_DECODERS:= \
97 aac \
98 ac3 \
99 atrac3 \
100 flac \
101 h263 \
102 h264 \
103 jpegls \
104 mp3 \
105 mpeg1video \
106 mpeg2video \
107 mpeg4 \
108 mpegvideo \
109 png \
110 wmav1 \
111 wmav2 \
112
113 FFMPEG_MINI_MUXERS:= \
114 ffm \
115
116 FFMPEG_MINI_DEMUXERS := \
117 aac \
118 ac3 \
119 asf \
120 avi \
121 ffm \
122 flac \
123 h264 \
124 matroska \
125 mov \
126 mp3 \
127 mpegts \
128 mpegvideo \
129 rtsp \
130
131 FFMPEG_MINI_PARSERS:= \
132 ac3 \
133 flac \
134 h263 \
135 h264 \
136 mpeg4video \
137 mpegaudio \
138
139 FFMPEG_MINI_PROTOCOLS := \
140 file http rtp tcp udp \
141
142 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
143
144 PKG_CONFIG_DEPENDS:= \
145 $(patsubst %,CONFIG_FFMPEG_CUSTOM_ENCODER_%,$(FFMPEG_CUSTOM_ENCODERS)) \
146 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DECODER_%,$(FFMPEG_CUSTOM_DECODERS)) \
147 $(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
148 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DEMUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
149 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PARSER_%,$(FFMPEG_CUSTOM_PARSERS)) \
150 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PROTOCOL_%,$(FFMPEG_CUSTOM_PROTOCOLS))
151
152 include $(INCLUDE_DIR)/package.mk
153
154 define Package/ffmpeg/Default
155 TITLE:=FFmpeg
156 URL:=http://ffmpeg.mplayerhq.hu/
157 endef
158
159 define Package/ffmpeg/Default/description
160 FFmpeg is a a software package that can record, convert and stream digital
161 audio and video in numerous formats.
162 endef
163
164
165 define Package/ffmpeg
166 $(call Package/ffmpeg/Default)
167 SECTION:=multimedia
168 CATEGORY:=Multimedia
169 TITLE+= program
170 DEPENDS+= +libpthread +libffmpeg-full
171 VARIANT:=full
172 endef
173
174 define Package/ffmpeg/description
175 $(call Package/ffmpeg/Default/description)
176 .
177 This package contains the FFmpeg command line tool.
178 endef
179
180
181 define Package/ffprobe
182 $(call Package/ffmpeg/Default)
183 SECTION:=multimedia
184 CATEGORY:=Multimedia
185 TITLE+= CLI media identifier
186 DEPENDS+= +libffmpeg-full
187 VARIANT:=full
188 endef
189
190 define Package/ffprobe/description
191 $(call Package/ffmpeg/Default/description)
192 .
193 This package contains the FFprobe command line tool.
194 endef
195
196
197 define Package/ffserver
198 $(call Package/ffserver/Default)
199 SECTION:=multimedia
200 CATEGORY:=Multimedia
201 TITLE+= streaming server
202 DEPENDS+= +libpthread +libffmpeg-full
203 VARIANT:=full
204 endef
205
206 define Package/ffserver/description
207 $(call Package/ffmpeg/Default/description)
208 .
209 This package contains the FFmpeg streaming server.
210 endef
211
212
213 define Package/libffmpeg/Default
214 $(call Package/ffmpeg/Default)
215 SECTION:=libs
216 CATEGORY:=Libraries
217 TITLE+= libraries
218 DEPENDS+= +libpthread +zlib +libbz2
219 PROVIDES:= libffmpeg
220 endef
221
222
223 define Package/libffmpeg-custom
224 $(call Package/libffmpeg/Default)
225 TITLE+= (mini)
226 DEPENDS+= @DEVEL
227 VARIANT:=custom
228 MENU:=1
229 endef
230
231 define Package/libffmpeg-custom/config
232 source "$(SOURCE)/Config.in"
233 endef
234
235 define Package/libffmpeg-custom/description
236 $(call Package/ffmpeg/Default/description)
237 .
238 This package contains customized FFmpeg shared libraries.
239 endef
240
241
242 define Package/libffmpeg-full
243 $(call Package/libffmpeg/Default)
244 TITLE+= (full)
245 DEPENDS+= @BUILD_PATENTED +alsa-lib
246 VARIANT:=full
247 endef
248
249 define Package/libffmpeg-full/description
250 $(call Package/ffmpeg/Default/description)
251 .
252 This package contains full-featured FFmpeg shared libraries.
253 endef
254
255
256 define Package/libffmpeg-mini
257 $(call Package/libffmpeg/Default)
258 TITLE+= (mini)
259 DEPENDS+= @BUILD_PATENTED
260 VARIANT:=mini
261 endef
262
263 define Package/libffmpeg-mini/description
264 $(call Package/ffmpeg/Default/description)
265 .
266 This package contains minimal-featured FFmpeg shared libraries.
267 endef
268
269
270 FFMPEG_CONFIGURE:= \
271 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
272 LDFLAGS="$(TARGET_LDFLAGS)" \
273 ./configure \
274 --enable-cross-compile \
275 --cross-prefix="$(TARGET_CROSS)" \
276 --arch="$(ARCH)" \
277 --target-os=linux \
278 --prefix="/usr" \
279 --enable-shared \
280 --enable-static \
281 --disable-debug \
282 --pkg-config="pkg-config" \
283 \
284 --enable-gpl \
285 --enable-version3 \
286 \
287 --disable-asm \
288 --disable-doc \
289 --disable-dxva2 \
290 --enable-pthreads \
291 --disable-optimizations \
292 --enable-small \
293 --disable-stripping \
294 --enable-zlib \
295 --disable-outdevs
296
297 ifeq ($(BUILD_VARIANT),custom)
298
299 FFMPEG_ENABLE= \
300 $(foreach c, $(2), \
301 $(if $($(3)_$(c)),--enable-$(1)="$(c)") \
302 )
303
304 FFMPEG_CONFIGURE+= \
305 --disable-ffmpeg \
306 --disable-ffplay \
307 --disable-ffprobe \
308 --disable-ffserver \
309 --disable-avfilter \
310 --disable-postproc \
311 --disable-swscale \
312 --disable-everything \
313 $(call FFMPEG_ENABLE,encoder,$(FFMPEG_CUSTOM_ENCODERS),CONFIG_FFMPEG_ENCODER) \
314 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_CUSTOM_DECODERS),CONFIG_FFMPEG_DECODER) \
315 $(call FFMPEG_ENABLE,muxer,$(FFMPEG_CUSTOM_MUXERS),CONFIG_FFMPEG_MUXER) \
316 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_CUSTOM_DEMUXERS),CONFIG_FFMPEG_DEMUXER) \
317 $(call FFMPEG_ENABLE,parser,$(FFMPEG_CUSTOM_PARSERS),CONFIG_FFMPEG_PARSER) \
318 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_CUSTOM_PROTOCOLS),CONFIG_FFMPEG_PROTOCOL) \
319
320 endif
321
322 ifeq ($(BUILD_VARIANT),mini)
323
324 FFMPEG_ENABLE= \
325 $(foreach c, $(2), \
326 --enable-$(1)="$(c)" \
327 )
328
329 FFMPEG_CONFIGURE+= \
330 --disable-ffmpeg \
331 --disable-ffplay \
332 --disable-ffprobe \
333 --disable-ffserver \
334 --disable-avfilter \
335 --disable-postproc \
336 --disable-swscale \
337 --disable-everything \
338 $(call FFMPEG_ENABLE,encoder,$(FFMPEG_MINI_ENCODERS)) \
339 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_MINI_DECODERS)) \
340 $(call FFMPEG_ENABLE,muxer,$(FFMPEG_MINI_MUXERS)) \
341 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_MINI_DEMUXERS)) \
342 $(call FFMPEG_ENABLE,parser,$(FFMPEG_MINI_PARSERS)) \
343 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS)) \
344
345 endif
346
347 ifneq ($(CONFIG_TARGET_x86),)
348 TARGET_CFLAGS += -fomit-frame-pointer
349 endif
350
351 define Build/Configure
352 ( cd $(PKG_BUILD_DIR); $(FFMPEG_CONFIGURE) )
353 endef
354
355 define Build/Compile
356 $(MAKE) -C $(PKG_BUILD_DIR) \
357 DESTDIR="$(PKG_INSTALL_DIR)" \
358 all install
359 endef
360
361 define Build/InstallDev/custom
362 $(INSTALL_DIR) $(1)/usr/include
363 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avformat,avutil} $(1)/usr/include/
364 $(INSTALL_DIR) $(1)/usr/lib
365 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.{a,so*} $(1)/usr/lib/
366 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
367 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
368 endef
369
370 define Build/InstallDev/full
371 $(INSTALL_DIR) $(1)/usr/include
372 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swscale} $(1)/usr/include/
373 $(INSTALL_DIR) $(1)/usr/lib
374 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swscale}.{a,so*} $(1)/usr/lib/
375 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
376 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swscale}.pc $(1)/usr/lib/pkgconfig/
377 endef
378
379 Build/InstallDev/mini = $(Build/InstallDev/custom)
380
381 # XXX: attempt at installing "best" dev files available
382 ifeq ($(BUILD_VARIANT),custom)
383 # XXX: only install "custom" dev files if -full & -mini are not selected
384 ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
385 Build/InstallDev = $(Build/InstallDev/custom)
386 endif
387 endif
388 ifeq ($(BUILD_VARIANT),full)
389 # XXX: always install "full" dev files if -full is selected
390 Build/InstallDev = $(Build/InstallDev/full)
391 endif
392 ifeq ($(BUILD_VARIANT),mini)
393 # XXX: only install "mini" dev files if -full is not selected
394 ifeq ($(CONFIG_PACKAGE_libffmpeg-full),)
395 Build/InstallDev = $(Build/InstallDev/mini)
396 endif
397 endif
398
399 define Package/ffmpeg/install
400 $(INSTALL_DIR) $(1)/usr/bin
401 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffmpeg $(1)/usr/bin/
402 endef
403
404 define Package/ffprobe/install
405 $(INSTALL_DIR) $(1)/usr/bin
406 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffprobe $(1)/usr/bin/
407 endef
408
409 define Package/ffserver/install
410 $(INSTALL_DIR) $(1)/usr/bin
411 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffserver $(1)/usr/bin/
412 endef
413
414 define Package/libffmpeg-custom/install
415 $(INSTALL_DIR) $(1)/usr/lib
416 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/
417 endef
418
419 define Package/libffmpeg-full/install
420 $(INSTALL_DIR) $(1)/usr/lib
421 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swscale}.so.* $(1)/usr/lib/
422 endef
423
424 Package/libffmpeg-mini/install = $(Package/libffmpeg-custom/install)
425
426 $(eval $(call BuildPackage,ffmpeg))
427 $(eval $(call BuildPackage,ffprobe))
428 $(eval $(call BuildPackage,ffserver))
429 $(eval $(call BuildPackage,libffmpeg-custom))
430 $(eval $(call BuildPackage,libffmpeg-full))
431 $(eval $(call BuildPackage,libffmpeg-mini))