source: trunk/dports/multimedia/ffmpeg/Portfile

Last change on this file was 154361, checked in by devans@…, 11 months ago

ffmpeg: update to version 3.2, ABI compatible with previous version

  • support for old libfaac removed, use libfdk-aac instead
  • sdl outdev removed, replaced by sdl2 outdev
  • +x11 is available but no longer a default variant for compatibility with libsdl2
  • tarball root directory permissions set to 755 rather than 700 as shipped, maintenance issue
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 13.9 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 154361 2016-10-28 16:59:32Z ryandesign@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             3.2
14license             LGPL-2.1+
15categories          multimedia
16maintainers         devans jeremyhu openmaintainer
17
18description         FFmpeg is a complete solution to play, record, convert and \
19                    stream audio and video.
20
21long_description    FFmpeg is a complete solution to record, convert and \
22                    stream audio and video. It includes libavcodec, the \
23                    leading audio/video codec library. \
24                    \
25                    The project is made of several components: \
26                    \
27                    ffmpeg is a command line tool to convert one video \
28                    file format to another. It also supports grabbing and \
29                    encoding in real time from a TV card. \
30                    \
31                    ffserver is an HTTP (RTSP is being developed) \
32                    multimedia streaming server for live broadcasts. Time \
33                    shifting of live broadcast is also supported. \
34                    \
35                    ffplay is a simple media player based on SDL and on \
36                    the ffmpeg libraries. \
37                    \
38                    ffprobe gathers information from multimedia streams and \
39                    prints it in human- and machine-readable fashion. \
40                    \
41                    libavcodec is a library containing all the ffmpeg \
42                    audio/video encoders and decoders. Most codecs were \
43                    developed from scratch to ensure best performance \
44                    and high code reusability. \
45                    \
46                    libavformat is a library containing parsers and \
47                    generators for all common audio/video formats.
48
49platforms           darwin
50homepage            http://www.ffmpeg.org/
51master_sites        http://www.ffmpeg.org/releases/
52
53use_xz              yes
54
55checksums           rmd160  ed34d7d669f66f587efcbb7092781a48f629eef8 \
56                    sha256  88f70c1b8cab108f494ecbab5ba302cdb35d59a84cea88008b5fe49be068d5da
57
58# root directory of extracted tarball is owned by root and has permissions 700
59# set to 755 to facilitate maintenance
60
61post-extract {
62    file attributes ${worksrcpath} -permissions 0755
63}
64
65depends_build       port:pkgconfig \
66                    port:gmake \
67                    port:texinfo
68
69# libvpx is static only so can be considered a build dependency (#47934)
70
71depends_build-append \
72                    port:libvpx
73
74depends_lib         port:lame \
75                    port:libiconv \
76                    port:libvorbis \
77                    port:libopus \
78                    port:libogg \
79                    port:libtheora \
80                    port:libmodplug \
81                    port:schroedinger \
82                    port:libass \
83                    port:libbluray \
84                    port:gnutls \
85                    port:openjpeg \
86                    port:fontconfig \
87                    port:freetype \
88                    port:fribidi \
89                    path:lib/libspeex.dylib:speex \
90                    port:libsdl2 \
91                    port:soxr \
92                    port:bzip2 \
93                    port:xz \
94                    port:zlib
95
96patchfiles          patch-libavcodec-audiotoolboxenc.c.diff
97
98#
99# enable auto configure of asm optimizations
100# requires Xcode 3.1 or better on Leopard
101#
102minimum_xcodeversions {9 3.1}
103
104if {[lsearch [get_canonical_archs] i386] != -1} {
105    # clang-3.1 hits https://trac.macports.org/ticket/30137 (<rdar://problem/11542429>)
106    # clang-139 hits https://trac.macports.org/ticket/38141
107    compiler.blacklist-append {clang < 422.1.7}
108}
109
110# The old ffmpeg port was GPL-2+ as base and had a no_gpl variant, so this keeps us consistent
111# Also, -gpl2 causes other ports to fail to build due to the missing libpostproc (#35473)
112default_variants-append +gpl2
113
114configure.cflags-append -DHAVE_LRINTF ${configure.cppflags}
115configure.args      --enable-swscale \
116                    --enable-avfilter \
117                    --enable-avresample \
118                    --enable-libmp3lame \
119                    --enable-libvorbis \
120                    --enable-libopus \
121                    --enable-libtheora \
122                    --enable-libschroedinger \
123                    --enable-libopenjpeg \
124                    --enable-libmodplug \
125                    --enable-libvpx \
126                    --enable-libsoxr \
127                    --enable-libspeex \
128                    --enable-libass \
129                    --enable-libbluray \
130                    --enable-lzma \
131                    --enable-gnutls \
132                    --enable-fontconfig \
133                    --enable-libfreetype \
134                    --enable-libfribidi \
135                    --disable-libxcb \
136                    --disable-libxcb-shm \
137                    --disable-libxcb-xfixes \
138                    --disable-indev=jack \
139                    --disable-outdev=xv \
140                    --disable-vda \
141                    --disable-audiotoolbox \
142                    --disable-videotoolbox \
143                    --mandir=${prefix}/share/man \
144                    --enable-shared --enable-pthreads \
145                    --cc=${configure.cc}
146
147
148platform darwin {
149    # disable asm on Tiger
150    # libblueray doesn't build on Tiger so disable for now (#39442)
151    if {${os.major} < 9} {
152        depends_lib-delete    port:libbluray
153        configure.args-delete --enable-libbluray
154        configure.args-append --disable-libbluray
155        configure.args-append --disable-asm
156    }
157
158    # filters coreimage and coreimagesrc don't build on 10.6
159    # and earlier due to use of bridged casts in Objective C (#51823)
160    if {${os.major} < 11} {
161        configure.args-append --disable-filter=coreimage \
162                              --disable-filter=coreimagesrc
163    }
164
165    # VDA (video hardware acceleration, mostly H264) is only supported on 10.6.3+ up to (excluding) 10.11.
166    #if {(${os.major} > 10 || (${os.major} == 10 && ${os.minor} >= 3)) && (${os.major} < 15)}
167    # Due to a bug in ffmpeg(?), we have to enable VDA on 10.11 as well, even though it shouldn't be supported.
168    # More information: https://github.com/mpv-player/mpv/issues/2299
169    if {${os.major} > 10 || (${os.major} == 10 && ${os.minor} >= 3)} {
170        configure.args-delete --disable-vda
171        configure.args-append --enable-vda
172    }
173
174    # AudiotoolBox support requires CoreMedia Framework available on 10.7+
175    if {${os.major} > 10} {
176        configure.args-delete --disable-audiotoolbox
177        configure.args-append --enable-audiotoolbox
178    }
179
180    # VideotoolBox, a new hardware acceleration framework, is supported on 10.8+ and "here to stay".
181    # It provides support for H264, H263, MPEG1, MPEG2 and MPEG4.
182    if {${os.major} > 11} {
183        configure.args-delete --disable-videotoolbox
184        configure.args-append --enable-videotoolbox
185    }
186
187    # Apple GCC has problems with SIMD intrinsics and -Werror=no-missing-prototypes.
188    if {${os.major} < 11} {
189        patchfiles-append patch-configure-no-error-on-missing-prototypes.diff
190    }
191
192    # kCVPixelFormatType_OneComponent8 used in avfoundation indev is only available on 10.8+
193    if {${os.major} < 12} {
194        configure.args-append --disable-indev=avfoundation
195    }
196}
197
198build.cmd           ${prefix}/bin/gmake
199build.env-append    V=1
200
201test.run            yes
202
203destroot.env-append V=1
204
205#
206# configure isn't autoconf and they do use a dep cache
207#
208
209post-destroot {
210    file mkdir ${destroot}${prefix}/share/doc/ffmpeg
211    file copy ${worksrcpath}/doc/APIchanges ${destroot}${prefix}/share/doc/ffmpeg
212    foreach f [glob ${worksrcpath}/doc/*.txt] {
213        file copy $f ${destroot}${prefix}/share/doc/ffmpeg
214    }
215}
216
217platform powerpc {
218    # absence of altivec is not automatically detected
219    if {[catch {sysctl hw.vectorunit} result] || $result == 0} {
220        configure.args-append --disable-altivec
221    }
222}
223
224platform darwin 8 {
225    post-patch {
226        reinplace "s:,-compatibility_version,$\(LIBMAJOR\)::" ${worksrcpath}/configure
227    }
228}
229
230configure.universal_args-delete --disable-dependency-tracking
231
232if {[variant_isset universal]} {
233    foreach arch ${configure.universal_archs} {
234        set merger_host($arch) ""
235        lappend merger_configure_args($arch) --arch=${arch}
236        lappend merger_configure_env($arch)  ASFLAGS='-arch ${arch}'
237    }
238    if {[string match "*86*" ${configure.universal_archs}]} {
239        depends_build-append port:yasm
240    }
241    lappend merger_configure_args(i386) --enable-yasm
242    lappend merger_configure_args(x86_64) --enable-yasm
243} else {
244    configure.args-append --arch=${configure.build_arch}
245    configure.env-append  ASFLAGS='[get_canonical_archflags]'
246    if {${build_arch} eq "i386" || ${build_arch} eq "x86_64"} {
247        depends_build-append port:yasm
248        configure.args-append --enable-yasm
249    }
250}
251
252variant x11 {
253#
254# enable x11grab_xcb input device
255#
256    depends_lib-append      port:xorg-libxcb \
257                            port:xorg-libXext \
258                            port:xorg-libXfixes
259
260    configure.args-delete   --disable-libxcb \
261                            --disable-libxcb-shm \
262                            --disable-libxcb-xfixes \
263}
264
265if {[variant_isset x11]} {
266    require_active_variants libsdl2 x11
267} else {
268    require_active_variants libsdl2 "" x11
269}
270
271variant libdc1394 description {Enable IIDC-1394 frame grabbing using libdc1394 (experimental)} {
272    depends_lib-append port:libdc1394
273    configure.args-append --enable-libdc1394
274}
275
276# Allow use of librtmp instead of ffmpeg's internal rtmp implementation
277# May address interoperability issues with CRtmpServer and others
278# https://trac.macports.org/ticket/32219
279# https://groups.google.com/forum/#!topic/c-rtmp-server/ywQPjvciPgc
280# https://trac.ffmpeg.org/ticket/1700
281
282variant librtmp description {Use librtmp (from rtmpdump) as rtmp[t][es]:// protocol handler} {
283    configure.args-append   --enable-librtmp
284
285    depends_lib-append      port:rtmpdump
286}
287
288# x265 currently does not support OS X < 10.6 (#48336, #48338)
289# x265 cmake issues cause universal build to fail (#48331)
290# make libx265 support optional via +libx265 variant
291# only define variant for non-universal builds on 10.6 or greater
292
293platform darwin {
294    if {${os.major} > 8 && [variant_isset gpl2] && ![variant_isset universal]} {
295        variant libx265 description {Build with support for encoding HEVC video using libx265} {
296            configure.args-append   --enable-libx265
297            depends_lib-append      port:x265
298        }
299    }
300}
301
302variant high10 requires gpl2 description {Build using libx264 with 10-bit output} {}
303
304if {[variant_isset high10]} {
305    require_active_variants x264 high10
306} else {
307    require_active_variants x264 "" high10
308}
309
310variant gpl2 description {Enable GPL code, license will be GPL-2+} {
311    configure.args-append   --enable-gpl \
312                            --enable-postproc \
313                            --enable-libx264 \
314                            --enable-libxvid
315    depends_lib-append      port:XviD \
316                            port:x264
317
318    license                 GPL-2+
319}
320
321variant gpl3 requires gpl2 description {Enable GPL code, license will be GPL-3+} {
322    configure.args-append   --enable-version3 \
323                            --enable-libopencore-amrnb \
324                            --enable-libopencore-amrwb \
325                            --enable-libsmbclient
326
327    depends_lib-append      port:opencore-amr \
328                            port:samba3
329
330    license                 GPL-3+
331}
332
333# the build server uses the default variants, and we want distributable binaries
334# nonfree code is disabled by default but can be enabled using the +nonfree variant
335
336variant nonfree description {enable nonfree code, libraries and binaries will not be redistributable} {
337    configure.args-append   --enable-nonfree \
338                            --enable-libfdk-aac
339    depends_lib-append      port:libfdk-aac
340    license                 Restrictive
341}
342
343if {[variant_isset nonfree]} {
344notes "
345*******
346******* This build of ${name} includes nonfree code as follows:
347*******
348*******     libfdk-aac
349*******
350******* The following libraries and binaries may not be redistributed:
351*******
352*******     ffmpeg
353*******     libavcodec
354*******     libavdevice
355*******     libavfilter
356*******     libavformat
357*******     libavutil
358*******
359******* To remove this restriction remove the variant +nonfree
360*******
361"
362} elseif {[variant_isset gpl3]} {
363notes "
364*******
365******* This build of ${name} includes GPLed code and
366******* is therefore licensed under GPL v3 or later.
367*******
368******* The following modules are GPLed:
369*******
370*******      postproc
371*******      libsambaclient
372*******      libx264
373*******      libx265
374*******      libxvid
375*******      opencore-amr
376*******
377******* To include all nonfree, GPLed and LGPL code use variant +nonfree.
378******* To remove nonfree and GPLed code leaving only LGPL code remove the
379******* +gpl2 and +gpl3 variants.
380*******
381"
382} elseif {[variant_isset gpl2]} {
383notes "
384*******
385******* This build of ${name} includes GPLed code and
386******* is therefore licensed under GPL v2 or later.
387*******
388******* The following modules are GPLed:
389*******
390*******      postproc
391*******      libx264
392*******      libx265
393*******      libxvid
394*******
395******* To include all nonfree, GPLed and LGPL code use variant +nonfree.
396******* To remove nonfree and GPLed code leaving only LGPL code remove the
397******* +gpl2 variant.
398*******
399"
400} else {
401notes "
402*******
403******* This build of ${name} includes no GPLed or nonfree
404******* code and is therefore licensed under LGPL v2.1 or later.
405*******
406"
407}
408
409livecheck.type      regex
410livecheck.url       ${master_sites}
411livecheck.regex     "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
Note: See TracBrowser for help on using the repository browser.