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

Last change on this file since 91753 was 91753, checked in by jeremyhu@…, 8 years ago

ffmpeg*: Don't use --host=... when building universal

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.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 91753 2012-04-09 19:34:53Z jeremyhu@macports.org $
3
4PortSystem 1.0
5PortGroup xcodeversion 1.0
6PortGroup muniversal 1.0
7
8name            ffmpeg
9conflicts       ffmpeg-devel
10epoch           1
11version         0.7.11
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    32f78f8990077dc045a52450c2ca2535eb6c7317 \
56                rmd160  5e9a7ba857c4d4542bc1631981959ab91a2a73d1
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# Under some conditions, llvm-gcc-4.2 drops some "unused" code even though it is used.
89# This is fixed in llvm-gcc trunk, but not in Apple's shipped llvm-gccs.
90if {${configure.compiler} == "llvm-gcc-4.2"} {
91    configure.compiler clang
92}
93
94# Xcode 4.1's clang has issues with ffmpeg
95# See https://trac.macports.org/ticket/30137
96if {$xcodeversion == "4.1"} {
97    pre-configure {
98        error "XCode 4.1 cannot compile ${name}; please upgrade"
99    }
100}
101
102configure.cflags-append    -DHAVE_LRINTF ${configure.cppflags}
103configure.args \
104        --enable-gpl \
105        --enable-postproc \
106        --enable-swscale --enable-avfilter \
107        --enable-libmp3lame \
108        --enable-libvorbis \
109        --enable-libtheora \
110        --enable-libdirac --enable-libschroedinger \
111        --enable-libopenjpeg \
112        --enable-libxvid \
113        --enable-libx264 \
114        --enable-libvpx \
115        --enable-libspeex \
116        --mandir=${prefix}/share/man \
117        --enable-shared --enable-pthreads \
118        --cc=${configure.cc}
119
120test.run        yes
121
122#
123# configure isn't autoconf and they do use a dep cache
124#
125
126post-destroot {
127    file mkdir ${destroot}${prefix}/share/doc/ffmpeg
128    file copy ${worksrcpath}/doc/APIchanges ${destroot}${prefix}/share/doc/ffmpeg
129    file copy ${worksrcpath}/doc/RELEASE_NOTES ${destroot}${prefix}/share/doc/ffmpeg
130    foreach f [glob ${worksrcpath}/doc/*.txt] {
131        file copy $f ${destroot}${prefix}/share/doc/ffmpeg
132    }
133}
134
135platform powerpc {
136    # absence of altivec is not automatically detected
137    if {[catch {sysctl hw.vectorunit} result] || $result == 0} {
138        configure.args-append --disable-altivec
139    }
140}
141
142configure.universal_args-delete --disable-dependency-tracking
143
144if {[variant_isset universal]} {
145    foreach arch ${configure.universal_archs} {
146        set merger_host($arch) ""
147        lappend merger_configure_args($arch) --arch=${arch}
148        lappend merger_configure_env($arch)  ASFLAGS='-arch ${arch}'
149    }
150    if {[string match "*86*" ${configure.universal_archs}]} {
151        depends_build-append port:yasm
152    }
153    lappend merger_configure_args(i386) --enable-yasm
154    lappend merger_configure_args(x86_64) --enable-yasm
155} else {
156    configure.args-append --arch=${configure.build_arch}
157    configure.env-append  ASFLAGS='[get_canonical_archflags]'
158    if {$build_arch == "i386" || $build_arch == "x86_64"} {
159        depends_build-append port:yasm
160        configure.args-append --enable-yasm
161    }
162}
163
164variant no_mmx description {disable all x86 asm optimizations} {
165    configure.args-append --disable-mmx --disable-mmx2 --disable-sse --disable-ssse3 --disable-amd3dnow --disable-amd3dnowext
166}
167
168variant no_gpl conflicts nonfree description {disallow use of GPL code, license will be LGPL} {
169    configure.args-delete   --enable-gpl \
170                            --enable-postproc \
171                            --enable-libx264 \
172                            --enable-libxvid
173    depends_lib-delete      port:XviD \
174                            port:x264
175    license-delete          GPL-2+
176    license-append          LGPL-2.1+
177}
178
179# the build server uses the default variants, and we want distributable binaries
180# nonfree code is disabled by default but can be enabled using the +nonfree variant
181
182variant nonfree conflicts no_gpl description {enable nonfree code, libraries and binaries will not be redistributable} {
183    configure.args-append   --enable-nonfree \
184                            --enable-libfaac
185    depends_lib-append      port:faac
186    license-delete          GPL-2+
187    license-append          Restrictive
188}
189
190if {[variant_isset nonfree]} {
191notes "
192*******
193******* This build of ${name} includes nonfree code as follows:
194*******
195*******     libfaac
196*******
197******* The following libraries and binaries may not be redistributed:
198*******
199*******     ffmpeg
200*******     libavcodec
201*******     libavdevice
202*******     libavfilter
203*******     libavformat
204*******     libavutil
205*******
206******* To remove this restriction remove the variant +nonfree
207*******
208"
209} elseif {![variant_isset no_gpl]} {
210notes "
211*******
212******* This build of ${name} includes GPLed code and
213******* is therefore licensed under GPL v2 or later.
214*******
215******* The following modules are GPLed:
216*******
217*******      postproc
218*******      libx264
219*******      libxvid
220*******
221******* To include all nonfree, GPLed and LGPL code use variant +nonfree
222******* To remove nonfree and GPLed code leaving only LGPL code use variant +no_gpl
223*******
224"
225} else {
226notes "
227*******
228******* This build of ${name} includes no GPLed or nonfree
229******* code and is therefore licensed under LGPL v2.1 or later.
230*******
231"
232}
233
234livecheck.type  regex
235livecheck.url   ${master_sites}
236livecheck.regex "${name}-(${branch}(?:\\.\\d+)*)${extract.suffix}"
Note: See TracBrowser for help on using the repository browser.