aboutsummaryrefslogtreecommitdiff
path: root/multimedia/transcode/Makefile
blob: d04628e22579ccfabd1ea4e973740dedaf19555b (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
# Created by: Hendrik Scholz <hendrik@scholz.net>
# $FreeBSD$

PORTNAME=	transcode
PORTVERSION=	1.1.7
PORTREVISION=	8
CATEGORIES=	multimedia
MASTER_SITES=	http://cdn.bitbucket.org/france/transcode-tcforge/downloads/

MAINTAINER=	cyberbotx@cyberbotx.com
COMMENT=	A text-console utility for video stream processing

LIB_DEPENDS=	avcodec:${PORTSDIR}/multimedia/ffmpeg

USE_BZIP2=	yes
FAKEDIR=	${WRKDIR}/fake
PLIST=		${WRKDIR}/plist
USE_GMAKE=	yes
USE_LDCONFIG=	yes
WANT_SDL=	yes
WANT_GNOME=	yes
USE_AUTOTOOLS=	libtool
CPPFLAGS+=	-isystem ${LOCALBASE}/include
CONFIGURE_ENV=	SDL_CONFIG="${SDL_CONFIG}"
LDFLAGS+=	-L${LOCALBASE}/lib
CONFIGURE_ARGS+=	--enable-oss

MAN1=	avifix.1 aviindex.1 avimerge.1 avisplit.1 avisync.1 tccat.1 tcdemux.1 \
	tcprobe.1 tcscan.1 transcode.1 tcextract.1 tcdecode.1 tcmodinfo.1 \
	tcpvmexportd.1 tcxmlcheck.1 transcode_export.1 transcode_filter.1 \
	transcode_import.1 tcexport.1 tcmodchain.1

NO_OPTIONS_SORT=	yes
OPTIONS_DEFINE=	OPTIMIZED_CFLAGS X11 MPEG2 BKTR POSTPROC FREETYPE LAME XVID \
		X264 OGG VORBIS THEORA DVDREAD DV QUICKTIME LZO LIBA52 \
		FAAC XML MJPEGTOOLS SDL IMAGEMAGICK JPEG ICONV
OPTIONS_DEFAULT=	LAME DVDREAD JPEG ICONV
BKTR_DESC=	Bktr capture card support
POSTPROC_DESC=	Libpostproc support
DVDREAD_DESC=	Libdvdread support
LZO_DESC=	LZO compression support
LIBA52_DESC=	a52 support (as default decoder)
XML_DESC=	Libxml2 XML support

.include <bsd.port.pre.mk>

.if ${OSVERSION} < 700000
CONFIGURE_ENV+=	LIBAVCODEC_EXTRA_LIBS="-pthread"
.endif

.if ${PORT_OPTIONS:MX11}
USE_XORG=	xv xaw xpm
CONFIGURE_ARGS+=	--with-x
.else
CONFIGURE_ARGS+=	--without-x
.endif

.if ${PORT_OPTIONS:MMPEG2}
LIB_DEPENDS+=	mpeg2:${PORTSDIR}/multimedia/libmpeg2
CONFIGURE_ARGS+=	--enable-libmpeg2 --enable-libmpeg2convert
.else
CONFIGURE_ARGS+=	--disable-libmpeg2
.endif

.if ${PORT_OPTIONS:MBKTR}
CONFIGURE_ARGS+=	--enable-bktr
.endif

.if ${PORT_OPTIONS:MPOSTPROC}
CONFIGURE_ARGS+=	--enable-libpostproc
.else
CONFIGURE_ARGS+=	--disable-libpostproc
.endif

.if ${PORT_OPTIONS:MFREETYPE}
LIB_DEPENDS+=	freetype:${PORTSDIR}/print/freetype2
CONFIGURE_ARGS+=	--enable-freetype2
.else
CONFIGURE_ARGS+=	--disable-freetype2
.endif

.if ${PORT_OPTIONS:MLAME}
LIB_DEPENDS+=	mp3lame:${PORTSDIR}/audio/lame
CONFIGURE_ARGS+=	--with-lame-prefix=${LOCALBASE} --enable-lame
.else
CONFIGURE_ARGS+=	--disable-lame
.endif

.if ${PORT_OPTIONS:MXVID}
LIB_DEPENDS+=	xvidcore:${PORTSDIR}/multimedia/xvid
CONFIGURE_ARGS+=	--with-xvid-prefix=${LOCALBASE} --enable-xvid
.else
CONFIGURE_ARGS+=	--disable-xvid
.endif

.if ${PORT_OPTIONS:MX264}
LIB_DEPENDS+=	x264:${PORTSDIR}/multimedia/x264
CONFIGURE_ARGS+=	--enable-x264
.else
CONFIGURE_ARGS+=	--disable-x264
.endif

.if ${PORT_OPTIONS:MOGG}
LIB_DEPENDS+=	ogg:${PORTSDIR}/audio/libogg
CONFIGURE_ARGS+=	--enable-ogg
.else
CONFIGURE_ARGS+=	--disable-ogg
.endif

.if ${PORT_OPTIONS:MVORBIS}
LIB_DEPENDS+=	vorbis:${PORTSDIR}/audio/libvorbis
CONFIGURE_ARGS+=	--enable-vorbis
.else
CONFIGURE_ARGS+=	--disable-vorbis
.endif

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

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

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

.if ${PORT_OPTIONS:MQUICKTIME}
LIB_DEPENDS+=	quicktime:${PORTSDIR}/multimedia/libquicktime
CONFIGURE_ARGS+=	--enable-libquicktime
.else
CONFIGURE_ARGS+=	--disable-libquicktime
.endif

.if ${PORT_OPTIONS:MLZO}
LIB_DEPENDS+=	lzo2:${PORTSDIR}/archivers/lzo2
CONFIGURE_ARGS+=	--with-lzo-prefix=${LOCALBASE} --with-lzo-includes=${LOCALBASE} \
			--enable-lzo
.else
CONFIGURE_ARGS+=	--disable-lzo
.endif

.if ${PORT_OPTIONS:MLIBA52}
LIB_DEPENDS+=	a52:${PORTSDIR}/audio/liba52
CONFIGURE_ARGS+=	--with-a52-prefix=${LOCALBASE} --enable-a52
.else
CONFIGURE_ARGS+=	--disable-a52
.endif

.if ${PORT_OPTIONS:MFAAC}
LIB_DEPENDS+=	faac:${PORTSDIR}/audio/faac
CONFIGURE_ARGS+=	--with-faac-prefix=${LOCALBASE} --enable-faac
.else
CONFIGURE_ARGS+=	--disable-faac
.endif

.if ${PORT_OPTIONS:MXML}
USE_GNOME+=	libxml2
CONFIGURE_ARGS+=	--enable-libxml2
.else
CONFIGURE_ARGS+=	--disable-libxml2
.endif

.if ${PORT_OPTIONS:MMJPEGTOOLS}
LIB_DEPENDS+=	lavjpeg-2.0:${PORTSDIR}/multimedia/mjpegtools
CONFIGURE_ARGS+=	--enable-mjpegtools
.else
CONFIGURE_ARGS+=	--disable-mjpegtools
.endif

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

.if ${PORT_OPTIONS:MIMAGEMAGICK}
LIB_DEPENDS+=	MagickWand:${PORTSDIR}/graphics/ImageMagick
CONFIGURE_ARGS+=	--with-imagemagick-prefix=${LOCALBASE} --enable-imagemagick
.else
CONFIGURE_ARGS+=	--disable-imagemagick
.endif

.if ${PORT_OPTIONS:MJPEG}
LIB_DEPENDS+=	jpeg:${PORTSDIR}/graphics/jpeg
CONFIGURE_ARGS+=	--with-libjpeg-prefix=${LOCALBASE} --enable-libjpeg
.else
CONFIGURE_ARGS+=	--disable-libjpeg
.endif

.if ${PORT_OPTIONS:MICONV}
USE_ICONV=	yes
CONFIGURE_ARGS+=	--with-iconv-prefix=${LOCALBASE} --enable-iconv
.else
CONFIGURE_ARGS+=	--disable-iconv
.endif

post-patch:
.if ${PORT_OPTIONS:MLZO}
	@${REINPLACE_CMD} -e 's|%%NUV%%|nuv|' ${WRKSRC}/import/Makefile.in
.else
	@${REINPLACE_CMD} -e 's|%%NUV%%||' ${WRKSRC}/import/Makefile.in
.endif
.if !${PORT_OPTIONS:MOPTIMIZED_CFLAGS}
	@${FIND} ${WRKSRC} -type f | ${XARGS} -n 10 -x ${REINPLACE_CMD} \
		-e 's|-O[236]|${CFLAGS}|'
.endif
	@${REINPLACE_CMD} -E -e 's|loff_t|uint64_t|' ${WRKSRC}/avilib/avidump.c
	@${REINPLACE_CMD} -E -e 's|<SDL/|<|' ${WRKSRC}/filter/preview/display.h
	@${REINPLACE_CMD} -e '/^static.*lrint/s|static ||' ${WRKSRC}/filter/filter_modfps.c

	@${REINPLACE_CMD} -E -e 's|(-la52)|\1 ${LIBA52_DEP_LIBS}|g ; \
		s|FFMPEG_VERSION|LIBAVCODEC_IDENT|g ; \
		s|-lMagick|-lMagickCore|g' \
			${CONFIGURE_WRKSRC}/${CONFIGURE_SCRIPT}

pre-configure:
	@${REINPLACE_CMD} -E -e 's|-lpthread|${PTHREAD_LIBS}|g' ${WRKSRC}/configure
	@${REINPLACE_CMD} -E -e 's|-ldl||g' ${WRKSRC}/configure
	@${REINPLACE_CMD} -E -e 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/configure
	@${REINPLACE_CMD} -E -e 's|WRKSRC|${WRKSRC}|g' ${WRKSRC}/export/Makefile.in
	@${REINPLACE_CMD} -E -e 's|<quicktime/|<lqt/|g' \
		${WRKSRC}/configure \
		${WRKSRC}/export/export_mov.c \
		${WRKSRC}/import/decode_mov.c \
		${WRKSRC}/import/import_mov.c \
		${WRKSRC}/import/probe_mov.c

pre-install:
	${RM} -rf ${PLIST} ${FAKEDIR}
	${MKDIR} ${FAKEDIR}
	${TOUCH} -f ${PLIST}
	@(cd ${WRKSRC} && ${GMAKE} install prefix=${FAKEDIR} mandir=${FAKEDIR}/man)
	${RM} -rf ${FAKEDIR}/man # let bsd.port.mk handle man files
.for dir in bin share/doc lib
	@(cd ${FAKEDIR}/${dir} && ${FIND} -s * -type f -o -type l | \
		${SED} -e 's|^|${dir}/|' >> ${PLIST})
	@(cd ${FAKEDIR}/${dir} && ${FIND} -d * -type d | \
		${SED} -e 's|^|@dirrm ${dir}/|' >> ${PLIST})
.endfor

.include <bsd.port.post.mk>