lua-bit32: new package
[buildroot-gz.git] / package / mplayer / mplayer.mk
blob07307cede270c3c4a7b177e211f0883270920805
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-librtmp to let autodetection
228 # find which library to link with.
229 ifeq ($(BR2_PACKAGE_RTMPDUMP),y)
230 MPLAYER_DEPENDENCIES += rtmpdump
231 else
232 MPLAYER_CONF_OPTS += --disable-librtmp
233 endif
235 ifeq ($(BR2_PACKAGE_SPEEX),y)
236 MPLAYER_DEPENDENCIES += speex
237 MPLAYER_CONF_OPTS += --enable-speex
238 else
239 MPLAYER_CONF_OPTS += --disable-speex
240 endif
242 ifeq ($(BR2_PACKAGE_LZO),y)
243 MPLAYER_DEPENDENCIES += lzo
244 MPLAYER_CONF_OPTS += --enable-liblzo
245 else
246 MPLAYER_CONF_OPTS += --disable-liblzo
247 endif
249 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_BZIP2),bzip2)
250 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_HAS_LIBGL),libgl)
251 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBTHEORA),libtheora)
252 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBPNG),libpng)
253 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBVPX),libvpx)
254 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_JPEG),jpeg)
255 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_OPUS),opus)
256 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_XLIB_LIBX11),xlib_libX11)
257 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_XLIB_LIBXEXT),xlib_libXext)
258 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_XLIB_LIBXINERAMA),xlib_libXinerama)
259 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_XLIB_LIBXV),xlib_libXv)
260 MPLAYER_DEPENDENCIES += $(if $(BR2_PACKAGE_XLIB_LIBXXF86VM),xlib_libXxf86vm)
262 # ARM optimizations
263 ifeq ($(BR2_ARM_CPU_ARMV5),y)
264 MPLAYER_CONF_OPTS += --enable-armv5te
265 endif
267 ifeq ($(BR2_ARM_CPU_ARMV6)$(BR2_ARM_CPU_ARMV7A),y)
268 MPLAYER_CONF_OPTS += --enable-armv6
269 endif
271 ifeq ($(BR2_aarch64),y)
272 MPLAYER_CONF_OPTS += --enable-armv8
273 endif
275 ifeq ($(BR2_ARM_SOFT_FLOAT),)
276 ifeq ($(BR2_ARM_CPU_HAS_NEON),y)
277 MPLAYER_CONF_OPTS += --enable-neon
278 MPLAYER_CFLAGS += -mfpu=neon
279 endif
280 endif
282 ifeq ($(BR2_i386),y)
283 # inline asm breaks with "can't find a register in class 'GENERAL_REGS'"
284 # inless we free up ebp
285 MPLAYER_CFLAGS += -fomit-frame-pointer
286 endif
288 ifeq ($(BR2_X86_CPU_HAS_MMX),y)
289 MPLAYER_CONF_OPTS += \
290 --enable-mmx \
291 --yasm=$(HOST_DIR)/usr/bin/yasm
292 MPLAYER_DEPENDENCIES += host-yasm
293 else
294 MPLAYER_CONF_OPTS += \
295 --disable-mmx \
296 --yasm=''
297 endif
299 ifeq ($(BR2_X86_CPU_HAS_SSE),y)
300 MPLAYER_CONF_OPTS += --enable-sse
301 else
302 MPLAYER_CONF_OPTS += --disable-sse
303 endif
305 ifeq ($(BR2_X86_CPU_HAS_SSE2),y)
306 MPLAYER_CONF_OPTS += --enable-sse2
307 else
308 MPLAYER_CONF_OPTS += --disable-sse2
309 endif
311 ifeq ($(BR2_X86_CPU_HAS_SSE3),y)
312 MPLAYER_CONF_OPTS += --enable-sse3
313 else
314 MPLAYER_CONF_OPTS += --disable-sse3
315 endif
317 ifeq ($(BR2_X86_CPU_HAS_SSSE3),y)
318 MPLAYER_CONF_OPTS += --enable-ssse3
319 else
320 MPLAYER_CONF_OPTS += --disable-ssse3
321 endif
323 ifeq ($(BR2_X86_CPU_HAS_SSE4),y)
324 MPLAYER_CONF_OPTS += --enable-sse4
325 else
326 MPLAYER_CONF_OPTS += --disable-sse4
327 endif
329 ifeq ($(BR2_X86_CPU_HAS_SSE42),y)
330 MPLAYER_CONF_OPTS += --enable-sse42
331 else
332 MPLAYER_CONF_OPTS += --disable-sse42
333 endif
335 ifeq ($(BR2_X86_CPU_HAS_AVX),y)
336 MPLAYER_CONF_OPTS += --enable-avx
337 else
338 MPLAYER_CONF_OPTS += --disable-avx
339 endif
341 ifeq ($(BR2_X86_CPU_HAS_AVX2),y)
342 MPLAYER_CONF_OPTS += --enable-avx2
343 else
344 MPLAYER_CONF_OPTS += --disable-avx2
345 endif
347 define MPLAYER_CONFIGURE_CMDS
348 (cd $(@D); rm -rf config.cache; \
349 $(TARGET_CONFIGURE_OPTS) \
350 $(TARGET_CONFIGURE_ARGS) \
351 ./configure \
352 --prefix=/usr \
353 --confdir=/etc \
354 --target=$(GNU_TARGET_NAME) \
355 --host-cc="$(HOSTCC)" \
356 --cc="$(TARGET_CC)" \
357 --as="$(TARGET_AS)" \
358 --charset=UTF-8 \
359 --extra-cflags="$(MPLAYER_CFLAGS)" \
360 --extra-ldflags="$(MPLAYER_LDFLAGS)" \
361 --enable-fbdev \
362 $(MPLAYER_CONF_OPTS) \
363 --enable-cross-compile \
364 --disable-ivtv \
365 --enable-dynamic-plugins \
366 --enable-inet6 \
368 endef
370 define MPLAYER_BUILD_CMDS
371 $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
372 endef
374 define MPLAYER_INSTALL_TARGET_CMDS
375 $(TARGET_MAKE_ENV) $(MAKE) DESTDIR=$(TARGET_DIR) -C $(@D) install
376 endef
378 $(eval $(generic-package))