package/mplayer: add optional support for pulseaudio
[buildroot-gz.git] / package / mplayer / mplayer.mk
blob8288dcb1ec7776672557a1fa5155112aa588187a
1 ################################################################################
3 # mplayer
5 ################################################################################
7 MPLAYER_VERSION = 1.3.0
8 MPLAYER_SOURCE = MPlayer-$(MPLAYER_VERSION).tar.xz
9 MPLAYER_SITE = http://www.mplayerhq.hu/MPlayer/releases
10 MPLAYER_DEPENDENCIES = host-pkgconf
11 MPLAYER_LICENSE = GPLv2
12 MPLAYER_LICENSE_FILES = LICENSE Copyright
13 MPLAYER_CFLAGS = $(TARGET_CFLAGS)
14 MPLAYER_LDFLAGS = $(TARGET_LDFLAGS)
16 # Adding $(STAGING_DIR)/usr/include in the header path is normally not
17 # needed. Except that mplayer's configure script has a completely
18 # brain-damaged way of looking for X11/Xlib.h (it parses extra-cflags
19 # for -I options).
20 MPLAYER_CFLAGS += -I$(STAGING_DIR)/usr/include
22 # mplayer needs pcm+mixer support, but configure fails to check for it
23 ifeq ($(BR2_PACKAGE_ALSA_LIB)$(BR2_PACKAGE_ALSA_LIB_MIXER)$(BR2_PACKAGE_ALSA_LIB_PCM),yyy)
24 MPLAYER_DEPENDENCIES += alsa-lib
25 MPLAYER_CONF_OPTS += --enable-alsa
26 else
27 MPLAYER_CONF_OPTS += --disable-alsa
28 endif
30 ifeq ($(BR2_ENDIAN),"BIG")
31 MPLAYER_CONF_OPTS += --enable-big-endian
32 else
33 MPLAYER_CONF_OPTS += --disable-big-endian
34 endif
36 ifeq ($(BR2_PACKAGE_ZLIB),y)
37 MPLAYER_DEPENDENCIES += zlib
38 MPLAYER_CONF_OPTS += \
39 --enable-decoder=apng \
40 --enable-encoder=apng \
41 --enable-decoder=tdsc
42 else
43 MPLAYER_CONF_OPTS += \
44 --disable-decoder=apng \
45 --disable-encoder=apng \
46 --disable-decoder=tdsc
47 endif
49 ifeq ($(BR2_PACKAGE_SDL),y)
50 MPLAYER_CONF_OPTS += \
51 --enable-sdl \
52 --with-sdl-config=$(STAGING_DIR)/usr/bin/sdl-config
53 MPLAYER_DEPENDENCIES += sdl
54 else
55 MPLAYER_CONF_OPTS += --disable-sdl
56 endif
58 ifeq ($(BR2_PACKAGE_FREETYPE),y)
59 MPLAYER_CONF_OPTS += \
60 --enable-freetype \
61 --with-freetype-config=$(STAGING_DIR)/usr/bin/freetype-config
62 MPLAYER_DEPENDENCIES += freetype
63 else
64 MPLAYER_CONF_OPTS += --disable-freetype
65 endif
67 # We intentionally don't pass --enable-fontconfig, to let the
68 # autodetection find which library to link with.
69 ifeq ($(BR2_PACKAGE_FONTCONFIG),y)
70 MPLAYER_DEPENDENCIES += fontconfig
71 else
72 MPLAYER_CONF_OPTS += --disable-fontconfig
73 endif
75 ifeq ($(BR2_PACKAGE_LIBENCA),y)
76 MPLAYER_CONF_OPTS += --enable-enca
77 MPLAYER_DEPENDENCIES += libenca
78 else
79 MPLAYER_CONF_OPTS += --disable-enca
80 endif
82 # We intentionally don't pass --enable-fribidi, to let the
83 # autodetection find which library to link with.
84 ifeq ($(BR2_PACKAGE_LIBFRIBIDI),y)
85 MPLAYER_DEPENDENCIES += libfribidi
86 else
87 MPLAYER_CONF_OPTS += --disable-fribidi
88 endif
90 # We intentionally don't pass --enable-libiconv, to let the
91 # autodetection find which library to link with.
92 ifeq ($(BR2_PACKAGE_LIBICONV),y)
93 MPLAYER_DEPENDENCIES += libiconv
94 else
95 MPLAYER_CONF_OPTS += --disable-iconv
96 endif
98 # We intentionally don't pass --enable-termcap, in order to let the
99 # autodetection find with which library to link with. Otherwise, we
100 # would have to pass it manually.
101 ifeq ($(BR2_PACKAGE_NCURSES),y)
102 MPLAYER_DEPENDENCIES += ncurses
103 else
104 MPLAYER_CONF_OPTS += --disable-termcap
105 endif
107 # mplayer doesn't pick up libsmbclient cflags
108 ifeq ($(BR2_PACKAGE_SAMBA4),y)
109 MPLAYER_CFLAGS += `$(PKG_CONFIG_HOST_BINARY) --cflags smbclient`
110 MPLAYER_CONF_OPTS += --enable-smb
111 MPLAYER_DEPENDENCIES += samba4
112 else
113 MPLAYER_CONF_OPTS += --disable-smb
114 endif
116 ifeq ($(BR2_PACKAGE_LIBBLURAY),y)
117 MPLAYER_CONF_OPTS += --enable-bluray
118 MPLAYER_DEPENDENCIES += libbluray
119 else
120 MPLAYER_CONF_OPTS += --disable-bluray
121 endif
123 # cdio support is broken in buildroot atm due to missing libcdio-paranoia
124 # package and this patch
125 # https://github.com/pld-linux/mplayer/blob/master/mplayer-libcdio.patch
126 MPLAYER_CONF_OPTS += --disable-libcdio
128 # We intentionally don't pass --enable-dvdread, to let the
129 # autodetection find which library to link with.
130 ifeq ($(BR2_PACKAGE_LIBDVDREAD),y)
131 MPLAYER_CONF_OPTS += \
132 --with-dvdread-config="$(PKG_CONFIG_HOST_BINARY) dvdread"
133 MPLAYER_DEPENDENCIES += libdvdread
134 endif
136 # We intentionally don't pass --enable-dvdnav to let the autodetection
137 # find which library to link with.
138 ifeq ($(BR2_PACKAGE_LIBDVDNAV),y)
139 MPLAYER_CONF_OPTS += \
140 --with-dvdnav-config="$(PKG_CONFIG_HOST_BINARY) dvdnav"
141 MPLAYER_DEPENDENCIES += libdvdnav
142 endif
144 ifeq ($(BR2_PACKAGE_MPLAYER_MPLAYER),y)
145 MPLAYER_CONF_OPTS += --enable-mplayer
146 else
147 MPLAYER_CONF_OPTS += --disable-mplayer
148 endif
150 ifeq ($(BR2_PACKAGE_MPLAYER_MENCODER),y)
151 MPLAYER_CONF_OPTS += --enable-mencoder
152 else
153 MPLAYER_CONF_OPTS += --disable-mencoder
154 endif
156 ifeq ($(BR2_PACKAGE_FAAD2),y)
157 MPLAYER_DEPENDENCIES += faad2
158 MPLAYER_CONF_OPTS += --enable-faad
159 else
160 MPLAYER_CONF_OPTS += --disable-faad
161 endif
163 ifeq ($(BR2_PACKAGE_LAME),y)
164 MPLAYER_DEPENDENCIES += lame
165 MPLAYER_CONF_OPTS += --enable-mp3lame
166 else
167 MPLAYER_CONF_OPTS += --disable-mp3lame
168 endif
170 # We intentionally don't pass --disable-ass-internal --enable-ass and
171 # let autodetection find which library to link with.
172 ifeq ($(BR2_PACKAGE_LIBASS),y)
173 MPLAYER_DEPENDENCIES += libass
174 endif
176 # We intentionally don't pass --enable-libmpeg2 and let autodetection
177 # find which library to link with.
178 ifeq ($(BR2_PACKAGE_LIBMPEG2),y)
179 MPLAYER_DEPENDENCIES += libmpeg2
180 MPLAYER_CONF_OPTS += --disable-libmpeg2-internal
181 endif
183 # We intentionally don't pass --enable-mpg123, to let the
184 # autodetection find which library to link with.
185 ifeq ($(BR2_PACKAGE_MPG123),y)
186 MPLAYER_DEPENDENCIES += mpg123
187 else
188 MPLAYER_CONF_OPTS += --disable-mpg123
189 endif
191 ifeq ($(BR2_PACKAGE_TREMOR),y)
192 MPLAYER_DEPENDENCIES += tremor
193 MPLAYER_CONF_OPTS += --enable-tremor
194 endif
196 # We intentionally don't pass --enable-libvorbis, to let the
197 # autodetection find which library to link with.
198 ifeq ($(BR2_PACKAGE_LIBVORBIS),y)
199 MPLAYER_DEPENDENCIES += libvorbis
200 endif
202 ifeq ($(BR2_PACKAGE_LIBMAD),y)
203 MPLAYER_DEPENDENCIES += libmad
204 MPLAYER_CONF_OPTS += --enable-mad
205 else
206 MPLAYER_CONF_OPTS += --disable-mad
207 endif
209 ifeq ($(BR2_PACKAGE_LIVE555),y)
210 MPLAYER_DEPENDENCIES += live555
211 MPLAYER_CONF_OPTS += --enable-live
212 MPLAYER_LIVE555 = liveMedia groupsock UsageEnvironment BasicUsageEnvironment
213 MPLAYER_CFLAGS += \
214 $(addprefix -I$(STAGING_DIR)/usr/include/,$(MPLAYER_LIVE555))
215 MPLAYER_LDFLAGS += $(addprefix -l,$(MPLAYER_LIVE555)) -lstdc++
216 else
217 MPLAYER_CONF_OPTS += --disable-live
218 endif
220 ifeq ($(BR2_PACKAGE_GIFLIB),y)
221 MPLAYER_DEPENDENCIES += giflib
222 MPLAYER_CONF_OPTS += --enable-gif
223 else
224 MPLAYER_CONF_OPTS += --disable-gif
225 endif
227 # We intentionally don't pass --enable-pulse, to let the
228 # autodetection find which library to link with.
229 ifeq ($(BR2_PACKAGE_PULSEAUDIO),y)
230 MPLAYER_DEPENDENCIES += pulseaudio
231 endif
233 # We intentionally don't pass --enable-librtmp to let autodetection
234 # find which library to link with.
235 ifeq ($(BR2_PACKAGE_RTMPDUMP),y)
236 MPLAYER_DEPENDENCIES += rtmpdump
237 else
238 MPLAYER_CONF_OPTS += --disable-librtmp
239 endif
241 ifeq ($(BR2_PACKAGE_SPEEX),y)
242 MPLAYER_DEPENDENCIES += speex
243 MPLAYER_CONF_OPTS += --enable-speex
244 else
245 MPLAYER_CONF_OPTS += --disable-speex
246 endif
248 ifeq ($(BR2_PACKAGE_LZO),y)
249 MPLAYER_DEPENDENCIES += lzo
250 MPLAYER_CONF_OPTS += --enable-liblzo
251 else
252 MPLAYER_CONF_OPTS += --disable-liblzo
253 endif
255 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_BZIP2),bzip2)
256 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_HAS_LIBGL),libgl)
257 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBTHEORA),libtheora)
258 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBPNG),libpng)
259 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBVPX),libvpx)
260 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_JPEG),jpeg)
261 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_OPUS),opus)
262 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_XLIB_LIBX11),xlib_libX11)
263 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_XLIB_LIBXEXT),xlib_libXext)
264 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_XLIB_LIBXINERAMA),xlib_libXinerama)
265 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_XLIB_LIBXV),xlib_libXv)
266 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_XLIB_LIBXXF86VM),xlib_libXxf86vm)
268 # ARM optimizations
269 ifeq ($(BR2_ARM_CPU_ARMV5),y)
270 MPLAYER_CONF_OPTS += --enable-armv5te
271 endif
273 ifeq ($(BR2_ARM_CPU_ARMV6)$(BR2_ARM_CPU_ARMV7A),y)
274 MPLAYER_CONF_OPTS += --enable-armv6
275 endif
277 ifeq ($(BR2_aarch64),y)
278 MPLAYER_CONF_OPTS += --enable-armv8
279 endif
281 ifeq ($(BR2_ARM_SOFT_FLOAT),)
282 ifeq ($(BR2_ARM_CPU_HAS_NEON),y)
283 MPLAYER_CONF_OPTS += --enable-neon
284 MPLAYER_CFLAGS += -mfpu=neon
285 endif
286 endif
288 ifeq ($(BR2_i386),y)
289 # inline asm breaks with "can't find a register in class 'GENERAL_REGS'"
290 # inless we free up ebp
291 MPLAYER_CFLAGS += -fomit-frame-pointer
292 endif
294 ifeq ($(BR2_X86_CPU_HAS_MMX),y)
295 MPLAYER_CONF_OPTS += \
296 --enable-mmx \
297 --yasm=$(HOST_DIR)/usr/bin/yasm
298 MPLAYER_DEPENDENCIES += host-yasm
299 else
300 MPLAYER_CONF_OPTS += \
301 --disable-mmx \
302 --yasm=''
303 endif
305 ifeq ($(BR2_X86_CPU_HAS_SSE),y)
306 MPLAYER_CONF_OPTS += --enable-sse
307 else
308 MPLAYER_CONF_OPTS += --disable-sse
309 endif
311 ifeq ($(BR2_X86_CPU_HAS_SSE2),y)
312 MPLAYER_CONF_OPTS += --enable-sse2
313 else
314 MPLAYER_CONF_OPTS += --disable-sse2
315 endif
317 ifeq ($(BR2_X86_CPU_HAS_SSE3),y)
318 MPLAYER_CONF_OPTS += --enable-sse3
319 else
320 MPLAYER_CONF_OPTS += --disable-sse3
321 endif
323 ifeq ($(BR2_X86_CPU_HAS_SSSE3),y)
324 MPLAYER_CONF_OPTS += --enable-ssse3
325 else
326 MPLAYER_CONF_OPTS += --disable-ssse3
327 endif
329 ifeq ($(BR2_X86_CPU_HAS_SSE4),y)
330 MPLAYER_CONF_OPTS += --enable-sse4
331 else
332 MPLAYER_CONF_OPTS += --disable-sse4
333 endif
335 ifeq ($(BR2_X86_CPU_HAS_SSE42),y)
336 MPLAYER_CONF_OPTS += --enable-sse42
337 else
338 MPLAYER_CONF_OPTS += --disable-sse42
339 endif
341 ifeq ($(BR2_X86_CPU_HAS_AVX),y)
342 MPLAYER_CONF_OPTS += --enable-avx
343 else
344 MPLAYER_CONF_OPTS += --disable-avx
345 endif
347 ifeq ($(BR2_X86_CPU_HAS_AVX2),y)
348 MPLAYER_CONF_OPTS += --enable-avx2
349 else
350 MPLAYER_CONF_OPTS += --disable-avx2
351 endif
353 define MPLAYER_CONFIGURE_CMDS
354 (cd $(@D); rm -rf config.cache; \
355 $(TARGET_CONFIGURE_OPTS) \
356 $(TARGET_CONFIGURE_ARGS) \
357 ./configure \
358 --prefix=/usr \
359 --confdir=/etc \
360 --target=$(GNU_TARGET_NAME) \
361 --host-cc="$(HOSTCC)" \
362 --cc="$(TARGET_CC)" \
363 --as="$(TARGET_AS)" \
364 --charset=UTF-8 \
365 --extra-cflags="$(MPLAYER_CFLAGS)" \
366 --extra-ldflags="$(MPLAYER_LDFLAGS)" \
367 --enable-fbdev \
368 $(MPLAYER_CONF_OPTS) \
369 --enable-cross-compile \
370 --disable-ivtv \
371 --enable-dynamic-plugins \
372 --enable-inet6 \
374 endef
376 define MPLAYER_BUILD_CMDS
377 $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
378 endef
380 define MPLAYER_INSTALL_TARGET_CMDS
381 $(TARGET_MAKE_ENV) $(MAKE) DESTDIR=$(TARGET_DIR) -C $(@D) install
382 endef
384 $(eval $(generic-package))