aboutsummaryrefslogtreecommitdiffstats
path: root/multimedia/mplayer2/Makefile
blob: 1c85c7b4169858b4e408f92a294b296b7b2b487f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
# $FreeBSD$

PORTNAME=   mplayer2
PORTVERSION=    ${MPLAYER2_PORT_VERSION}
CATEGORIES= multimedia audio
MASTER_SITES=   LOCAL/gblach/

MAINTAINER= gblach@FreeBSD.org
COMMENT=    Advanced general-purpose video player

LICENSE=    GPLv2

LIB_DEPENDS=    png15:${PORTSDIR}/graphics/png \
        freetype:${PORTSDIR}/print/freetype2
BUILD_DEPENDS=  ffmpeg1:${PORTSDIR}/multimedia/ffmpeg1 \
        rst2man:${PORTSDIR}/textproc/py-docutils
RUN_DEPENDS=    ffmpeg1:${PORTSDIR}/multimedia/ffmpeg1

USE_XZ=     yes
USE_GMAKE=  yes
USE_PYTHON= 3.1+
USE_ICONV=  yes
USE_NCURSES=    yes
HAS_CONFIGURE=  yes
CONFIGURE_ENV=  PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" \
        PTHREAD_LIBS="${PTHREAD_LIBS}" \
        TMPDIR="${WRKSRC}"
CONFIGURE_ARGS= --cc=${CC} \
        --extra-cflags='-I${LOCALBASE}/include/ffmpeg1 \
        -I${LOCALBASE}/include/portaudio2' \
        --extra-ldflags='-L${LOCALBASE}/lib/ffmpeg1 \
        -L${LOCALBASE}/lib/portaudio2' \
        --mandir=${PREFIX}/man \
        --disable-alsa \
        --disable-liba52 \
        --disable-directfb \
        --disable-faad \
        --disable-mng \
        --disable-libdca \
        --disable-xvid \
        --disable-mpg123 \
        --disable-musepack
MAKE_ARGS+= BINDIR=${PREFIX}/bin \
        CONFDIR=${PREFIX}/etc/mplayer

MPLAYER2_SNAPSHOT_DATE= 2012-11-03
MPLAYER2_PORT_VERSION=  2.0.${MPLAYER2_SNAPSHOT_DATE:S/-//g}

MAKE_JOBS_SAFE= yes

OPTIONS_DEFINE= DEBUG RTC IPV6 SMB JOYSTICK \
        DVDREAD LIBBLURAY V4L DV THEORA \
        X11 XINERAMA OPENGL SDL VDPAU GIF CACA \
        MAD SPEEX LIBCDIO LADSPA REALPLAYER \
        JACK PULSE PORTAUDIO ASS LIRC
OPTIONS_DEFAULT=DVDREAD X11 ASS

.if !defined(PACKAGE_BUILDING)
OPTIONS_DEFINE+=    WIN32
OPTIONS_DEFAULT+=   WIN32
.endif

DVDREAD_DESC=   Enable dvdread support
RTC_DESC=   Enable kernel realtime clock timing
PULSE_DESC= Enable PulseAudio support
THEORA_DESC=    Enable ogg theora video support
ASS_DESC=   Enable ASS/SSA subtitle rendering
WIN32_DESC= Enable win32 codec set on the IA32 arch
REALPLAYER_DESC=Enable realplayer plugin
LIRC_DESC=  Enable lirc support
LIBCDIO_DESC=   Enable libcdio support
JOYSTICK_DESC=  Enable joystick support
V4L_DESC=   Enable Video4Linux TV support

MAN1=       mplayer.1
MANCOMPRESSED=  no

SUB_FILES=  pkg-message

CONFLICTS=  mplayer-1.*

.include <bsd.port.options.mk>

.if ${ARCH} == "sparc64"
BROKEN=     Does not compile on sparc64
.endif

.if ${OSVERSION} < 802502
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-base_system_log2f
.endif

.if ${OSVERSION} < 803000
CONFIGURE_ARGS+=    --disable-ssse3
.endif

WITH_CDROM_DEVICE?= /dev/cd0

#On i386, gcc runs out of general purpose registers when
#trying to compile a debug version with the default flags.
.if ${PORT_OPTIONS:MDEBUG}
.if ${ARCH} == "i386"
DEBUG_FLAGS=        -g -O -fomit-frame-pointer
.endif
.else
.if defined(PACKAGE_BUILDING)
CONFIGURE_ARGS+=    --enable-runtime-cpudetection
CFLAGS+=        -O2 -fomit-frame-pointer
.else
CONFIGURE_ENV+=     CPPFLAGS= CFLAGS= LDFLAGS=
.endif
.endif

.if ${PORT_OPTIONS:MIPV6}
CATEGORIES+=        ipv6
.else
CONFIGURE_ARGS+=    --disable-inet6
.endif

.if ${PORT_OPTIONS:MGIF}
LIB_DEPENDS+=       gif:${PORTSDIR}/graphics/giflib
.else
CONFIGURE_ARGS+=    --disable-gif
.endif

.if ${PORT_OPTIONS:MMAD}
LIB_DEPENDS+=       mad:${PORTSDIR}/audio/libmad
.else
CONFIGURE_ARGS+=    --disable-mad
.endif

.if ${PORT_OPTIONS:MDV}
LIB_DEPENDS+=       dv:${PORTSDIR}/multimedia/libdv
.else
CONFIGURE_ARGS+=    --disable-libdv
.endif

.if ${PORT_OPTIONS:MTHEORA}
LIB_DEPENDS+=       theora:${PORTSDIR}/multimedia/libtheora
.else
CONFIGURE_ARGS+=    --disable-theora
.endif

.if ${PORT_OPTIONS:MSPEEX}
LIB_DEPENDS+=       speex:${PORTSDIR}/audio/speex
.else
CONFIGURE_ARGS+=    --disable-speex
.endif

.if ${PORT_OPTIONS:MJACK}
LIB_DEPENDS+=       jack:${PORTSDIR}/audio/jack
.else
CONFIGURE_ARGS+=    --disable-jack
.endif

.if ${PORT_OPTIONS:MPULSE}
LIB_DEPENDS+=       pulse:${PORTSDIR}/audio/pulseaudio
.else
CONFIGURE_ARGS+=    --disable-pulse
.endif

.if ${PORT_OPTIONS:MPORTAUDIO}
LIB_DEPENDS+=       portaudio.2:${PORTSDIR}/audio/portaudio2
.else
CONFIGURE_ARGS+=    --disable-portaudio
.endif

.if ${PORT_OPTIONS:MLIBBLURAY}
LIB_DEPENDS+=       bluray:${PORTSDIR}/multimedia/libbluray
CONFIGURE_ARGS+=    --enable-bluray
.else
CONFIGURE_ARGS+=    --disable-bluray
.endif

.if ${PORT_OPTIONS:MDVDREAD}
LIB_DEPENDS+=       dvdread:${PORTSDIR}/multimedia/libdvdread
CONFIGURE_ARGS+=    --enable-dvdread
.else
CONFIGURE_ARGS+=    --disable-dvdread
.endif

.if ${PORT_OPTIONS:MSMB}
LIB_DEPENDS+=       smbclient:${PORTSDIR}/net/samba-libsmbclient
.else
CONFIGURE_ARGS+=    --disable-smb
.endif

.if ${PORT_OPTIONS:MLIBCDIO}
LIB_DEPENDS+=       cdio:${PORTSDIR}/sysutils/libcdio
.else
CONFIGURE_ARGS+=    --disable-libcdio
.endif

.if ${PORT_OPTIONS:MLADSPA}
RUN_DEPENDS+=       ${LOCALBASE}/lib/ladspa/amp.so:${PORTSDIR}/audio/ladspa
.else
CONFIGURE_ARGS+=    --disable-ladspa
.endif

.if ${ARCH} == "i386" || ${ARCH} == "amd64"
.if ${PORT_OPTIONS:MWIN32} && !defined(PACKAGE_BUILDING) && ${ARCH} == "i386"
CODEC_PORT=     ${PORTSDIR}/multimedia/win32-codecs
CODEC_DETECTION_FILE!=  ${MAKE} -f ${CODEC_PORT}/Makefile -V CODEC_DETECTION_FILE
RUN_DEPENDS+=       ${CODEC_DETECTION_FILE}:${CODEC_PORT}
CONFIGURE_ARGS+=    --codecsdir=${LOCALBASE}/lib/win32
.else
CONFIGURE_ARGS+=    --disable-win32dll --disable-qtx
.endif
.endif # ARCH == i386/amd64

.if ${PORT_OPTIONS:MREALPLAYER}
RUN_DEPENDS+=       realplay:${PORTSDIR}/multimedia/linux-realplayer
BUILD_DEPENDS+=     realplay:${PORTSDIR}/multimedia/linux-realplayer
.else
CONFIGURE_ARGS+=    --disable-real
.endif

.if ${PORT_OPTIONS:MV4L}
BUILD_DEPENDS+=     ${LOCALBASE}/include/linux/videodev2.h:${PORTSDIR}/multimedia/v4l_compat
LIB_DEPENDS+=       v4l2:${PORTSDIR}/multimedia/libv4l
CONFIGURE_ARGS+=    --enable-tv-v4l1 --enable-tv-v4l2
EXTRA_LIBS+=        -lv4l1 -lv4l2
.else
CONFIGURE_ARGS+=    --disable-tv-v4l1 --disable-tv-v4l2
.endif

.if defined(EXTRA_LIBS)
CONFIGURE_ARGS+=    --extra-libs="${EXTRA_LIBS}"
.endif

.if ${PORT_OPTIONS:MASS}
LIB_DEPENDS+=       ass:${PORTSDIR}/multimedia/libass
.else
CONFIGURE_ARGS+=    --disable-libass --disable-enca
.endif

.if ${PORT_OPTIONS:MX11}
USE_XORG=       x11 xv xxf86vm
.if ${PORT_OPTIONS:MOPENGL}
USE_XORG+=      glproto
LIB_DEPENDS+=       GL:${PORTSDIR}/graphics/libGL
.else
CONFIGURE_ARGS+=    --disable-gl
.endif
.if ${PORT_OPTIONS:MXINERAMA}
USE_XORG+=      xinerama xineramaproto
.else
CONFIGURE_ARGS+=    --disable-xinerama
.endif
.else           #WITHOUT_X11
CONFIGURE_ARGS+=    --disable-x11 --disable-fontconfig
.endif

.if ${PORT_OPTIONS:MVDPAU}
LIB_DEPENDS+=       vdpau:${PORTSDIR}/multimedia/libvdpau
.else
CONFIGURE_ARGS+=    --disable-vdpau
.endif

.if ${PORT_OPTIONS:MRTC}
BUILD_DEPENDS+= ${LOCALBASE}/modules/rtc.ko:${PORTSDIR}/emulators/rtc
RUN_DEPENDS+=   ${LOCALBASE}/modules/rtc.ko:${PORTSDIR}/emulators/rtc
CONFIGURE_ARGS+=    --enable-rtc
.else
CONFIGURE_ARGS+=    --disable-rtc
.endif

.if ${PORT_OPTIONS:MLIBCACA}
LIB_DEPENDS+=       caca:${PORTSDIR}/graphics/libcaca
.else
CONFIGURE_ARGS+=    --disable-caca
.endif

.if ${PORT_OPTIONS:MLIRC}
LIB_DEPENDS+=       lirc_client:${PORTSDIR}/comms/lirc
.else
CONFIGURE_ARGS+=    --disable-lirc
.endif

.if ${PORT_OPTIONS:MSDL}
USE_SDL=        sdl
.else
CONFIGURE_ARGS+=    --disable-sdl
.endif

.if defined(WITH_KERN_HZ)
DEFAULT_KERN_HZ=${WITH_KERN_HZ}
.else
DEFAULT_KERN_HZ=1024
.endif

.if ${PORT_OPTIONS:MJOYSTICK}
BUILD_DEPENDS+=     ${LOCALBASE}/include/linux/joystick.h:${PORTSDIR}/devel/linux-js
CONFIGURE_ARGS+=    --enable-joystick
.else
CONFIGURE_ARGS+=    --disable-joystick
.endif

pre-everything::
    @${ECHO_MSG} "N - O - T - E"
    @${ECHO_MSG} ""
    @${ECHO_MSG} "There are some knobs which *can* *not* be selected via the"
    @${ECHO_MSG} "OPTIONS framework. You might want to check the Makefile in"
    @${ECHO_MSG} "order to learn more about them."

post-patch:
.if ${OSVERSION} >= 900010
    @${REINPLACE_CMD} -e \
        '/CFLAGS.*-D_LARGEFILE64_SOURCE/ s/-D_LARGEFILE64_SOURCE/-D_FILE_OFFSET_BITS=64/' \
        ${CONFIGURE_WRKSRC}/${CONFIGURE_SCRIPT}
.endif
    @${REINPLACE_CMD} \
        -e 's/libavutil/libavutil1/' \
        -e 's/libavcodec/libavcodec1/' \
        -e 's/libavformat/libavformat1/' \
        -e 's/libswscale/libswscale1/' \
        ${CONFIGURE_WRKSRC}/${CONFIGURE_SCRIPT}
    @${REINPLACE_CMD} \
        -e 's|/dev/acd0|${WITH_CDROM_DEVICE}|' \
        -e 's|/usr/local|${LOCALBASE}|' \
        -e 's|-lbz2|/usr/lib/libbz2.so|' \
        -e 's|-lncurses|/usr/lib/libncurses.so|' \
        ${CONFIGURE_WRKSRC}/${CONFIGURE_SCRIPT}
    @${FIND} -E ${WRKSRC} -type f \
        -iregex ".*(configure|.sh|Makefile)" -print0 | \
        ${XARGS} -x -0 -n 10 \
        ${REINPLACE_CMD} -E \
            -e 's|[[:space:]]gcc[-[:digit:]\.]+| ${CC}|' \
            -e 's|[[:space:]]gcc| ${CC}|' \
            -e 's|\$$\(CC\)|${CC}|' \
            -e 's|/usr/X11R6|${LOCALBASE}|'
    @${FIND} -E ${WRKSRC}/TOOLS -type f -name '*.py' -print0 | \
        ${XARGS} -0 ${REINPLACE_CMD} \
        -e 's|#!/usr/bin/env python3|#!${PYTHON_CMD}|'
    @${FIND} ${WRKSRC}/DOCS/man -name "mplayer.1" | ${XARGS} ${REINPLACE_CMD} -E -e \
        's|/usr/\\:local/\\:etc/\\:mplayer|${DATADIR:S/\//\/\\\:/g}|g ; \
         s|/dev/\\:(dvd[[:alnum:]]*[[:>:]])|${WITH_CDROM_DEVICE:S/dev\//dev\/\\\:/}|g ; \
         s|/dev/\\:(cdrom[[:alnum:]]*[[:>:]])|${WITH_CDROM_DEVICE:S/dev\//dev\/\\\:/}|g'
.if ${PORT_OPTIONS:MRTC}
    @${REINPLACE_CMD} -e \
        's|irqp = 1024|irqp = ${DEFAULT_KERN_HZ}|' \
        ${WRKSRC}/mplayer.c
.endif

post-install:
    @${INSTALL_DATA} ${WRKSRC}/etc/example.conf ${PREFIX}/etc/mplayer/mplayer.conf.sample
.for conf in codecs input
    @${INSTALL_DATA} ${WRKSRC}/etc/${conf}.conf ${PREFIX}/etc/mplayer/${conf}.conf.sample
.endfor
    @${CAT} ${PKGMESSAGE}

.include <bsd.port.mk>