aboutsummaryrefslogtreecommitdiffstats
path: root/multimedia/mplayerxp/Makefile
blob: 769010803fd09be28bf29802419b3c45aa9510ea (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
# 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.7.2
PORTREVISION=   8
CATEGORIES= multimedia audio
MASTER_SITES=   SF

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

LIB_DEPENDS=    jpeg.11:${PORTSDIR}/graphics/jpeg \
        png.6:${PORTSDIR}/graphics/png \
        vcdinfo.2:${PORTSDIR}/multimedia/vcdimager
RUN_DEPENDS=    ${LOCALBASE}/share/mplayer/fonts:${PORTSDIR}/multimedia/mplayer-fonts

OPTIONS=    DVDNAV          "Enable libdvdnav support"      off \
        DVDPLAY         "Enable libdvdplay support"     off \
        CDPARANOIA      "Enable CDDA support"           off \
        OCFLAGS         "Use optimized compiler flags"  off \
        SDL             "Enable SDL video output"       off \
        TERMCAP         "Enable termcap key support"    off \
        WIN32           "Enable win32 codec set"        on

ONLY_FOR_ARCHS= i386

USE_BZIP2=  yes
USE_XORG=   xinerama xv xxf86dga xxf86vm
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>

# 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 defined(WITH_CDPARANOIA)
LIB_DEPENDS+=   cdda_paranoia.0:${PORTSDIR}/audio/cdparanoia

CONFIGURE_ARGS+=    --enable-cdparanoia
.else
CONFIGURE_ARGS+=    --disable-cdparanoia
.endif
# dvd support
.if defined(WITH_DVDNAV) || defined(WITH_DVDPLAY)
LIB_DEPENDS+=   dvdread.4:${PORTSDIR}/multimedia/libdvdread

CONFIGURE_ARGS+=    --enable-libdvdread
.else
CONFIGURE_ARGS+=    --disable-libdvdread
.endif
# xine libdvdnav
.if defined(WITH_DVDNAV)
LIB_DEPENDS+=   dvdnav.4:${PORTSDIR}/multimedia/libdvdnav

CONFIGURE_ARGS+=    --enable-libdvdnav
.else
CONFIGURE_ARGS+=    --disable-libdvdnav
.endif
# ogle's libdvdplay
.if defined(WITH_DVDPLAY)
LIB_DEPENDS+=   dvdplay.0:${PORTSDIR}/multimedia/libdvdplay

CONFIGURE_ARGS+=    --enable-libdvdplay
.else
CONFIGURE_ARGS+=    --disable-libdvdplay
.endif
# compilation optimizations
.if defined(WITH_OCFLAGS)
CFLAGS+=    -O3 -ffast-math
.else
MAKE_ARGS+= OPTFLAGS="${CFLAGS}" SHCFLAGS="${CFLAGS} -PIC"
.endif
# sdl
.if defined(WITH_SDL)
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 defined(WITH_TERMCAP)
CONFIGURE_ARGS+=    --enable-termcap
.else
CONFIGURE_ARGS+=    --disable-termcap
.endif
# win32 binary dll codecs
.if !defined(WITHOUT_WIN32)
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>