Ticket #36693: Portfile

File Portfile, 8.6 KB (added by s_lessard@…, 12 years ago)
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 94553 2012-06-22 11:54:55Z jmr@macports.org $
3
4PortSystem 1.0
5PortGroup xcodeversion 1.0
6PortGroup muniversal 1.0
7
8name            ffmpeg
9conflicts       ffmpeg-devel
10epoch           1
11version         1.0
12revision        1
13set branch      [join [lrange [split ${version} .] 0 1] .]
14license         GPL-2+
15categories      multimedia
16maintainers     devans 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 developped) \
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                        developped from scratch to ensure best performances \
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_bzip2       yes
54
55checksums       sha1    bf1f917c4fa26cf225616f2063e60c33cac546be \
56                rmd160  ebb115127f40981ea1887f99b18ae6c70aef5830
57
58depends_build   port:pkgconfig \
59                port:gmake \
60                port:texi2html
61
62depends_lib     port:lame \
63                port:libvorbis \
64                port:libogg \
65                port:libtheora \
66                port:dirac \
67                port:schroedinger \
68                port:openjpeg \
69                path:lib/libspeex.dylib:speex \
70                port:XviD \
71                port:x264 \
72                port:libvpx \
73                path:lib/pkgconfig/sdl.pc:libsdl \
74                port:bzip2 \
75                port:zlib
76
77patchfiles      patch-configure.diff
78
79build.cmd       ${prefix}/bin/gmake
80build.env-append V=1
81
82#
83# enable auto configure of mmx and related Intel optimizations by default
84# requires Xcode 3.1 or better on Leopard
85#
86minimum_xcodeversions {9 3.1}
87
88# And similarly, disable mmx on Tiger
89platform darwin {
90    if {${os.major} < 9} {
91        default_variants -mmx
92    } else {
93        default_variants +mmx
94    }
95}
96
97# Under some conditions, llvm-gcc-4.2 drops some "unused" code even though it is used.
98# This is fixed in llvm-gcc trunk, but not in Apple's shipped llvm-gccs.
99if {${configure.compiler} == "llvm-gcc-4.2"} {
100    configure.compiler clang
101}
102
103# Newer clang hit https://trac.macports.org/ticket/30137 (<rdar://problem/11542429>)
104if {${configure.compiler} == "clang" && [vercmp ${xcodeversion} 4.1] >= 0 && [lsearch [get_canonical_archs] i386] != -1} {
105    depends_build-append port:clang-3.0
106    depends_skip_archcheck-append clang-3.0
107
108    configure.compiler macports-clang-3.0
109}
110
111# When updating this portfile for different versions of ffmpeg see
112# the web page http://www.e-rave.nl/installing-ffmpeg-on-debian-squeeze-and-newer
113# for info on which arguments to add to or remove from configure.args
114configure.cflags-append    -DHAVE_LRINTF ${configure.cppflags}
115configure.args \
116        --enable-gpl \
117        --enable-postproc \
118        --enable-swscale --enable-avfilter \
119        --enable-libmp3lame \
120        --enable-libvorbis \
121        --enable-libtheora \
122        --enable-libschroedinger \
123        --enable-libopenjpeg \
124        --enable-libxvid \
125        --enable-libx264 \
126        --enable-libvpx \
127        --enable-libspeex \
128        --disable-mmx \
129        --disable-mmx2 \
130        --disable-sse \
131        --disable-ssse3 \
132        --disable-amd3dnow \
133        --disable-amd3dnowext \
134        --mandir=${prefix}/share/man \
135        --enable-shared --enable-pthreads \
136        --cc=${configure.cc}
137
138test.run        yes
139
140#
141# configure isn't autoconf and they do use a dep cache
142#
143
144post-destroot {
145    file mkdir ${destroot}${prefix}/share/doc/ffmpeg
146    file copy ${worksrcpath}/doc/APIchanges ${destroot}${prefix}/share/doc/ffmpeg
147    file copy ${worksrcpath}/doc/RELEASE_NOTES ${destroot}${prefix}/share/doc/ffmpeg
148    foreach f [glob ${worksrcpath}/doc/*.txt] {
149        file copy $f ${destroot}${prefix}/share/doc/ffmpeg
150    }
151}
152
153platform powerpc {
154    # absence of altivec is not automatically detected
155    if {[catch {sysctl hw.vectorunit} result] || $result == 0} {
156        configure.args-append --disable-altivec
157    }
158}
159
160configure.universal_args-delete --disable-dependency-tracking
161
162if {[variant_isset universal]} {
163    foreach arch ${configure.universal_archs} {
164        set merger_host($arch) ""
165        lappend merger_configure_args($arch) --arch=${arch}
166        lappend merger_configure_env($arch)  ASFLAGS='-arch ${arch}'
167    }
168    if {[string match "*86*" ${configure.universal_archs}]} {
169        depends_build-append port:yasm
170    }
171    lappend merger_configure_args(i386) --enable-yasm
172    lappend merger_configure_args(x86_64) --enable-yasm
173} else {
174    configure.args-append --arch=${configure.build_arch}
175    configure.env-append  ASFLAGS='[get_canonical_archflags]'
176    if {$build_arch == "i386" || $build_arch == "x86_64"} {
177        depends_build-append port:yasm
178        configure.args-append --enable-yasm
179    }
180}
181
182variant mmx description {enable all supported x86 asm optimizations} {
183    configure.args-delete --disable-mmx --disable-mmx2 --disable-sse --disable-ssse3 --disable-amd3dnow --disable-amd3dnowext
184}
185
186variant no_gpl conflicts nonfree description {disallow use of GPL code, license will be LGPL} {
187    configure.args-delete   --enable-gpl \
188                            --enable-postproc \
189                            --enable-libx264 \
190                            --enable-libxvid
191    depends_lib-delete      port:XviD \
192                            port:x264
193    license-delete          GPL-2+
194    license-append          LGPL-2.1+
195}
196
197# the build server uses the default variants, and we want distributable binaries
198# nonfree code is disabled by default but can be enabled using the +nonfree variant
199
200variant nonfree conflicts no_gpl description {enable nonfree code, libraries and binaries will not be redistributable} {
201    configure.args-append   --enable-nonfree \
202                            --enable-libfaac
203    depends_lib-append      port:faac
204    license-delete          GPL-2+
205    license-append          Restrictive
206}
207
208if {[variant_isset nonfree]} {
209notes "
210*******
211******* This build of ${name} includes nonfree code as follows:
212*******
213*******     libfaac
214*******
215******* The following libraries and binaries may not be redistributed:
216*******
217*******     ffmpeg
218*******     libavcodec
219*******     libavdevice
220*******     libavfilter
221*******     libavformat
222*******     libavutil
223*******
224******* To remove this restriction remove the variant +nonfree
225*******
226"
227} elseif {![variant_isset no_gpl]} {
228notes "
229*******
230******* This build of ${name} includes GPLed code and
231******* is therefore licensed under GPL v2 or later.
232*******
233******* The following modules are GPLed:
234*******
235*******      postproc
236*******      libx264
237*******      libxvid
238*******
239******* To include all nonfree, GPLed and LGPL code use variant +nonfree
240******* To remove nonfree and GPLed code leaving only LGPL code use variant +no_gpl
241*******
242"
243} else {
244notes "
245*******
246******* This build of ${name} includes no GPLed or nonfree
247******* code and is therefore licensed under LGPL v2.1 or later.
248*******
249"
250}
251
252livecheck.type  regex
253livecheck.url   ${master_sites}
254livecheck.regex "${name}-(${branch}(?:\\.\\d+)*)${extract.suffix}"