aboutsummaryrefslogtreecommitdiffstats
path: root/multimedia/mplayerxp/Makefile
blob: d5d502d465894c4e6886af5233933dccde23f802 (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
# Created by: Thomas E. Zander with lots of help from Vladimir Kushnir
# $FreeBSD$

PORTNAME=   mplayerxp
PORTVERSION=    0.7.2
PORTREVISION=   11
CATEGORIES= multimedia audio
MASTER_SITES=   SF

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

LIB_DEPENDS=    libjpeg.so:${PORTSDIR}/graphics/jpeg \
        libpng15.so:${PORTSDIR}/graphics/png \
        libvcdinfo.so:${PORTSDIR}/multimedia/vcdimager
RUN_DEPENDS=    ${LOCALBASE}/share/mplayer/fonts:${PORTSDIR}/multimedia/mplayer-fonts

OPTIONS_DEFINE= DVDNAV CDPARANOIA OPTIMIZED_CFLAGS SDL TERMCAP WIN32
DVDNAV_DESC=    Enable libdvdnav support
TERMCAP_DESC=   Enable termcap key support
WIN32_DESC= Enable win32 codec set

OPTIONS_DEFAULT=    WIN32
ONLY_FOR_ARCHS= i386

MAKE_JOBS_UNSAFE=   yes

USE_BZIP2=  yes
USE_XORG=   xinerama xv xxf86dga xxf86vm
USES=       iconv gmake
HAS_CONFIGURE=  yes
WANT_SDL=   yes
USE_LDCONFIG=   yes

MAN1=   mplayerxp.1

WIN32_CODEC_PREFIX= ${LOCALBASE}/lib/win32

NO_STAGE=   yes
.include <bsd.port.pre.mk>

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

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

##
## Feature activation and Library Dependencies
##

# cdda support
.if ${PORT_OPTIONS:MCDPARANOIA}
LIB_DEPENDS+=   libcdda_paranoia.so:${PORTSDIR}/audio/cdparanoia

CONFIGURE_ARGS+=    --enable-cdparanoia
.else
CONFIGURE_ARGS+=    --disable-cdparanoia
.endif
# dvd support
.if ${PORT_OPTIONS:MDVDNAV}
LIB_DEPENDS+=   libdvdread.so:${PORTSDIR}/multimedia/libdvdread

CONFIGURE_ARGS+=    --enable-libdvdread
.else
CONFIGURE_ARGS+=    --disable-libdvdread
.endif
# xine libdvdnav
.if ${PORT_OPTIONS:MDVDNAV}
LIB_DEPENDS+=   libdvdnav.so:${PORTSDIR}/multimedia/libdvdnav

CONFIGURE_ARGS+=    --enable-libdvdnav
.else
CONFIGURE_ARGS+=    --disable-libdvdnav
.endif
# compilation optimizations
.if ${PORT_OPTIONS:MOPTIMIZED_CFLAGS}
CFLAGS+=    -O3 -ffast-math
.else
MAKE_ARGS+= OPTFLAGS="${CFLAGS}" SHCFLAGS="${CFLAGS} -PIC"
.endif
# sdl
.if ${PORT_OPTIONS:MSDL}
USE_SDL=    image sdl
CONFIGURE_ARGS+=    --enable-sdl --enable-sdl-image
.else
CONFIGURE_ARGS+=    --disable-sdl --disable-sdl-image
.endif
# termcap key support
# mplayerxp does not clean up after itself yet
.if ${PORT_OPTIONS:MTERMCAP}
CONFIGURE_ARGS+=    --enable-termcap
.else
CONFIGURE_ARGS+=    --disable-termcap
.endif
# win32 binary dll codecs
.if ${PORT_OPTIONS:MWIN32}
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

post-patch:
# win32 codec location
    @${REINPLACE_CMD} -e \
        's|WIN32_PATH|"${WIN32_CODEC_PREFIX}"|' ${WRKSRC}/loader/win32.c
# FreeBSD's install utility does not support -D flag
    @${FIND} ${WRKSRC} -name "Makefile" -print0 | \
        ${XARGS} -0 ${REINPLACE_CMD} -e \
        '/INSTALL/s| -D | |g ; \
         /install/s| -D | |g'
# PTHREAD_{CFLAGS,LIBS}
    @${REINPLACE_CMD} -e \
        '/pthread/s|_ld_i in .* ;|_ld_i in "${PTHREAD_LIBS}" ;|g ; \
         s|pkg-config|true|g ; \
         s|^MAKE=|#MAKE=|g' ${WRKSRC}/codecs/configure
    @${REINPLACE_CMD} -e \
        '/pthread/s|_ld_i in .* ;|_ld_i in "${PTHREAD_LIBS}" ;|g ; \
         s|-D_THREAD_SAFE|${PTHREAD_CFLAGS}|g' ${WRKSRC}/mplayerxp/configure
#
    @${REINPLACE_CMD} -e \
        's|-Wl,-rpath |-Wl,-rpath,|g' ${WRKSRC}/codecs/common.mak
    @${REINPLACE_CMD} -e \
        '/install -d/d' ${WRKSRC}/codecs/subdir.mak

post-configure:
    @cd ${WRKSRC}/codecs && ./configure --cc=${CC} \
        --prefix=${PREFIX} \
        --confdir=${ETCDIR} \
        --datadir=${LOCALBASE}/share/mplayer \
        --libdir=${PREFIX}/lib
.if !defined(WITH_OCFLAGS)
    @${FIND} ${WRKSRC} -name "config.h" -print0 | \
        ${XARGS} -0 ${REINPLACE_CMD} -e \
        '/CAN_COMPILE_/s|^#define|// #undef|g ; \
         /_CLOBBERED/s|^#define|// #undef|g'
.endif

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

post-install:
    @${STRIP_CMD} ${PREFIX}/bin/mplayerxp

.include <bsd.port.post.mk>