summaryrefslogtreecommitdiffstats
path: root/multimedia/transcode/Makefile
blob: 880fdbc819985408219c8ee2407a9c999e47ae33 (plain)
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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# New ports collection makefile for:   transcode
# Date created: 	17 December 2001
# Whom: 		Hendrik Scholz <hendrik@scholz.net>
#
# $FreeBSD$
#

PORTNAME=	transcode
PORTVERSION=	1.0.3
PORTREVISION=	2
CATEGORIES=	multimedia
MASTER_SITES=	http://fromani.exit1.org/

MAINTAINER=	multimedia@FreeBSD.org
COMMENT=	A text-console utility for video stream processing

LIB_DEPENDS=	dvdread.5:${PORTSDIR}/multimedia/libdvdread \
		jpeg.9:${PORTSDIR}/graphics/jpeg \
		mpeg2.0:${PORTSDIR}/multimedia/libmpeg2 \
		avcodec.1:${PORTSDIR}/multimedia/ffmpeg
BUILD_DEPENDS=	iconv:${PORTSDIR}/converters/libiconv

USE_BZIP2=	yes
FAKEDIR=	${WRKDIR}/fake
PLIST=		${WRKDIR}/plist
USE_GETOPT_LONG=yes
USE_XLIB=	yes
USE_GMAKE=	yes
USE_LDCONFIG=	yes
WANT_SDL=	yes
USE_GNOME=	gnometarget
USE_AUTOTOOLS=	libtool:15
LDFLAGS=	-L${LOCALBASE}/lib -L${X11BASE}/lib
CPPFLAGS=	-I${X11BASE}/include -I${LOCALBASE}/include
CONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}" \
		SDL_CONFIG="${SDL_CONFIG}"
CONFIGURE_ARGS+=	--with-libavcodec-includes=${LOCALBASE}/include/ffmpeg \
			--with-libavcodec-libs=${LOCALBASE}/lib \
			--with-libdvdread-prefix=${LOCALBASE} \
			--with-libiconv-prefix=${LOCALBASE} \
			--enable-oss \
			--enable-gtk=no \
			--mandir=${PREFIX}/man

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

.include <bsd.port.pre.mk>

.if defined(WITH_FREETYPE) || exists(${LOCALBASE}/lib/libfreetype.so)
LIB_DEPENDS+=	freetype.9:${PORTSDIR}/print/freetype2
CONFIGURE_ARGS+=	--with-ft-prefix=${LOCALBASE} --enable-freetype2
.else
CONFIGURE_ARGS+=	--disable-fttest --enable-freetype=no
.endif

.if defined(WITH_OGG) || exists(${LOCALBASE}/lib/libogg.so)
LIB_DEPENDS+=	ogg.5:${PORTSDIR}/audio/libogg
CONFIGURE_ARGS+=	--with-ogg-prefix=${LOCALBASE} --enable-ogg
.else
CONFIGURE_ARGS+=	--enable-ogg=no
.endif

.if defined(WITH_BKTR)
CONFIGURE_ARGS+=	--enable-bktr
.endif

.if defined(WITH_VORBIS) || exists(${LOCALBASE}/lib/libvorbis.so)
LIB_DEPENDS+=	vorbis.3:${PORTSDIR}/audio/libvorbis
CONFIGURE_ARGS+=	--with-vorbis-prefix=${LOCALBASE} --enable-vorbis
.else
CONFIGURE_ARGS+=	--enable-vorbis=no
.endif

.if defined(WITH_THEORA) || exists(${LOCALBASE}/lib/libtheora.so)
LIB_DEPENDS+=	theora.2:${PORTSDIR}/multimedia/libtheora
CONFIGURE_ARGS+=	--with-theora-prefix=${LOCALBASE} --enable-theora
.else
CONFIGURE_ARGS+=	--enable-theora=no
.endif

.if defined(WITH_IMAGEMAGICK) || exists(${LOCALBASE}/lib/libMagick.so)
LIB_DEPENDS+=	Magick.10:${PORTSDIR}/graphics/ImageMagick
CONFIGURE_ARGS+=	--enable-imagemagick --with-imagemagick-prefix=${LOCALBASE}
.else
CONFIGURE_ARGS+=	--enable-imagemagick=no
.endif

.if defined(WITH_MJPEG) || exists(${LOCALBASE}/lib/liblavjpeg.so)
LIB_DEPENDS+=	lavjpeg-1.9.1:${PORTSDIR}/multimedia/mjpegtools
CONFIGURE_ARGS+=	--enable-mjpegtools
.else
CONFIGURE_ARGS+=	--enable-mjpegtools=no
.endif

.if defined(WITH_AVIFILE) || exists(${LOCALBASE}/lib/libaviplay.so)
LIB_DEPENDS+=	aviplay:${PORTSDIR}/multimedia/avifile
CONFIGURE_ARGS+=	--with-avifile-prefix=${LOCALBASE} --enable-avifile
.else
CONFIGURE_ARGS+=	--enable-avifile=no
.endif

.if defined(WITH_SDL) || ${HAVE_SDL:Msdl}!=""
USE_SDL+=	sdl
WITH_LIBDV=	yes
CONFIGURE_ARGS+=	--enable-sdl --with-sdl-prefix=${LOCALBASE}
.else
CONFIGURE_ARGS+=	--enable-sdl=no
.endif

.if !defined(WITHOUT_XML) || ${HAVE_GNOME:Mlibxml2}!=""
USE_GNOME+=	libxml2
CONFIGURE_ARGS+=	--enable-libxml2 --with-libxml2-prefix=${LOCALBASE}
.else
CONFIGURE_ARGS+=	--enable-libxml2=no
.endif

.if defined(WITH_LIBDV) || exists(${LOCALBASE}/lib/libdv.so)
LIB_DEPENDS+=	dv.4:${PORTSDIR}/multimedia/libdv
CONFIGURE_ARGS+=	--with-pal-yuv=YV12 --enable-libdv
.else
CONFIGURE_ARGS+=	--enable-libdv=no
.endif

.if defined(WITH_QUICKTIME) || exists(${LOCALBASE}/lib/libquicktime.so)
LIB_DEPENDS+=	quicktime.0:${PORTSDIR}/multimedia/libquicktime
CONFIGURE_ARGS+=	--enable-libquicktime \
					--with-libquicktime-prefix=${LOCALBASE} \
					--with-libquicktime-includes=${LOCALBASE}/include/lqt
.else
CONFIGURE_ARGS+=	--enable-libquicktime=no
.endif

.if defined(WITH_FAME) # Disable.. meh # || (exists(${LOCALBASE}/lib/libfame.so) && !defined(WITHOUT_FAME))
LIB_DEPENDS+=	fame-0.9:${PORTSDIR}/multimedia/libfame
CONFIGURE_ARGS+=	--with-libfame-prefix=${LOCALBASE} --enable-libfame
.endif

.if defined(WITH_XVID) || (exists(${LOCALBASE}/lib/libxvidcore.so) && !defined(WITHOUT_XVID))
LIB_DEPENDS+=	xvidcore.4:${PORTSDIR}/multimedia/xvid
RUN_DEPENDS+=	xvid4conf:${PORTSDIR}/multimedia/xvid4conf
.endif

.if defined(WITH_LIBA52_DEFAULT) || (exists(${LOCALBASE}/lib/liba52.so) && !defined(WITHOUT_LIBA52))
WITH_LIBA52=	yes
CONFIGURE_ARGS+=	--enable-a52-default-decoder
.endif

.if defined(WITH_LIBA52)
LIB_DEPENDS+=	a52.0:${PORTSDIR}/audio/liba52
CONFIGURE_ARGS+=	--enable-a52
.else
CONFIGURE_ARGS+=	--with-a52=no
.endif

.if defined(WITH_LAME) || (exists(${LOCALBASE}/lib/libmp3lame.so) && !defined(WITHOUT_LAME))
LIB_DEPENDS+=	mp3lame.0:${PORTSDIR}/audio/lame
CONFIGURE_ARGS+=	--with-lame-prefix=${LOCALBASE}
.else
CONFIGURE_ARGS+=	--disable-lame
.endif

.if defined(WITH_LZO) || (exists(${LOCALBASE}/lib/liblzo.so) && !defined(WITHOUT_LZO))
LIB_DEPENDS+=	lzo.1:${PORTSDIR}/archivers/lzo
CONFIGURE_ARGS+=	--enable-lzo --with-lzo-prefix=${LOCALBASE} \
					--with-lzo-includes=${LOCALBASE}
.else
CONFIGURE_ARGS+=	--enable-lzo=no
.endif

.if (defined(WITH_DIVX5) && ${ARCH}=="i386") || (exists(${LINUXBASE}/usr/lib/libdivxdecore.so) && !defined(WITHOUT_DIVX5))
BUILD_DEPENDS+=	${LINUXBASE}/usr/lib/libdivxdecore.so:${PORTSDIR}/multimedia/linux-divx4linux
CFLAGS+=	-I${LINUXBASE}/usr/include/divx
.else
.endif

pre-everything::
.if !defined(WITH_OPTIMIZED_CFLAGS)
	@${ECHO_MSG}
	@${ECHO_MSG} "You can enable extra optimizations by defining WITH_OPTIMIZED_CFLAGS."
.endif
.if !defined(WITH_FREETYPE)
	@${ECHO_MSG}
	@${ECHO_MSG} "You can enable text/subtitler modules by defining WITH_FREETYPE."
.endif
.if !defined(WITH_OGG)
	@${ECHO_MSG}
	@${ECHO_MSG} "You can enable libogg support by defining WITH_OGG."
.endif
.if !defined(WITH_VORBIS)
	@${ECHO_MSG}
	@${ECHO_MSG} "You can enable libvorbis support by defining WITH_VORBIS."
.endif
.if !defined(WITH_THEORA)
	@${ECHO_MSG}
	@${ECHO_MSG} "You can enable libtheora support by defining WITH_THEORA."
.endif
.if !defined(WITH_MJPEG)
	@${ECHO_MSG}
	@${ECHO_MSG} "You can enable MJPEG portions by defining WITH_JPEGMMX."
.endif
.if !defined(WITH_IMAGEMAGICK)
	@${ECHO_MSG}
	@${ECHO_MSG} "You can enable ImageMagick-dependent modules by defining WITH_IMAGEMAGICK."
.endif
.if !defined(WITH_SDL)
	@${ECHO_MSG}
	@${ECHO_MSG} "You can enable realtime-previewing by defining WITH_SDL."
	@${ECHO_MSG} "This implies WITH_LIBDV."
.endif
.if !defined(WITH_XML)
	@${ECHO_MSG}
	@${ECHO_MSG} "You can enable libxml2-dependent modules by defining WITH_XML."
.endif
.if !defined(WITH_LAME)
	@${ECHO_MSG}
	@${ECHO_MSG} "You can enable lame-dependent modules by defining WITH_LAME."
	@${ECHO_MSG} "You will probably want to enable this, if you plan to"
	@${ECHO_MSG} "rip DVDs or dub videos."
.endif
.if !defined(WITH_LIBDV)
	@${ECHO_MSG}
	@${ECHO_MSG} "You can enable libdv-support by defining WITH_LIBDV."
	@${ECHO_MSG} "You will probably want to enable this, if you plan to"
	@${ECHO_MSG} "transcode DV data from a digital videocamera."
.endif
.if !defined(WITH_LIBA52)
	@${ECHO_MSG}
	@${ECHO_MSG} "You can enable liba52-support by defining WITH_LIBA52."
	@${ECHO_MSG} "You will probably want to enable this, if you plan to"
	@${ECHO_MSG} "rip DVDs."
.endif
.if !defined(WITH_LIBA52_DEFAULT)
	@${ECHO_MSG}
	@${ECHO_MSG} "You can use liba52 as default audio encoder by defining WITH_LIBA52_DEFAULT."
	@${ECHO_MSG} "This implies WITH_LIBA52."
.endif
.if !defined(WITH_AVIFILE)
	@${ECHO_MSG}
	@${ECHO_MSG} "You can enable avifile-dependent modules by defining WITH_AVIFILE."
.endif #WITH_AVIFILE
.if !defined(WITH_QUICKTIME)
	@${ECHO_MSG}
	@${ECHO_MSG} "You can enable quicktime-dependent modules by defining WITH_QUICKTIME."
.endif
.if !defined(WITH_FAME)
	@${ECHO_MSG}
	@${ECHO_MSG} "You can enable libfame-support by defining WITH_FAME."
.endif
.if !defined(WITH_XVID)
	@${ECHO_MSG}
	@${ECHO_MSG} "You can enable xvid support by defining WITH_XVID."
	@${ECHO_MSG} "You will probably want to enable this, if you plan to"
	@${ECHO_MSG} "rip DVDs."
.endif
.if !defined(WITH_LZO)
	@${ECHO_MSG}
	@${ECHO_MSG} "You can enable liblzo support by defining WITH_LZO."
.endif
.if !defined(WITH_DIVX5) && ${ARCH}=="i386"
	@${ECHO_MSG}
	@${ECHO_MSG} "You can enable experimental DivX 5 support by defining WITH_DIVX5."
.endif
.if !defined(WITH_BKTR)
	@${ECHO_MSG}
	@${ECHO_MSG} "You can enable support for bktr(4) devices by defining WITH_BKTR."
.endif

post-patch:
.if !defined(WITH_OPTIMIZED_CFLAGS)
	@${FIND} ${WRKSRC} -type f | ${XARGS} -n 10 -x ${REINPLACE_CMD} \
		-e 's|-O[236]|${CFLAGS}|'
.endif
	@${REINPLACE_CMD} -E -e 's|(seek)64|\1|' ${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' \
			${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|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})
	${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>
OpenPOWER on IntegriCloud