]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/mplayer/mplayer.mk
5313b3a5efd61dfe70c0c6d9962aeaeab6bf2275
[coffee/buildroot.git] / package / mplayer / mplayer.mk
1 ################################################################################
2 #
3 # mplayer
4 #
5 ################################################################################
6
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 = GPL-2.0
12 MPLAYER_LICENSE_FILES = LICENSE Copyright
13 MPLAYER_CFLAGS = $(TARGET_CFLAGS)
14 MPLAYER_LDFLAGS = $(TARGET_LDFLAGS)
15
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
21
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
29
30 ifeq ($(BR2_ENDIAN),"BIG")
31 MPLAYER_CONF_OPTS += --enable-big-endian
32 else
33 MPLAYER_CONF_OPTS += --disable-big-endian
34 endif
35
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
48
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
57
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
66
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
74
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
81
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
89
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
97
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
106
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
115
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
122
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
127
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
135
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
143
144 ifeq ($(BR2_PACKAGE_MPLAYER_MPLAYER),y)
145 MPLAYER_CONF_OPTS += --enable-mplayer
146 else
147 MPLAYER_CONF_OPTS += --disable-mplayer
148 endif
149
150 ifeq ($(BR2_PACKAGE_MPLAYER_MENCODER),y)
151 MPLAYER_CONF_OPTS += --enable-mencoder
152 else
153 MPLAYER_CONF_OPTS += --disable-mencoder
154 endif
155
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
162
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
169
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
175
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
182
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
190
191 ifeq ($(BR2_PACKAGE_TREMOR),y)
192 MPLAYER_DEPENDENCIES += tremor
193 MPLAYER_CONF_OPTS += --enable-tremor
194 endif
195
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
201
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
208
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
219
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
226
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
232
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
240
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
247
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
254
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)
267
268 # ARM optimizations
269 ifeq ($(BR2_ARM_CPU_ARMV5),y)
270 MPLAYER_CONF_OPTS += --enable-armv5te
271 endif
272
273 ifeq ($(BR2_ARM_CPU_ARMV6)$(BR2_ARM_CPU_ARMV7A),y)
274 MPLAYER_CONF_OPTS += --enable-armv6
275 endif
276
277 ifeq ($(BR2_aarch64),y)
278 MPLAYER_CONF_OPTS += --enable-armv8
279 endif
280
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
287
288 define MPLAYER_DISABLE_INLINE_ASM
289         $(SED) 's,#define HAVE_INLINE_ASM 1,#define HAVE_INLINE_ASM 0,g' \
290                 $(@D)/config.h
291         $(SED) 's,#define HAVE_MMX_INLINE 1,#define HAVE_MMX_INLINE 0,g' \
292                 $(@D)/config.h
293         $(SED) 's,#define HAVE_MMX_EXTERNAL 1,#define HAVE_MMX_EXTERNAL 0,g' \
294                 $(@D)/config.h
295 endef
296
297 ifeq ($(BR2_i386),y)
298 MPLAYER_POST_CONFIGURE_HOOKS += MPLAYER_DISABLE_INLINE_ASM
299 endif
300
301 ifeq ($(BR2_X86_CPU_HAS_MMX),y)
302 MPLAYER_CONF_OPTS += \
303         --enable-mmx \
304         --yasm=$(HOST_DIR)/bin/yasm
305 MPLAYER_DEPENDENCIES += host-yasm
306 else
307 MPLAYER_CONF_OPTS += \
308         --disable-mmx \
309         --yasm=''
310 endif
311
312 ifeq ($(BR2_X86_CPU_HAS_SSE),y)
313 MPLAYER_CONF_OPTS += --enable-mmxext --enable-sse
314 else
315 MPLAYER_CONF_OPTS += --disable-mmxext --disable-sse
316 endif
317
318 ifeq ($(BR2_X86_CPU_HAS_SSE2),y)
319 MPLAYER_CONF_OPTS += --enable-sse2
320 else
321 MPLAYER_CONF_OPTS += --disable-sse2
322 endif
323
324 ifeq ($(BR2_X86_CPU_HAS_SSE3),y)
325 MPLAYER_CONF_OPTS += --enable-sse3
326 else
327 MPLAYER_CONF_OPTS += --disable-sse3
328 endif
329
330 ifeq ($(BR2_X86_CPU_HAS_SSSE3),y)
331 MPLAYER_CONF_OPTS += --enable-ssse3
332 else
333 MPLAYER_CONF_OPTS += --disable-ssse3
334 endif
335
336 ifeq ($(BR2_X86_CPU_HAS_SSE4),y)
337 MPLAYER_CONF_OPTS += --enable-sse4
338 else
339 MPLAYER_CONF_OPTS += --disable-sse4
340 endif
341
342 ifeq ($(BR2_X86_CPU_HAS_SSE42),y)
343 MPLAYER_CONF_OPTS += --enable-sse42
344 else
345 MPLAYER_CONF_OPTS += --disable-sse42
346 endif
347
348 ifeq ($(BR2_X86_CPU_HAS_AVX),y)
349 MPLAYER_CONF_OPTS += --enable-avx
350 else
351 MPLAYER_CONF_OPTS += --disable-avx
352 endif
353
354 ifeq ($(BR2_X86_CPU_HAS_AVX2),y)
355 MPLAYER_CONF_OPTS += --enable-avx2
356 else
357 MPLAYER_CONF_OPTS += --disable-avx2
358 endif
359
360 define MPLAYER_CONFIGURE_CMDS
361         (cd $(@D); rm -rf config.cache; \
362                 $(TARGET_CONFIGURE_OPTS) \
363                 $(TARGET_CONFIGURE_ARGS) \
364                 ./configure \
365                 --prefix=/usr \
366                 --confdir=/etc \
367                 --target=$(GNU_TARGET_NAME) \
368                 --host-cc="$(HOSTCC)" \
369                 --cc="$(TARGET_CC)" \
370                 --as="$(TARGET_AS)" \
371                 --charset=UTF-8 \
372                 --extra-cflags="$(MPLAYER_CFLAGS)" \
373                 --extra-ldflags="$(MPLAYER_LDFLAGS)" \
374                 --enable-fbdev \
375                 $(MPLAYER_CONF_OPTS) \
376                 --enable-cross-compile \
377                 --disable-ivtv \
378                 --enable-dynamic-plugins \
379                 --enable-inet6 \
380         )
381 endef
382
383 define MPLAYER_BUILD_CMDS
384         $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
385 endef
386
387 define MPLAYER_INSTALL_TARGET_CMDS
388         $(TARGET_MAKE_ENV) $(MAKE) DESTDIR=$(TARGET_DIR) -C $(@D) install
389 endef
390
391 $(eval $(generic-package))