summaryrefslogtreecommitdiffstats
path: root/multimedia/avifile/Makefile
blob: 56b64da1e363462d97ad3e39d56434656599f197 (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
# New ports collection makefile for:   avifile
# Date created: 	16 September 2000
# Whom: 		Holger Lamm
#
# $FreeBSD$
#

PORTNAME=	avifile
PORTVERSION=	0.7.18.20021107
PORTEPOCH=	2
CATEGORIES=	multimedia
MASTER_SITES=	http://avifile.sourceforge.net/
DISTNAME=	${PORTNAME}-${PORTVERSION:C/.(.{8})$/-\1/}
EXTRACT_SUFX=	.tgz

MAINTAINER=	holger@e-gitt.net

BUILD_DEPENDS=	nasm:${PORTSDIR}/devel/nasm

USE_SUBMAKE=	yes
USE_REINPLACE=	yes
USE_XLIB=	yes
USE_GMAKE=	yes
USE_LIBTOOL=	yes
GNU_CONFIGURE=	yes
INSTALLS_SHLIB=	yes

WRKSRC=		${WRKDIR}/${PORTNAME}${PORTVERSION:C/^(.{3}).*/\1/}-${PORTVERSION:C/^(.{6}).+$/\1/}

LIBTOOLFILES=	acinclude.m4
CONFIGURE_ENV=	SDL_CONFIG="${SDL_CONFIG}" \
		CPPFLAGS="${CPPFLAGS} -I${LOCALBASE}/include -L${LOCALBASE}/lib" \
		CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}" \
		LDFLAGS="${LDFLAGS} -L${LOCALBASE}/lib `${ECHO_CMD} ${PTHREAD_LIBS}`"
CONFIGURE_ARGS= --with-gnu-ld --enable-iconv \
		--disable-divx4
CONFIGURE_TARGET=

PLIST_SUB=	LIB_VERSION="${LIB_VERSION}" VERSION="${VERSION}"

MAN1=		aviplay.1

#CODEC_PORT=	${PORTSDIR}/multimedia/win32-codecs
CODEC_PORT=	${.CURDIR}/../win32-codecs
CODEC_DETECTION_FILE!=	${MAKE} -f ${CODEC_PORT}/Makefile -V CODEC_DETECTION_FILE

LIB_VERSION=	3
VERSION=	0.7
SDL_CONFIG?=	${LOCALBASE}/bin/sdl11-config
DIFF?=		/usr/bin/diff
FMT?=		/usr/bin/fmt

.include <bsd.port.pre.mk>

.if ${ARCH} != "i386"
WITHOUT_A52=yes
WITHOUT_XVID=yes
.endif

# compilation optimizations
.if defined(WITH_OPTIMIZED_CFLAGS)
CONFIGURE_ARGS+=	--enable-release
. if ${ARCH} == "i386"
CONFIGURE_ARGS+=	--enable-x86opt
. endif
.else
CONFIGURE_ARGS+=	--disable-release
.endif

# soundblaster can be passed ac3 instead of letting avifile decode
# it
.if defined(WITH_AC3_PASSTHROUGH)
CONFIGURE_ARGS+=	--enable-ac3passthrough
PLIST_SUB+=	AC3_PASS=""
.else
CONFIGURE_ARGS+=	--disable-ac3passthrough
PLIST_SUB+=	AC3_PASS="@comment "
.endif

# liba52
.if !defined(WITHOUT_A52)
LIB_DEPENDS+=	a52.0:${PORTSDIR}/audio/liba52

CONFIGURE_ARGS+=	--enable-a52 \
			--disable-ffmpeg-a52bin \
			--with-a52-prefix=${LOCALBASE}
PLIST_SUB+=	A52=""
.else
CONFIGURE_ARGS+=	--disable-a52

PLIST_SUB+=	A52="@comment "
.endif

# libmad
.if !defined(WITHOUT_MAD)
LIB_DEPENDS+=	mad.1:${PORTSDIR}/audio/mad

PLIST_SUB+=	MAD=""
.else
CONFIGURE_ARGS+=	--disable-mad
PLIST_SUB+=	MAD="@comment "
.endif

# qt
.if !defined(WITHOUT_QT)
. if exists(${X11BASE}/include/qt2/qapp.h)
USE_QT_VER=	2
. else
USE_QT_VER=	3
. endif
PLIST_SUB+=	QT=""
.else
CONFIGURE_ARGS+=	--without-qt

PLIST_SUB+=	QT="@comment "
.endif

# sdl
.if !defined(WITHOUT_SDL)
LIB_DEPENDS+=	SDL-1.1.4:${PORTSDIR}/devel/sdl12

CONFIGURE_ARGS+=	--with-sdl-prefix=${LOCALBASE} \
			--with-sdl-exec-prefix=${LOCALBASE}
.else
CONFIGURE_ARGS+=	--without-sdl
.endif

# libvorbis; thus, libogg
.if !defined(WITHOUT_VORBIS)
LIB_DEPENDS+=	vorbis.2:${PORTSDIR}/audio/libvorbis

CONFIGURE_ARGS+=	--with-vorbis-prefix=${LOCALBASE} \
			--with-ogg-prefix=${LOCALBASE}
PLIST_SUB+=	VORBIS=""
.else
CONFIGURE_ARGS+=	--disable-vorbis
PLIST_SUB+=	VORBIS="@comment "
.endif

# xvid
.if !defined(WITHOUT_XVID)
LIB_DEPENDS+=	xvidcore.0:${PORTSDIR}/graphics/xvid

CONFIGURE_ARGS+=	--with-xvid-prefix=${LOCALBASE}
PLIST_SUB+=	XVID=""
.else
CONFIGURE_ARGS+=	--disable-xvid
PLIST_SUB+=	XVID="@comment "
.endif

pre-everything::
.if !defined(WITH_OPTIMIZED_CFLAGS)
	@${ECHO_MSG} "You can enable compilation optimizations by defining"
	@${ECHO_MSG} "	WITH_OPTIMIZED_CFLAGS."
.endif
.if !defined(WITH_AC3_PASSTHROUGH)
	@${ECHO_MSG} "You can enable soundblaster ac3 passthrough support by"
	@${ECHO_MSG} "	defining WITH_AC3_PASSTHROUGH."
.endif
.if !defined(WITHOUT_A52)
	@${ECHO_MSG} "You can disable ac3 (liba52) support by defining WITHOUT_A52."
.endif
.if !defined(WITHOUT_MAD)
	@${ECHO_MSG} "You can disable mad support by defining WITHOUT_MAD."
.endif
.if !defined(WITHOUT_QT)
	@${ECHO_MSG} "You can disable QT supported tools by defining WITHOUT_QT."
.endif
.if !defined(WITHOUT_SDL)
	@${ECHO_MSG} "You can disable SDL supported tools by defining WITHOUT_SDL."
.endif
.if !defined(WITHOUT_VORBIS)
	@${ECHO_MSG} "You can disable vorbis support by defining WITHOUT_VORBIS."
.endif
.if !defined(WITHOUT_XVID)
	@${ECHO_MSG} "You can disable xvid support by defining WITHOUT_XVID."
.endif

pre-extract:
	@if [ -f ${LOCALBASE}/lib/libpth.so ]; then \
	  ${ECHO_MSG} "Error: This packet does not compile when the \
packet 'pth' is installed.";\
	  ${FALSE};\
	fi

post-extract:
# grab does not work outside Linux for now
	@${RM} -f ${WRKSRC}/ffmpeg/libav/grab.c
	@${TOUCH} ${WRKSRC}/ffmpeg/libav/grab.c

post-patch:
# linux/ioctl.h -> sys/ioctl.h
	@${REINPLACE_CMD} -e 's|linux/ioctl.h|sys/ioctl.h|' \
		${WRKSRC}/drivers/libdha/kernelhelper/dhahelper.h
.if !defined(WITHOUT_MAD)
	@${REINPLACE_CMD} -e 's|MAD_LDADD = \@MAD_LDADD\@|MAD_LDADD = -L${LOCALBASE}/lib \@MAD_LDADD\@|' \
		${WRKSRC}/plugins/libmad/Makefile.in
.endif
.if !defined(WITHOUT_QT)
. if exists(${X11BASE}/include/qt2/qapp.h)
	@${REINPLACE_CMD} -e 's|qt-mt|qt2-mt|' ${WRKSRC}/configure
. endif
	@${REINPLACE_CMD} -e 's|QT_CFLAGS = \@QT_CFLAGS\@|QT_CFLAGS = -I${X11BASE}/include \@QT_CFLAGS\@|; \
		s|QT_LIBS = \@QT_LIBS\@|QT_LIBS = -L${X11BASE}/lib \@QT_LIBS\@|' \
		${WRKSRC}/libavqt/Makefile.in
.endif
.if !defined(WITHOUT_XVID)
	@${REINPLACE_CMD} -e 's|XVID_LIBS = \@XVID_LIBS\@|XVID_LIBS = -L${LOCALBASE}/lib \@XVID_LIBS\@|' \
		${WRKSRC}/plugins/libxvid/Makefile.in
.endif
	@${REINPLACE_CMD} -e 's|__THROW||' \
		${WRKSRC}/plugins/libwin32/loader/dshow/DS_Filter.h
	@${REINPLACE_CMD} -e 's|-ljpeg|-L${LOCALBASE}/lib -ljpeg|' \
		${WRKSRC}/samples/mjpeg_plugin/Makefile.in
# if we have LAME
	@${REINPLACE_CMD} -e 's|-lmp3lame|-L${LOCALBASE}/lib -lmp3lame|' \
		${WRKSRC}/configure
# use portname without version to build dir names
	@${REINPLACE_CMD} -E -e 's|(PACKAGE[:space:]*=[:space:]*avifile).*|\1|' \
		${WRKSRC}/configure
# fix build in -CURRENT
	@${FIND} ${WRKSRC} -type f | ${XARGS} -n 10 ${REINPLACE_CMD} -e \
		's|#include <malloc.h>|#include <stdlib.h>|g'
# use correct signal type
	@${REINPLACE_CMD} -e 's|sighandler_t|sig_t|' \
		${WRKSRC}/samples/misc/benchmark.cpp
# fix breakage if either auto{conf,make} are installed
# do not version library names
# fix incorrect behavior of configure script
	@${FIND} ${WRKSRC} \( -name Makefile.in -o -name configure \) | \
		${XARGS} -n 10 ${REINPLACE_CMD} -E -e \
		's|INSTALL = \@INSTALL\@|INSTALL = ${INSTALL}|; \
		s!-release[[:space:]]+\$$\([^\)]+\)!!; \
		s!ACLOCAL =!ACLOCAL = ${TRUE} || !; \
		s!AUTOCONF =!AUTOCONF = ${TRUE} || !; \
		s!AUTOHEADER =!AUTOHEADER = ${TRUE} || !; \
		s!AUTOMAKE =!AUTOMAKE = ${TRUE} || !'

post-configure:
	@${LN} -sf ${LOCALBASE}/bin/libtool ${WRKSRC}

post-install:
.if !defined(NOPORTDOCS)
	@${MKDIR} ${DOCSDIR}
	@${INSTALL_DATA} ${PKGMESSAGE} ${DOCSDIR}/README
.endif
	@${FMT} < ${PKGMESSAGE}

.if ${ARCH} == "i386"
RUN_DEPENDS+=	${CODEC_DETECTION_FILE}:${CODEC_PORT}

CONFIGURE_ARGS+=	--enable-x86opt \
			--enable-win32 \
			--with-win32-path=${LOCALBASE}/lib/win32

PLIST_SUB+=	FFMPEG="" WIN32=""
.else
CONFIGURE_ARGS+=	--disable-x86opt --disable-win32 \
			--disable-ffmpeg

PLIST_SUB+=	FFMPEG="@comment " WIN32="@comment "
.endif

# hack taken from ogle to make it work with liba52 + djbfft
.if exists(${LOCALBASE}/lib/liba52.la)
LIBA52_DEP_LIBS!=	${GREP} dependency_libs ${LOCALBASE}/lib/liba52.la | ${CUT} -d \' -f 2
.else
LIBA52_DEP_LIBS=
.endif

# if we have LAME
.if exists(${LOCALBASE}/lib/libmp3lame.so)
LIB_DEPENDS+=	mp3lame.0:${PORTSDIR}/audio/lame

PLIST_SUB+=	NOLAME="@comment " LAME=""
.else
PLIST_SUB+=	NOLAME="" LAME="@comment "
.endif

.include <bsd.port.post.mk>
OpenPOWER on IntegriCloud