aboutsummaryrefslogtreecommitdiff
path: root/multimedia/mplayerxp/Makefile
blob: 89aa71c4621283ff6b4f8ed356dfb62cf79499a6 (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
# New ports collection makefile for:	mplayerxp
# Date created:		10 August 2001
# Whom:			Thomas E. Zander
#			with lots of help from Vladimir Kushnir
# $FreeBSD$
#

PORTNAME=	mplayerxp
PORTVERSION=	0.6.2
PORTREVISION=	4
CATEGORIES=	multimedia audio
MASTER_SITES=	SF

MAINTAINER=	ports@FreeBSD.org
COMMENT=	Multi-threaded branch of the well known mplayer media player

LIB_DEPENDS=	mp3lame.0:${PORTSDIR}/audio/lame \
		jpeg.9:${PORTSDIR}/graphics/jpeg \
		png.5:${PORTSDIR}/graphics/png \
		vcdinfo.2:${PORTSDIR}/multimedia/vcdimager
RUN_DEPENDS=	${LOCALBASE}/share/mplayer/fonts:${PORTSDIR}/multimedia/mplayer-fonts

ONLY_FOR_ARCHS=	i386

USE_BZIP2=	yes
USE_ICONV=	yes
USE_GMAKE=	yes
HAS_CONFIGURE=	yes
WANT_SDL=	yes
USE_LDCONFIG=	yes

MAN1=	mplayerxp.1

WIN32_CODEC_PREFIX=	${LOCALBASE}/lib/win32

.include <bsd.port.pre.mk>

.if ${OSVERSION} >= 700042
BROKEN=		Does not compile with GCC 4.2
.endif

# add this after <bsd.port.pre.mk> so that we inherit /etc/make.conf
CONFIGURE_ARGS+=	--with-extralibdir=${LOCALBASE}/lib \
		--with-extraincdir=${LOCALBASE}/include \
		--with-x11incdir=${LOCALBASE}/include \
		--with-x11libdir=${LOCALBASE}/lib \
		--cc=${CC} \
		--prefix=${PREFIX} \
		--confdir=${PREFIX}/etc/${PORTNAME} \
		--datadir=${LOCALBASE}/share/mplayer \
		--disable-fbdev \
		--disable-lirc \
		--disable-rtc \
		--disable-vm \
		--disable-tv-v4l
CONFIGURE_ENV+=	LANG=C
# insure CC,LD safeness
MAKE_ARGS+=	CC="${CC}" LD="${LD}"

CFLAGS+=	-I${LOCALBASE}/include
CFLAGS+=	-fomit-frame-pointer

##
## Feature detection
##

# xine libdvdnav
.if exists(${LOCALBASE}/lib/libdvdnav.so)
WITH_DVD=yes
WITH_LIBDVDNAV=yes
.endif
.if exists(${LOCALBASE}/lib/libdvdplay.a)
# ogle's libdvdplay
WITH_DVD=yes
WITH_DVDPLAY=yes
.endif
# cdparanoia (cdda support)
.if exists(${LOCALBASE}/lib/libcdda_paranoia.so)
WITH_CDPARANOIA=yes
.endif
# ogle's libdvdread (dvd support)
.if exists(${LOCALBASE}/lib/libdvdread.a)
WITH_DVD=yes
.endif
# sdl
.if ${HAVE_SDL:Msdl}!=""
WITH_SDL=yes
.endif
# sdl_image
.if ${HAVE_SDL:Mimage}!=""
WITH_SDL_IMAGE=yes
.endif
# xvid
.if exists(${LOCALBASE}/lib/libxvidcore.so)
WITH_XVID=yes
.endif

##
## Feature activation and Library Dependencies
##

# libdvdnav does not currently work
.undef WITH_LIBDVDNAV
WITHOUT_LIBDVDNAV=yes

# compilation optimizations
.if defined(WITH_OPTIMIZED_CFLAGS)
CFLAGS+=	-O3 -ffast-math
.endif
# cdda support
.if defined(WITH_CDPARANOIA)
LIB_DEPENDS+=	cdda_paranoia.0:${PORTSDIR}/audio/cdparanoia
.else
CONFIGURE_ARGS+=	--disable-cdparanoia
.endif
# dvd support
.if defined(WITH_DVD)
LIB_DEPENDS+=	dvdread.5:${PORTSDIR}/multimedia/libdvdread

CONFIGURE_ARGS+=	--with-csslibdir=${LOCALBASE}/lib
PLIST_SUB+=	DVD=''
.else
PLIST_SUB+=	DVD='@comment '
.endif
# xine libdvdnav
.if defined(WITH_LIBDVDNAV) && !defined(WITHOUT_LIBDVDNAV)
LIB_DEPENDS+=	dvdnav.4:${PORTSDIR}/multimedia/libdvdnav

CONFIGURE_ARGS+=	--with-libdvdnav=${LOCALBASE}
.endif
# ogle's libdvdplay
.if defined(WITH_LIBDVDPLAY) && !defined(WITHOUT_LIBDVDPLAY)
LIB_DEPENDS+=	dvdplay.0:${PORTSDIR}/multimedia/libdvdplay

CONFIGURE_ARGS+=	--with-libdvdplay=${LOCALBASE}
.endif
# sdl
.if defined(WITH_SDL)
USE_SDL=	sdl
CONFIGURE_ARGS+=	--enable-sdl
.else
CONFIGURE_ARGS+=	--disable-sdl
.endif
# sdl_image
.if defined(WITH_SDL_IMAGE)
USE_SDL+=	image
CONFIGURE_ARGS+=	--enable-sdl-image
.else
CONFIGURE_ARGS+=	--disable-sdl-image
.endif
# xvid
.if defined(WITH_XVID)
LIB_DEPENDS+=	xvidcore.4:${PORTSDIR}/multimedia/xvid

CONFIGURE_ARGS+=	--enable-xvid \
			--with-xvidcore=${LOCALBASE}
.else
CONFIGURE_ARGS+=	--disable-xvid
.endif
# termcap key support
# mplayerxp does not clean up after itself yet
.if defined(WITH_TERMCAP)
CONFIGURE_ARGS+=	--enable-termcap
.else
CONFIGURE_ARGS+=	--disable-termcap
.endif
# win32 binary dll codecs
.if !defined(WITHOUT_WIN32_CODECS)
RUN_DEPENDS+=	${CODEC_DETECTION_FILE}:${CODEC_PORT}

CODEC_PORT=	${PORTSDIR}/multimedia/win32-codecs
CODEC_DETECTION_FILE!=	${MAKE} -f ${CODEC_PORT}/Makefile -V CODEC_DETECTION_FILE
.endif

pre-everything::
.if !defined(WITH_OPTIMIZED_CFLAGS)
	@${ECHO_MSG} '===>'
	@${ECHO_MSG} '===> You can enable additional compilation optimizations'
	@${ECHO_MSG} '		by defining WITH_OPTIMIZED_CFLAGS.'
.endif
.if !defined(WITH_CDPARANOIA)
	@${ECHO_MSG} '===>'
	@${ECHO_MSG} '===> You can enable cdda support by defining WITH_CDPARANOIA.'
.endif
.if !defined(WITH_DVD)
	@${ECHO_MSG} '===>'
	@${ECHO_MSG} '===> You can enable DVD support by defining WITH_DVD.'
.endif
.if !defined(WITH_LIBDVDNAV)
	@${ECHO_MSG} '===>'
	@${ECHO_MSG} '===> You can enable LIBDVDNAV support by defining WITH_LIBDVDNAV.'
.endif
.if !defined(WITH_LIBDVDNAV)
	@${ECHO_MSG} '===>'
	@${ECHO_MSG} '===> You can enable LIBDVDPLAY support by defining WITH_LIBDVDPLAY.'
.endif
.if !defined(WITH_SDL)
	@${ECHO_MSG} '===>'
	@${ECHO_MSG} '===> You can enable SDL support by defining WITH_SDL.'
.endif
.if !defined(WITH_SDL_IMAGE)
	@${ECHO_MSG} '===>'
	@${ECHO_MSG} '===> You can enable SDL_image support by defining WITH_SDL_IMAGE.'
.endif
.if !defined(WITH_TERMCAP)
	@${ECHO_MSG} '===>'
	@${ECHO_MSG} '===> You can enable termcap key database support by defining WITH_TERMCAP.'
.endif
.if !defined(WITH_XVID)
	@${ECHO_MSG} '===>'
	@${ECHO_MSG} '===> You can enable XVID support by defining WITH_XVID.'
.endif
.if !defined(WITHOUT_WIN32_CODECS)
	@${ECHO_MSG} '===>'
	@${ECHO_MSG} '===> You can disable support for Win32 codecs by defining WITHOUT_WIN32_CODECS'
.endif
	@${ECHO_MSG} '===>'

post-patch:
# win32 codec location
	@${REINPLACE_CMD} -E -e \
		's|WIN32_PATH|"${WIN32_CODEC_PREFIX}"|' \
		${WRKSRC}/loader/win32.c
# FreeBSD's install utility does not support -D flag
	@${FIND} ${WRKSRC} -name Makefile | \
		${XARGS} -x -n 10 ${REINPLACE_CMD} -E -e \
		's,(\$$\(INSTALL\)|install)(.*)-D,${INSTALL}\2,'
# PTHREAD_{CFLAGS,LIBS}
# stdint.h -> inttypes.h
	@${REINPLACE_CMD} -E -e  \
		's|-lpthread|${PTHREAD_LIBS}|; \
		s|-D_THREAD_SAFE|${PTHREAD_CFLAGS}|; \
		s|<stdint\.h>|<inttypes.h>|' \
		${WRKSRC}/mplayerxp/configure
# ffmpeg currently is not compatible with mplayerxp
#.for file in ad_ffmp3.c vd_ffmpeg.c
#	@${REINPLACE_CMD} -e 's|libavcodec.so|libNOTavcodec.so|' \
#		${WRKSRC}/mplayerxp/libmpcodecs/${file}
#.endfor
# native libdivxdecore is not compatible with mplayerxp
.for file in vd_divx4.c vd_xvid.c
	@${REINPLACE_CMD} -e 's|libdivxdecore|libNOTdivxdecore|' \
		${WRKSRC}/mplayerxp/libmpcodecs/${file}
.endfor

pre-install:
# create dirs before installation since the port uses a install
# utility option not available in FreeBSD
.for dir in etc/mplayerxp lib/mplayerxp/codecs lib/mplayerxp/wine
	@${MKDIR} ${PREFIX}/${dir}
.endfor

.include <bsd.port.post.mk>