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

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

ffmpeg: explicitly enable optional lzma suport and depend on xz to provide liblzma, rebuild.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.1 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 126103 2014-10-03 21:56:49Z 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.4.1
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  9a88e2ec407c8696dbd4aeba309e68c948f60f22 \
57                sha256  b4aecfce2c41ea4a21320dad818aa9a365b09a9cafe0b7173359cba86683c7f3
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:xz \
83                port:zlib
84
85patchfiles      patch-libdc1394.diff
86
87build.cmd       ${prefix}/bin/gmake
88build.env-append V=1
89
90#
91# enable auto configure of asm optimizations
92# requires Xcode 3.1 or better on Leopard
93#
94minimum_xcodeversions {9 3.1}
95
96if {[lsearch [get_canonical_archs] i386] != -1} {
97    # clang-3.1 hits https://trac.macports.org/ticket/30137 (<rdar://problem/11542429>)
98    # clang-139 hits https://trac.macports.org/ticket/38141
99    compiler.blacklist-append {clang < 422.1.7} macports-clang-3.1
100}
101
102# The old ffmpeg port was GPL-2+ as base and had a no_gpl variant, so this keeps us consistent
103# Also, -gpl2 causes other ports to fail to build due to the missing libpostproc (#35473)
104default_variants-append +gpl2
105
106configure.cflags-append    -DHAVE_LRINTF ${configure.cppflags}
107configure.args \
108        --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-libspeex \
120        --enable-libass \
121        --enable-libbluray \
122        --enable-lzma \
123        --enable-gnutls \
124        --enable-fontconfig \
125        --enable-libfreetype \
126        --enable-libfribidi \
127        --disable-indev=jack \
128        --disable-outdev=xv \
129        --disable-vda \
130        --mandir=${prefix}/share/man \
131        --enable-shared --enable-pthreads \
132        --cc=${configure.cc}
133
134# disable asm on Tiger
135# libblueray doesn't build on Tiger so disable for now (#39442)
136
137platform darwin {
138    if {${os.major} < 9} {
139        depends_lib-delete    port:libbluray
140        configure.args-delete --enable-libbluray
141        configure.args-append --disable-libbluray
142        configure.args-append --disable-asm
143    }
144
145    # FIXME: use ${os.minor} once it hits stable base
146    # VDA (video hardware acceleration, mostly H264) is only supported on 10.6.3+
147    if {${os.major} > 10 || (${os.major} == 10 && [lindex [split ${os.version} .] 1] >= 3)} {
148        configure.args-delete --disable-vda
149        configure.args-append --enable-vda
150    }
151
152    # kCVPixelFormatType_OneComponent8 used in avfoundation indev is only available on 10.8+
153    if {${os.major} < 12} {
154        configure.args-append --disable-indev=avfoundation
155    }
156}
157
158test.run        yes
159
160#
161# configure isn't autoconf and they do use a dep cache
162#
163
164post-destroot {
165    file mkdir ${destroot}${prefix}/share/doc/ffmpeg
166    file copy ${worksrcpath}/doc/APIchanges ${destroot}${prefix}/share/doc/ffmpeg
167    foreach f [glob ${worksrcpath}/doc/*.txt] {
168        file copy $f ${destroot}${prefix}/share/doc/ffmpeg
169    }
170}
171
172platform powerpc {
173    # absence of altivec is not automatically detected
174    if {[catch {sysctl hw.vectorunit} result] || $result == 0} {
175        configure.args-append --disable-altivec
176    }
177}
178
179platform darwin 8 {
180    post-patch {
181        reinplace "s:,-compatibility_version,$\(LIBMAJOR\)::" ${worksrcpath}/configure
182    }
183}
184
185configure.universal_args-delete --disable-dependency-tracking
186
187if {[variant_isset universal]} {
188    foreach arch ${configure.universal_archs} {
189        set merger_host($arch) ""
190        lappend merger_configure_args($arch) --arch=${arch}
191        lappend merger_configure_env($arch)  ASFLAGS='-arch ${arch}'
192    }
193    if {[string match "*86*" ${configure.universal_archs}]} {
194        depends_build-append port:yasm
195    }
196    lappend merger_configure_args(i386) --enable-yasm
197    lappend merger_configure_args(x86_64) --enable-yasm
198} else {
199    configure.args-append --arch=${configure.build_arch}
200    configure.env-append  ASFLAGS='[get_canonical_archflags]'
201    if {${build_arch} eq "i386" || ${build_arch} eq "x86_64"} {
202        depends_build-append port:yasm
203        configure.args-append --enable-yasm
204    }
205}
206
207# this dummy variant is used to mark whether ffmpeg is built with
208# libsdl +x11 and hence has a binary dependency on xorg-libX11
209# or libsdl -x11 and does not
210
211variant x11 {}
212default_variants +x11
213
214if {[variant_isset x11]} {
215    require_active_variants libsdl x11
216} else {
217    require_active_variants libsdl "" x11
218}
219
220variant libdc1394 description {Enable IIDC-1394 frame grabbing using libdc1394 (experimental)} {
221    depends_lib-append port:libdc1394
222    configure.args-append --enable-libdc1394
223}
224
225# Allow use of librtmp instead of ffmpeg's internal rtmp implementation
226# May address interoperability issues with CRtmpServer and others
227# https://trac.macports.org/ticket/32219
228# https://groups.google.com/forum/#!topic/c-rtmp-server/ywQPjvciPgc
229# https://trac.ffmpeg.org/ticket/1700
230
231variant librtmp description {Use librtmp (from rtmpdump) as rtmp[t][es]:// protocol handler} {
232    configure.args-append   --enable-librtmp
233
234    depends_lib-append      port:rtmpdump
235}
236
237variant gpl2 description {Enable GPL code, license will be GPL-2+} {
238    configure.args-append   --enable-gpl \
239                            --enable-postproc \
240                            --enable-libx264 \
241                            --enable-libxvid
242    depends_lib-append      port:XviD \
243                            port:x264
244    license-delete          LGPL-2.1+
245    license-append          GPL-2+
246}
247
248variant gpl3 requires gpl2 description {Enable GPL code, license will be GPL-3+} {
249    configure.args-append   --enable-version3 \
250                            --enable-libopencore-amrnb \
251                            --enable-libopencore-amrwb \
252                            --enable-libsmbclient
253
254    depends_lib-append      port:opencore-amr \
255                            port:samba3
256
257    license-delete          LGPL-2.1+
258    license-append          GPL-3+
259}
260
261# the build server uses the default variants, and we want distributable binaries
262# nonfree code is disabled by default but can be enabled using the +nonfree variant
263
264variant nonfree description {enable nonfree code, libraries and binaries will not be redistributable} {
265    configure.args-append   --enable-nonfree \
266                            --enable-libfdk-aac \
267                            --enable-libfaac
268    depends_lib-append      port:libfdk-aac \
269                            port:faac
270    license-delete          LGPL-2.1+
271    license-append          Restrictive
272}
273
274if {[variant_isset nonfree]} {
275notes "
276*******
277******* This build of ${name} includes nonfree code as follows:
278*******
279*******     libfaac
280*******     libfdk-aac
281*******
282******* The following libraries and binaries may not be redistributed:
283*******
284*******     ffmpeg
285*******     libavcodec
286*******     libavdevice
287*******     libavfilter
288*******     libavformat
289*******     libavutil
290*******
291******* To remove this restriction remove the variant +nonfree
292*******
293"
294} elseif {[variant_isset gpl3]} {
295notes "
296*******
297******* This build of ${name} includes GPLed code and
298******* is therefore licensed under GPL v3 or later.
299*******
300******* The following modules are GPLed:
301*******
302*******      postproc
303*******      libsambaclient
304*******      libx264
305*******      libxvid
306*******      opencore-amr
307*******
308******* To include all nonfree, GPLed and LGPL code use variant +nonfree.
309******* To remove nonfree and GPLed code leaving only LGPL code remove the
310******* +gpl2 and +gpl3 variants.
311*******
312"
313} elseif {[variant_isset gpl2]} {
314notes "
315*******
316******* This build of ${name} includes GPLed code and
317******* is therefore licensed under GPL v2 or later.
318*******
319******* The following modules are GPLed:
320*******
321*******      postproc
322*******      libx264
323*******      libxvid
324*******
325******* To include all nonfree, GPLed and LGPL code use variant +nonfree.
326******* To remove nonfree and GPLed code leaving only LGPL code remove the
327******* +gpl2 variant.
328*******
329"
330} else {
331notes "
332*******
333******* This build of ${name} includes no GPLed or nonfree
334******* code and is therefore licensed under LGPL v2.1 or later.
335*******
336"
337}
338
339livecheck.type  regex
340livecheck.url   ${master_sites}
341livecheck.regex "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
Note: See TracBrowser for help on using the repository browser.