aboutsummaryrefslogtreecommitdiffstats
path: root/multimedia/mencoder/Makefile
blob: c4af108ce083e60b1d2b2e67ec576f68c5a343be (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
# New ports collection makefile for:    mencoder
# Date created:     23 June 2007
# Whom:         Thomas E. Zander
# $FreeBSD$
#

PORTNAME=   mencoder
PORTVERSION=    ${MPLAYER_PORT_VERSION}
PORTREVISION=   3
COMMENT=    Convenient video file and movie encoder
RESTRICTED= Port has restricted dependencies

.include "${.CURDIR}/../mplayer/Makefile.shared"

OPTIONS=    DEBUG "Include debug symbols in mencoder's binary" off
OPTIONS+=   BLURAY "Build with libbluray support" off
OPTIONS+=   FONTCONFIG "Enable fontconfig support" off
OPTIONS+=   RTCPU "Allow runtime CPU detection" on
OPTIONS+=   OCFLAGS "Use optimized compiler flags" on
OPTIONS+=   IPV6 "Include inet6 network support" on
OPTIONS+=   JACK "Enable JackIt audio server support" off
OPTIONS+=   NAS "Enable NAS sound server support" off
OPTIONS+=   OPENAL "Enable OpenAL sound support" off
OPTIONS+=   PULSE "Enable PulseAudio" off
OPTIONS+=   LIBUNGIF "Enable gif support" on
OPTIONS+=   OPENJPEG "Enable JPEG2000 support" off
OPTIONS+=   MNG "Enable MNG input support" off
OPTIONS+=   LIBDV "Enable libdv support" off
OPTIONS+=   MAD "Enable mad MPEG audio engine support" off
OPTIONS+=   AMR_NB "AMR Narrow Band encoder (opencore)" off
OPTIONS+=   AMR_WB "AMR Wide Band encoder (opencore)" off
OPTIONS+=   GSM "GSM audio codec" off
OPTIONS+=   TWOLAME "Enable twolame MPEG audio codec support" off
OPTIONS+=   FAAC "Enable FAAC audio codec support" off
OPTIONS+=   LADSPA "Enable LADSPA plugin support" off
OPTIONS+=   SPEEX "Enable speex audio codec support" off
OPTIONS+=   WIN32 "Enable win32 codec set on the IA32 arch" on
OPTIONS+=   THEORA "Enable ogg theora video support" off
OPTIONS+=   XVID "Enable XVID video codec support" on
OPTIONS+=   X264 "Enable x264 (H.264) video codec support" on
OPTIONS+=   VPX "Enable VP8 video via libvpx" off
OPTIONS+=   DIRAC "Enable dirac video codec support" off
OPTIONS+=   SCHROEDINGER "Dirac codec via libschroedinger" off
OPTIONS+=   ASS "Enable ASS/SSA subtitle rendering" on
OPTIONS+=   REALPLAYER "Enable real player plugin" off
OPTIONS+=   LIVEMEDIA "Enable LIVE555 streaming support" off
OPTIONS+=   SMB "Enable Samba input support" off
OPTIONS+=   FRIBIDI "Enable FriBiDi support" off
OPTIONS+=   LIBCDIO "Enable libcdio support" off
OPTIONS+=   CDPARANOIA "Enable cdparanoia support" off
OPTIONS+=   LIBLZO "Enable external liblzo library" off
OPTIONS+=   V4L "Enable Video4Linux TV support" off
OPTIONS+=   LIBRTMP "Enable RTMPDump Streaming Media support" off

MAN1=       mencoder.1

PATCHDIR=   ${.CURDIR}/../mplayer/files
DATADIR=    ${PREFIX}/share/mplayer

TOOLFILES=  aconvert.sh binary_codecs.sh calcbpp.pl \
        checktree.sh countquant.pl divx2svcd.sh \
        dvd2divxscript.pl edgedetect.fp edgeenh.fp \
        emboss.fp mencvcd.sh midentify.sh \
        mpconsole.sh mplmult.sh plotpsnr.pl \
        psnr-video.sh qepdvcd.sh subedit.pl \
        subsearch.sh w32codec_dl.pl wma2ogg.pl \

.include <bsd.port.pre.mk>

LIB_DEPENDS+=   mp3lame.0:${PORTSDIR}/audio/lame

CONFIGURE_ARGS+=    --disable-mplayer \
            --disable-libdca \
            --disable-x11 \
            --disable-vdpau \
            --disable-rtc \
            --disable-arts \
            --disable-esd \
            --disable-caca \
            --disable-lirc \
            --disable-sdl \
            --disable-svga \
            --disable-aa \
            --disable-joystick \
            --disable-directfb \
            --disable-ssse3 \
            --disable-mpg123 \
            --disable-musepack

ALL_TARGET= mencoder

.include "${.CURDIR}/../mplayer/Makefile.options"

.if defined(WITH_ASS)
LIB_DEPENDS+=   ass.5:${PORTSDIR}/multimedia/libass
BUILD_DEPENDS +=    pkg-config:${PORTSDIR}/devel/pkg-config
LIBASS_PKGCONFIG_CFLAGS=    pkg-config --cflags --silence-errors libass
.else
CONFIGURE_ARGS+=    --disable-ass --disable-ass-internal --disable-enca
LIBASS_PKGCONFIG_CFLAGS=    ${ECHO_CMD}
.endif

.if defined(WITH_FONTCONFIG)
LIB_DEPENDS+=   fontconfig.1:${PORTSDIR}/x11-fonts/fontconfig
.else
CONFIGURE_ARGS+=    --disable-fontconfig
.endif

.if defined(WITH_TWOLAME)
LIB_DEPENDS+=   twolame.0:${PORTSDIR}/audio/twolame
.else
CONFIGURE_ARGS+=    --disable-twolame
.endif

.if defined(WITH_FAAC)
LIB_DEPENDS+=   faac.0:${PORTSDIR}/audio/faac
.else
CONFIGURE_ARGS+=    --disable-faac
.endif

.if !defined(WITHOUT_X264)
LIB_DEPENDS+=   x264.116:${PORTSDIR}/multimedia/x264
.else
CONFIGURE_ARGS+=    --disable-x264
.endif

.if !defined(WITHOUT_XVID)
LIB_DEPENDS+=       xvidcore.4:${PORTSDIR}/multimedia/xvid
.else
CONFIGURE_ARGS+=    --disable-xvid
.endif

.ifdef(WITH_DIRAC)
LIB_DEPENDS+=       dirac_encoder.1:${PORTSDIR}/multimedia/dirac
.else
CONFIGURE_ARGS+=    --disable-libdirac-lavc
.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. As this one is a slave port of multimedia/"
    @${ECHO_MSG} "mplayer, you might want to check mplayer's Makefile(s) 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|/dev/dvd|${DEFAULT_DVD_DEVICE}|; \
        s|/dev/cdrom|${DEFAULT_CDROM_DEVICE}|' \
        -e 's|/usr/local|${LOCALBASE}|' \
        -e 's|-lbz2|/usr/lib/libbz2.so|' \
        -e 's|-L$$_prefix/lib|-L${LOCALBASE}/lib|' \
        -e 's|-I$$_prefix/include|-I${LOCALBASE}/include|' \
        ${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} ${WRKSRC}/DOCS/man -name "mplayer.1" | ${XARGS} ${REINPLACE_CMD} -E -e \
        's|/usr/\\:local/\\:etc/\\:mplayer|${DATADIR:S/\//\/\\\:/g}|g ; \
         s|/dev/\\:(dvd[[:alnum:]]*[[:>:]])|${DEFAULT_DVD_DEVICE:S/dev\//dev\/\\\:/}|g ; \
         s|/dev/\\:(cdrom[[:alnum:]]*[[:>:]])|${DEFAULT_CDROM_DEVICE:S/dev\//dev\/\\\:/}|g'
    @${REINPLACE_CMD} \
        -e 's|%%LIBASS_PKGCONFIG_CFLAGS%%|${LIBASS_PKGCONFIG_CFLAGS}|' \
            ${BUILD_WRKSRC}/${MAKEFILE}

post-configure:
    @${REINPLACE_CMD} -e 's#-pthread#${PTHREAD_LIBS}#g' \
        ${WRKSRC}/config.mak
    @${REINPLACE_CMD} \
        -e 's#HAVE_FAST_CMOV 1#HAVE_FAST_CMOV 0#g' \
        -e 's#HAVE_LOG2 1#HAVE_LOG2 0#g' \
        -e 's#HAVE_LOG2F 1#HAVE_LOG2F 0#g' \
        ${WRKSRC}/config.h

do-install:
    @${INSTALL_PROGRAM} ${WRKSRC}/mencoder ${PREFIX}/bin

post-install:
    @${INSTALL_MAN} ${WRKSRC}/DOCS/man/en/mplayer.1 ${MAN1PREFIX}/man/man1/mencoder.1
    @${MKDIR} ${DATADIR}
    @${CHMOD} 755 ${DATADIR}
    @${MKDIR} ${DATADIR}/tools
    @${CHMOD} 755 ${DATADIR}/tools
.for tool in ${TOOLFILES}
    @${INSTALL_SCRIPT} ${WRKSRC}/TOOLS/${tool} ${DATADIR}/tools
.endfor

.if ${ARCH} == "ia64" || ${ARCH} == "sparc64"
BROKEN=     Does not detect CPU correctly on ia64 or sparc64
.endif

.include <bsd.port.post.mk>