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

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

ffmpeg: update to version 3.1.5, ABI compatible with previous version.

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