blob: 2db71b511c60ab2f24b4570bdf128cde7da7ac6c (
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
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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
|
# New ports collection makefile for: ffmpeg
# Date created: Tue Sep 25 15:52:09 BRT 2001
# Whom: Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>
#
# $FreeBSD$
#
PORTNAME= ffmpeg
DISTVERSION= 0.4.9-pre1
PORTREVISION= 4
CATEGORIES= multimedia audio net
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_EXTENDED}
MASTER_SITE_SUBDIR= ffmpeg
MAINTAINER= lioux@FreeBSD.org
COMMENT= Hyper fast realtime audio/video encoder/converter, streaming server
USE_GETOPT_LONG= yes
HAS_CONFIGURE= yes
USE_GMAKE= yes
USE_REINPLACE= yes
WANT_SDL= yes
CONFIGURE_ARGS= --cc="${CC}" --prefix="${PREFIX}" \
--make="${GMAKE}" --enable-shared \
--extra-ldflags="-L${WRKSRC}/libavcodec -L${WRKSRC}/libavcodec/libpostproc \
-L${LOCALBASE}/lib -L${X11BASE}/lib " \
--extra-libs="-lm" \
--disable-debug
PLIST_SUB= SHLIB_VERSION=${SHLIB_VERSION}
INSTALLS_SHLIB= yes
CONFLICTS= ffmpeg-devel*
SHLIB_VERSION= 1
#
DOC_FILES= COPYING Changelog README
# under subdir doc
DOC_DOCFILES= TODO faq.html ffmpeg-doc.html \
ffplay-doc.html ffserver-doc.html \
hooks.html optimization.txt
PORTDOCS= ${DOC_FILES} ${DOC_DOCFILES}
HEADER_FILES= libavcodec/avcodec.h libavcodec/common.h \
libavcodec/dsputil.h
LIB_FILES= libavcodec/libavcodec.a libavformat/libavformat.a
MAN1= ffmpeg.1
.include <bsd.port.pre.mk>
.if ${ARCH} == "alpha"
BROKEN= "Does not compile on alpha"
.endif
.if exists(${LOCALBASE}/lib/libavformat.so.0)
BROKEN= Please remove previous version of ${PORTNAME} to continue build
.endif
##
## arch detection
##
.if ${ARCH} != "i386"
WITHOUT_MMX= yes
.else
# only for i386
EXTRA_PATCHES+= ${FILESDIR}/extra-bktr-patch-libavformat::Makefile
#. if ${OSVERSION} >= 502000 && !defined(WITH_OPTIMIZED_CFLAGS)
#CFLAGS+=-fomit-frame-pointer
#WITH_OPTIMIZED_CFLAGS=yes
#. endif
.endif
##
## system version
##
.if ${OSVERSION} < 500000
# postprocess libraries cannot be built
OSVERSION4_DONT_WORK=yes
.endif
## lib detection
##
##
## SDL
.if ${HAVE_SDL:Msdl}
WITH_SDL=yes
.endif
## faac
.if exists(${LOCALBASE}/lib/libfaac.so.0)
WITH_FAAC=yes
.endif
## freetype2
.if exists(${LOCALBASE}/lib/libfreetype.so)
WITH_FREETYPE2=yes
.endif
## imlib2
.if exists(${X11BASE}/lib/libImlib2.so)
WITH_IMLIB2=yes
.endif
## lame mp3
.if exists(${LOCALBASE}/lib/libmp3lame.so.0)
WITH_MP3=yes
.endif
## vorbis
.if exists(${LOCALBASE}/lib/libvorbisenc.so.2)
WITH_VORBIS=yes
.endif
.if exists(${LOCALBASE}/lib/libfaad.so.0)
WITH_FAAD=yes
.endif
## support activation
##
## PORTDOCS
.ifndef(NOPORTDOCS)
BUILD_DEPENDS+= texi2html:${PORTSDIR}/textproc/texi2html
.endif
## disable a52
#.ifndef(WITHOUT_LIBA52)
#LIB_DEPENDS+= a52.0:${PORTSDIR}/audio/liba52
#
#CONFIGURE_ARGS+= --enable-a52 \
# --enable-a52bin
#.else
#CONFIGURE_ARGS+= --enable-a52 \
# --disable-a52bin
#.endif
GPLLIBS= yes
# --enable-a52bin breaks build
CONFIGURE_ARGS+= --enable-a52
## enable freetype2
.if defined(WITH_FREETYPE2)
LIB_DEPENDS+= freetype.9:${PORTSDIR}/print/freetype2
PLIST_SUB+= DRAWTEXT=""
.else
PLIST_SUB+= DRAWTEXT="@comment "
.endif
## enable imlib2
.if !defined(WITHOUT_VHOOK) && defined(WITH_IMLIB2)
LIB_DEPENDS+= Imlib2.3:${PORTSDIR}/graphics/imlib2
PLIST_SUB+= IMLIB2=""
.else
PLIST_SUB+= IMLIB2="@comment "
.endif
## disable mmx
.ifdef(WITHOUT_MMX)
CONFIGURE_ARGS+= --disable-mmx
.endif
## SDL
.ifdef(WITH_SDL)
USE_SDL= sdl
MAN1+= ffplay.1
PLIST_SUB+= SDL=""
.else
PLIST_SUB+= SDL="@comment "
.endif
## mp3
.ifdef(WITH_MP3)
LIB_DEPENDS+= mp3lame.0:${PORTSDIR}/audio/lame
CONFIGURE_ARGS+= --enable-mp3lame
.endif
## optimization
# breaks ffmpeg build if defined
CFLAGS+= -fno-force-addr
.if ${OSVERSION} > 502124
. ifdef(WITH_OPTIMIZED_CFLAGS)
CONFIGURE_ARGS+= --extra-cflags="-fPIC -DPIC -I${LOCALBASE}/include \
${CFLAGS} \
-I${X11BASE}/include \
-ffast-math -fomit-frame-pointer -fno-unit-at-a-time"
. else
CONFIGURE_ARGS+= --extra-cflags="-fPIC -DPIC -I${LOCALBASE}/include \
-I${X11BASE}/include \
-fomit-frame-pointer -fno-unit-at-a-time"
. endif
.else
. ifdef(WITH_OPTIMIZED_CFLAGS)
CONFIGURE_ARGS+= --extra-cflags="-fPIC -DPIC -I${LOCALBASE}/include \
${CFLAGS} \
-I${X11BASE}/include \
-ffast-math -fomit-frame-pointer"
. else
CONFIGURE_ARGS+= --extra-cflags="-fPIC -DPIC -I${LOCALBASE}/include \
-I${X11BASE}/include"
. endif
.endif
## vhook
.ifndef(WITHOUT_VHOOK)
PLIST_SUB+= VHOOK=""
.else
CONFIGURE_ARGS+= -disable-vhook
PLIST_SUB+= VHOOK="@comment "
.endif
## vorbis
.ifdef(WITH_VORBIS)
LIB_DEPENDS+= vorbisenc.2:${PORTSDIR}/audio/libvorbis
CONFIGURE_ARGS+= --enable-vorbis
.endif
## faac
.ifdef(WITH_FAAC)
LIB_DEPENDS+= faac.0:${PORTSDIR}/audio/faac
CONFIGURE_ARGS+= --enable-faac
.endif
## faad
.ifdef(WITH_FAAD)
LIB_DEPENDS+= faad.0:${PORTSDIR}/audio/faad
CONFIGURE_ARGS+= --enable-faad --enable-faadbin
GPLLIBS= yes
.endif
## GPLLIBS
.ifdef(GPLLIBS)
CONFIGURE_ARGS+= --enable-gpl
.endif
## post processing
.ifndef(WITHOUT_POSTPROCESS)
CONFIGURE_ARGS+= --enable-shared-pp
PLIST_FILES+= include/ffmpeg/postproc/postprocess.h
PLIST_DIRS+= include/ffmpeg/postproc
. ifdef(GPLLIBS)
. ifndef(OSVERSION4_DONT_WORK)
CONFIGURE_ARGS+= --enable-pp
LIB_POSTPROC= lib/libpostproc.a \
lib/libpostproc.so \
lib/libpostproc.so.0 \
lib/libpostproc.so.${SHLIB_VERSION}
PLIST_FILES+= ${LIB_POSTPROC}
. endif # OSVERSION4_DONT_WORK
. endif
.endif
## ffserver
.ifdef(WITHOUT_FFMPEG_FFSERVER)
CONFIGURE_ARGS+= --disable-ffserver
PLIST_SUB+= FFSERVER="@comment "
.else
USE_RC_SUBR= yes
MAN1+= ffserver.1
PLIST_SUB+= FFSERVER=""
.endif
PLIST_DIRS+= include/ffmpeg
pre-everything::
.ifndef(WITH_FREETYPE2)
@${ECHO_MSG} 'Define WITH_FREETYPE2 to enable drawtext FREETYPE2 codec'
@${ECHO_MSG}
.endif
.ifndef(WITHOUT_LIBA52)
@${ECHO_MSG} "You can disable liba52 support by defining WITHOUT_LIBA52"
@${ECHO_MSG}
.endif
.ifndef(WITHOUT_MMX)
@${ECHO_MSG} "Define WITHOUT_MMX if your system does not support MMX"
@${ECHO_MSG}
.endif
.ifndef(WITH_SDL)
@${ECHO_MSG} 'Define WITH_SDL to enable ffplay SDL version'
@${ECHO_MSG}
.endif
.ifndef(WITH_MP3)
@${ECHO_MSG} 'Define WITH_MP3 to enable lame MP3 codec'
@${ECHO_MSG}
.endif
.ifndef(WITH_OPTIMIZED_CFLAGS)
@${ECHO_MSG} 'You can enable additional compilation optimizations'
@${ECHO_MSG} 'by defining WITH_OPTIMIZED_CFLAGS'
@${ECHO_MSG}
.endif
.ifndef(WITHOUT_POSTPROCESS)
@${ECHO_MSG} 'You can disable post process support by defining'
@${ECHO_MSG} 'WITHOUT_POSTPROCESS'
@${ECHO_MSG} 'Beware that this might break some ports that require it'
@${ECHO_MSG}
.endif
.ifndef(WITHOUT_VHOOK)
@${ECHO_MSG} 'You can disable vhook support by defining WITHOUT_VHOOK'
@${ECHO_MSG}
.endif
.ifndef(WITH_VORBIS)
@${ECHO_MSG} 'Define WITH_VORBIS to enable libvorbisenc VORBIS codec'
@${ECHO_MSG}
.endif
.ifndef(WITH_FAAC)
@${ECHO_MSG} 'Define WITH_FAAC to enable libfaac'
@${ECHO_MSG}
.endif
.ifndef(WITH_FAAD)
@${ECHO_MSG} 'Define WITH_FAAD to enable libfaad codec'
@${ECHO_MSG}
.endif
.ifndef(WITHOUT_FFMPEG_FFSERVER)
@${ECHO_MSG} 'Define WITHOUT_FFMPEG_FFSERVER to disable ffserver build'
@${ECHO_MSG}
.endif
.if ${ARCH} == "i386"
.if !(defined(WITH_BKTR_FORMAT) && defined(WITH_BKTR_DEV))
@${ECHO_MSG}
@${ECHO_MSG} 'If you want to capture from a bktr(4) supported card'
@${ECHO_MSG} 'you will probably need to set the input device and format'
@${ECHO_MSG} 'You can set WITH_BKTR_FORMAT to NTSC or PAL and you can set'
@${ECHO_MSG} 'WITH_BKTR_DEV to 0, 1, 2 or 3 (1 is usually the tuner)'
@${ECHO_MSG} 'so for a PAL tuner make WITH_BKTR_FORMAT=PAL WITH_BKTR_DEV=1'
@${ECHO_MSG}
@${ECHO_MSG} 'Warning: invalid settings will probably dump cores'
@${ECHO_MSG}
.endif
.endif # ${ARCH} == i386
post-extract:
.if ${ARCH} == "i386"
# install booktree extension
@${CP} ${FILESDIR}/grab_bsdbktr.c ${WRKSRC}/libavformat/
.endif # ${ARCH} == i386
post-patch:
# force detection of texi2html
.ifndef(NOPORTDOCS)
@${REINPLACE_CMD} -E \
-e 's|^(texi2html=)no|\1yes|' \
${CONFIGURE_WRKSRC}/${CONFIGURE_SCRIPT}
.endif
.ifndef(WITHOUT_FFMPEG_FFSERVER)
@${SED} -e 's|%%PREFIX%%|${PREFIX}|; s|%%RC_SUBR%%|${RC_SUBR}|' \
${FILESDIR}/ffserver.sh >${WRKDIR}/ffserver.sh
@${REINPLACE_CMD} -e "s!/etc/ffserver.conf!${PREFIX}/etc/ffserver.conf!g" \
${WRKSRC}/ffserver.c ${WRKSRC}/doc/ffserver-doc.texi
@${REINPLACE_CMD} -e 's!NoDaemon!# NoDaemon!g' \
${WRKSRC}/doc/ffserver.conf
.endif
.if ${ARCH} == "i386"
# we support "v4l" per default through Steve O'Hara-Smith's bktr(4)
# patch
@${REINPLACE_CMD} -E -e \
's|^(v4l).*$$|\1="yes"|' \
${WRKSRC}/configure
.ifdef(WITH_BKTR_FORMAT)
@${REINPLACE_CMD} -e \
"s!VIDEO_FORMAT NTSC!VIDEO_FORMAT ${WITH_BKTR_FORMAT}!" \
${WRKSRC}/libavformat/grab_bsdbktr.c
.endif
.ifdef(WITH_BKTR_DEV)
@${REINPLACE_CMD} -e \
"s!idev = 0!idev = ${WITH_BKTR_DEV}!" \
${WRKSRC}/libavformat/grab_bsdbktr.c
.endif
.endif # ${ARCH} == i386
# malloc.h was deprecated in favor of stdlib.h
@${FIND} ${WRKSRC} -type f | \
${XARGS} -n 10 ${REINPLACE_CMD} -e \
's|malloc\.h|stdlib\.h|'
.ifndef(WITHOUT_LIBA52)
@${REINPLACE_CMD} -e 's|-ldl||' \
${WRKSRC}/configure
.endif
.ifdef(WITH_SDL)
@${REINPLACE_CMD} -E \
-e 's|sdl-config|${SDL_CONFIG}|g' \
${CONFIGURE_WRKSRC}/${CONFIGURE_SCRIPT}
@${FIND} ${WRKSRC} -type f | \
${XARGS} -n 10 ${REINPLACE_CMD} -E \
-e 's|#include <SDL|#include <SDL11/SDL|'
.endif
pre-build:
.ifndef(WITHOUT_POSTPROCESS)
. ifndef(OSVERSION4_DONT_WORK)
@cd ${WRKSRC}/libavcodec/libpostproc && ${GMAKE}
. endif # OSVERSION4_DONT_WORK
.endif
post-install:
.ifndef(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}
.for file in ${DOC_FILES}
@${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR}
.endfor
.for file in ${DOC_DOCFILES}
@${INSTALL_DATA} ${WRKSRC}/doc/${file} ${DOCSDIR}
.endfor
.endif
.ifndef(WITHOUT_FFMPEG_FFSERVER)
@${INSTALL_DATA} ${WRKSRC}/doc/ffserver.conf \
${PREFIX}/etc/ffserver.conf.sample
@${INSTALL_SCRIPT} ${WRKDIR}/ffserver.sh ${PREFIX}/etc/rc.d
.endif
.for file in ${HEADER_FILES}
# fix header references prior to installation
@${REINPLACE_CMD} -e 's|"common.h"|<ffmpeg/common.h>|; \
s|"avcodec.h"|<ffmpeg/avcodec.h>|' \
${WRKSRC}/${file}
@${INSTALL_DATA} ${WRKSRC}/${file} \
${PREFIX}/include/ffmpeg/${file:T}
# change headers back so reinstall target works
@${REINPLACE_CMD} -e 's|<ffmpeg/common.h>|"common.h"|; \
s|<ffmpeg/avcodec.h>|"avcodec.h"|' \
${WRKSRC}/${file}
.endfor
.for file in ${LIB_FILES}
@${INSTALL_DATA} ${WRKSRC}/${file} ${PREFIX}/lib/${file:T}
.endfor
.ifndef(WITHOUT_POSTPROCESS)
@${MKDIR} ${PREFIX}/include/ffmpeg/postproc
@${INSTALL_DATA} ${WRKSRC}/libavcodec/libpostproc/postprocess.h \
${PREFIX}/include/ffmpeg/postproc/postprocess.h
. ifdef(GPLLIBS)
. ifndef(OSVERSION4_DONT_WORK)
. for lib in libpostproc.a libpostproc.so
@${INSTALL_DATA} ${WRKSRC}/libavcodec/libpostproc/${lib} \
${PREFIX}/lib
. endfor
@${LN} -sf libpostproc.so ${PREFIX}/lib/libpostproc.so.0
@${LN} -sf libpostproc.so ${PREFIX}/lib/libpostproc.so.${SHLIB_VERSION}
. endif # OSVERSION4_DONT_WORK
. endif
.endif
.include <bsd.port.post.mk>
|