source: trunk/dports/multimedia/ffmpeg/Portfile @ 124862

Last change on this file since 124862 was 124862, checked in by devans@…, 5 years ago

ffmpeg: add +x11 variant to indicate binary dependency on libX11 when building with libsdl +x11, ensures appropriate rebuilding when -x11 is asserted.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.0 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 124862 2014-08-29 20:34:07Z devans@macports.org $
3
4PortSystem      1.0
5PortGroup       xcodeversion 1.0
6PortGroup       muniversal 1.0
7PortGroup       compiler_blacklist_versions 1.0
8PortGroup       active_variants 1.1
9
10name            ffmpeg
11conflicts       ffmpeg-devel
12epoch           1
13version         2.3.3
14revision        1
15license         LGPL-2.1+
16categories      multimedia
17maintainers     devans jeremyhu openmaintainer
18
19description     FFmpeg is a complete solution to play, record, convert and \
20                stream audio and video.
21
22long_description        FFmpeg is a complete solution to record, convert and \
23                        stream audio and video. It includes libavcodec, the \
24                        leading audio/video codec library. \
25                        \
26                        The project is made of several components: \
27                        \
28                        ffmpeg is a command line tool to convert one video \
29                        file format to another. It also supports grabbing and \
30                        encoding in real time from a TV card. \
31                        \
32                        ffserver is an HTTP (RTSP is being developed) \
33                        multimedia streaming server for live broadcasts. Time \
34                        shifting of live broadcast is also supported. \
35                        \
36                        ffplay is a simple media player based on SDL and on \
37                        the ffmpeg libraries. \
38                        \
39                        ffprobe gathers information from multimedia streams and \
40                        prints it in human- and machine-readable fashion. \
41                        \
42                        libavcodec is a library containing all the ffmpeg \
43                        audio/video encoders and decoders. Most codecs were \
44                        developed from scratch to ensure best performance \
45                        and high code reusability. \
46                        \
47                        libavformat is a library containing parsers and \
48                        generators for all common audio/video formats.
49
50platforms       darwin
51homepage        http://www.ffmpeg.org/
52master_sites    http://www.ffmpeg.org/releases/
53
54use_bzip2       yes
55
56checksums       rmd160  cee0f67250da8e5dd11e58321b0466dcdfd33073 \
57                sha256  bb4c0d10a24e08fe67292690a1b4d4ded04f5c4c388f0656c98940ab0c606446
58
59depends_build   port:pkgconfig \
60                port:gmake \
61                port:texi2html
62
63depends_lib     port:lame \
64                port:libiconv \
65                port:libvorbis \
66                port:libopus \
67                port:libogg \
68                port:libtheora \
69                port:libmodplug \
70                port:schroedinger \
71                port:libass \
72                port:libbluray \
73                port:gnutls \
74                port:openjpeg15 \
75                port:fontconfig \
76                port:freetype \
77                port:fribidi \
78                path:lib/libspeex.dylib:speex \
79                port:libvpx \
80                port:libsdl \
81                port:bzip2 \
82                port:zlib
83
84patchfiles      patch-libdc1394.diff
85
86build.cmd       ${prefix}/bin/gmake
87build.env-append V=1
88
89#
90# enable auto configure of asm optimizations
91# requires Xcode 3.1 or better on Leopard
92#
93minimum_xcodeversions {9 3.1}
94
95if {[lsearch [get_canonical_archs] i386] != -1} {
96    # clang-3.1 hits https://trac.macports.org/ticket/30137 (<rdar://problem/11542429>)
97    # clang-139 hits https://trac.macports.org/ticket/38141
98    compiler.blacklist-append {clang < 422.1.7} macports-clang-3.1
99}
100
101# The old ffmpeg port was GPL-2+ as base and had a no_gpl variant, so this keeps us consistent
102# Also, -gpl2 causes other ports to fail to build due to the missing libpostproc (#35473)
103default_variants-append +gpl2
104
105configure.cflags-append    -DHAVE_LRINTF ${configure.cppflags}
106configure.args \
107        --enable-swscale \
108        --enable-avfilter \
109        --enable-avresample \
110        --enable-libmp3lame \
111        --enable-libvorbis \
112        --enable-libopus \
113        --enable-libtheora \
114        --enable-libschroedinger \
115        --enable-libopenjpeg \
116        --enable-libmodplug \
117        --enable-libvpx \
118        --enable-libspeex \
119        --enable-libass \
120        --enable-libbluray \
121        --enable-gnutls \
122        --enable-fontconfig \
123        --enable-libfreetype \
124        --enable-libfribidi \
125        --disable-indev=jack \
126        --disable-outdev=xv \
127        --disable-vda \
128        --mandir=${prefix}/share/man \
129        --enable-shared --enable-pthreads \
130        --cc=${configure.cc}
131
132# disable asm on Tiger
133# libblueray doesn't build on Tiger so disable for now (#39442)
134
135platform darwin {
136    if {${os.major} < 9} {
137        depends_lib-delete    port:libbluray
138        configure.args-delete --enable-libbluray
139        configure.args-append --disable-libbluray
140        configure.args-append --disable-asm
141    }
142
143    # FIXME: use ${os.minor} once it hits stable base
144    # VDA (video hardware acceleration, mostly H264) is only supported on 10.6.3+
145    if {${os.major} > 10 || (${os.major} == 10 && [lindex [split ${os.version} .] 1] >= 3)} {
146        configure.args-delete --disable-vda
147        configure.args-append --enable-vda
148    }
149
150    # kCVPixelFormatType_OneComponent8 used in avfoundation indev is only available on 10.8+
151    if {${os.major} < 12} {
152        configure.args-append --disable-indev=avfoundation
153    }
154}
155
156test.run        yes
157
158#
159# configure isn't autoconf and they do use a dep cache
160#
161
162post-destroot {
163    file mkdir ${destroot}${prefix}/share/doc/ffmpeg
164    file copy ${worksrcpath}/doc/APIchanges ${destroot}${prefix}/share/doc/ffmpeg
165    foreach f [glob ${worksrcpath}/doc/*.txt] {
166        file copy $f ${destroot}${prefix}/share/doc/ffmpeg
167    }
168}
169
170platform powerpc {
171    # absence of altivec is not automatically detected
172    if {[catch {sysctl hw.vectorunit} result] || $result == 0} {
173        configure.args-append --disable-altivec
174    }
175}
176
177platform darwin 8 {
178    post-patch {
179        reinplace "s:,-compatibility_version,$\(LIBMAJOR\)::" ${worksrcpath}/configure
180    }
181}
182
183configure.universal_args-delete --disable-dependency-tracking
184
185if {[variant_isset universal]} {
186    foreach arch ${configure.universal_archs} {
187        set merger_host($arch) ""
188        lappend merger_configure_args($arch) --arch=${arch}
189        lappend merger_configure_env($arch)  ASFLAGS='-arch ${arch}'
190    }
191    if {[string match "*86*" ${configure.universal_archs}]} {
192        depends_build-append port:yasm
193    }
194    lappend merger_configure_args(i386) --enable-yasm
195    lappend merger_configure_args(x86_64) --enable-yasm
196} else {
197    configure.args-append --arch=${configure.build_arch}
198    configure.env-append  ASFLAGS='[get_canonical_archflags]'
199    if {${build_arch} eq "i386" || ${build_arch} eq "x86_64"} {
200        depends_build-append port:yasm
201        configure.args-append --enable-yasm
202    }
203}
204
205# this dummy variant is used to mark whether ffmpeg is built with
206# libsdl +x11 and hence has a binary dependency on xorg-libX11
207# or libsdl -x11 and does not
208
209variant x11 {}
210default_variants +x11
211
212if {[variant_isset x11]} {
213    require_active_variants libsdl x11
214} else {
215    require_active_variants libsdl "" x11
216}
217
218variant libdc1394 description {Enable IIDC-1394 frame grabbing using libdc1394 (experimental)} {
219    depends_lib-append port:libdc1394
220    configure.args-append --enable-libdc1394
221}
222
223# Allow use of librtmp instead of ffmpeg's internal rtmp implementation
224# May address interoperability issues with CRtmpServer and others
225# https://trac.macports.org/ticket/32219
226# https://groups.google.com/forum/#!topic/c-rtmp-server/ywQPjvciPgc
227# https://trac.ffmpeg.org/ticket/1700
228
229variant librtmp description {Use librtmp (from rtmpdump) as rtmp[t][es]:// protocol handler} {
230    configure.args-append   --enable-librtmp
231
232    depends_lib-append      port:rtmpdump
233}
234
235variant gpl2 description {Enable GPL code, license will be GPL-2+} {
236    configure.args-append   --enable-gpl \
237                            --enable-postproc \
238                            --enable-libx264 \
239                            --enable-libxvid
240    depends_lib-append      port:XviD \
241                            port:x264
242    license-delete          LGPL-2.1+
243    license-append          GPL-2+
244}
245
246variant gpl3 requires gpl2 description {Enable GPL code, license will be GPL-3+} {
247    configure.args-append   --enable-version3 \
248                            --enable-libopencore-amrnb \
249                            --enable-libopencore-amrwb \
250                            --enable-libsmbclient
251
252    depends_lib-append      port:opencore-amr \
253                            port:samba3
254
255    license-delete          LGPL-2.1+
256    license-append          GPL-3+
257}
258
259# the build server uses the default variants, and we want distributable binaries
260# nonfree code is disabled by default but can be enabled using the +nonfree variant
261
262variant nonfree description {enable nonfree code, libraries and binaries will not be redistributable} {
263    configure.args-append   --enable-nonfree \
264                            --enable-libfdk-aac \
265                            --enable-libfaac
266    depends_lib-append      port:libfdk-aac \
267                            port:faac
268    license-delete          LGPL-2.1+
269    license-append          Restrictive
270}
271
272if {[variant_isset nonfree]} {
273notes "
274*******
275******* This build of ${name} includes nonfree code as follows:
276*******
277*******     libfaac
278*******     libfdk-aac
279*******
280******* The following libraries and binaries may not be redistributed:
281*******
282*******     ffmpeg
283*******     libavcodec
284*******     libavdevice
285*******     libavfilter
286*******     libavformat
287*******     libavutil
288*******
289******* To remove this restriction remove the variant +nonfree
290*******
291"
292} elseif {[variant_isset gpl3]} {
293notes "
294*******
295******* This build of ${name} includes GPLed code and
296******* is therefore licensed under GPL v3 or later.
297*******
298******* The following modules are GPLed:
299*******
300*******      postproc
301*******      libsambaclient
302*******      libx264
303*******      libxvid
304*******      opencore-amr
305*******
306******* To include all nonfree, GPLed and LGPL code use variant +nonfree.
307******* To remove nonfree and GPLed code leaving only LGPL code remove the
308******* +gpl2 and +gpl3 variants.
309*******
310"
311} elseif {[variant_isset gpl2]} {
312notes "
313*******
314******* This build of ${name} includes GPLed code and
315******* is therefore licensed under GPL v2 or later.
316*******
317******* The following modules are GPLed:
318*******
319*******      postproc
320*******      libx264
321*******      libxvid
322*******
323******* To include all nonfree, GPLed and LGPL code use variant +nonfree.
324******* To remove nonfree and GPLed code leaving only LGPL code remove the
325******* +gpl2 variant.
326*******
327"
328} else {
329notes "
330*******
331******* This build of ${name} includes no GPLed or nonfree
332******* code and is therefore licensed under LGPL v2.1 or later.
333*******
334"
335}
336
337livecheck.type  regex
338livecheck.url   ${master_sites}
339livecheck.regex "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
Note: See TracBrowser for help on using the repository browser.