Ticket #65094: Portfile.libssh

File Portfile.libssh, 15.9 KB (added by sectroyer, 2 years ago)

ffmpeg port file with libssh variant

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
3PortSystem          1.0
4PortGroup           xcodeversion 1.0
5PortGroup           muniversal 1.0
6PortGroup           compiler_blacklist_versions 1.0
7PortGroup           active_variants 1.1
8
9# For 'TARGET_OS_OSX', 'TARGET_CPU_ARM64' macros
10PortGroup           legacysupport 1.1
11
12# https://trac.macports.org/ticket/59246
13# https://trac.macports.org/ticket/59308
14PortGroup           xcode_workaround 1.0
15
16name                ffmpeg
17set my_name         ffmpeg
18conflicts           ffmpeg-devel
19# Please increase the revision of mpv whenever ffmpeg's version is updated.
20epoch               1
21version             4.4.1
22revision            4
23license             LGPL-2.1+
24categories          multimedia
25maintainers         {devans @dbevans} {jeremyhu @jeremyhu} {mascguy @mascguy} openmaintainer
26
27description         FFmpeg is a complete solution to play, record, convert and \
28                    stream audio and video.
29
30long_description    FFmpeg is a complete solution to record, convert and \
31                    stream audio and video. It includes libavcodec, the \
32                    leading audio/video codec library. \
33                    \
34                    The project is made of several components: \
35                    \
36                    ffmpeg is a command line tool to convert one video \
37                    file format to another. It also supports grabbing and \
38                    encoding in real time from a TV card. \
39                    \
40                    ffserver is an HTTP (RTSP is being developed) \
41                    multimedia streaming server for live broadcasts. Time \
42                    shifting of live broadcast is also supported. \
43                    \
44                    ffplay is a simple media player based on SDL and on \
45                    the ffmpeg libraries. \
46                    \
47                    ffprobe gathers information from multimedia streams and \
48                    prints it in human- and machine-readable fashion. \
49                    \
50                    libavcodec is a library containing all the ffmpeg \
51                    audio/video encoders and decoders. Most codecs were \
52                    developed from scratch to ensure best performance \
53                    and high code reusability. \
54                    \
55                    libavformat is a library containing parsers and \
56                    generators for all common audio/video formats.
57
58platforms           darwin
59homepage            https://ffmpeg.org/
60master_sites        ${homepage}releases/
61distname            ${my_name}-${version}
62dist_subdir         ${my_name}
63use_xz              yes
64
65checksums           rmd160  ebb1f042b2ba4f13be86339d30522cd73eb6da3e \
66                    sha256  eadbad9e9ab30b25f5520fbfde99fae4a92a1ae3c0257a8d68569a4651e30e02 \
67                    size    9557516
68
69depends_build       port:pkgconfig \
70                    port:gmake \
71                    port:cctools \
72                    port:texinfo
73
74depends_lib         port:lame \
75                    port:libiconv \
76                    port:libvorbis \
77                    port:libopus \
78                    port:libogg \
79                    path:lib/pkgconfig/librsvg-2.0.pc:librsvg \
80                    port:libtheora \
81                    port:libmodplug \
82                    port:libass \
83                    port:libbluray \
84                    path:lib/pkgconfig/vpx.pc:libvpx \
85                    port:gnutls \
86                    port:openjpeg \
87                    port:zvbi \
88                    port:fontconfig \
89                    port:freetype \
90                    port:fribidi \
91                    path:lib/libspeex.dylib:speex \
92                    port:soxr \
93                    port:bzip2 \
94                    port:xz \
95                    port:zlib
96
97patchfiles          patch-libavcodec-audiotoolboxenc.c.diff
98
99# fix an upstream bug that overrides the max_b_frames setting
100# https://trac.ffmpeg.org/ticket/9231
101# this bug is fixed upstream in commit 55d9d6767967794edcdd6e1bbd8840fc6f4e9315
102# and should therefore be available in the next release version.
103patchfiles-append   patch-libavcodec-videotoolboxenc.c.diff
104
105# enable auto configure of asm optimizations
106# requires Xcode 3.1 or better on Leopard
107#
108minimum_xcodeversions {9 3.1}
109
110# requires a C11 compiler
111compiler.c_standard 2011
112
113# clang-3.1 hits https://trac.macports.org/ticket/30137 (<rdar://problem/11542429>)
114# clang-139 hits https://trac.macports.org/ticket/38141
115# warning: unknown warning option '-Werror=partial-availability'; did you mean '-Werror=availability'? [-Wunknown-warning-option]
116# warning: unknown warning option '-Wno-bool-operation'; did you mean '-Wno-bool-conversion'? [-Wunknown-warning-option]
117compiler.blacklist-append {clang < 800}
118
119# The old ffmpeg port was GPL-2+ as base and had a no_gpl variant, so this keeps us consistent
120# Also, -gpl2 causes other ports to fail to build due to the missing libpostproc (#35473)
121default_variants-append +gpl2
122
123configure.cflags-append -DHAVE_LRINTF ${configure.cppflags}
124configure.args      --enable-swscale \
125                    --enable-avfilter \
126                    --enable-avresample \
127                    --enable-libmp3lame \
128                    --enable-libvorbis \
129                    --enable-libopus \
130                    --enable-librsvg \
131                    --enable-libtheora \
132                    --enable-libopenjpeg \
133                    --enable-libmodplug \
134                    --enable-libvpx \
135                    --enable-libsoxr \
136                    --enable-libspeex \
137                    --enable-libass \
138                    --enable-libbluray \
139                    --enable-libzvbi \
140                    --enable-lzma \
141                    --enable-gnutls \
142                    --enable-fontconfig \
143                    --enable-libfreetype \
144                    --enable-libfribidi \
145                    --enable-zlib \
146                    --disable-libjack \
147                    --disable-libopencore-amrnb \
148                    --disable-libopencore-amrwb \
149                    --disable-libxcb \
150                    --disable-libxcb-shm \
151                    --disable-libxcb-xfixes \
152                    --disable-indev=jack \
153                    --disable-opencl \
154                    --disable-outdev=xv \
155                    --disable-audiotoolbox \
156                    --disable-videotoolbox \
157                    --disable-sdl2 \
158                    --disable-securetransport \
159                    --mandir=${prefix}/share/man \
160                    --enable-shared \
161                    --enable-pthreads \
162                    --cc=${configure.cc}
163
164
165# zimg doesn't currently build on 10.7 and below, so only enable it on supported systems
166if { ${os.platform} eq "darwin" && ${os.major} > 11 } {
167    configure.args-append   --enable-libzimg
168    depends_lib-append      port:zimg
169}
170
171platform darwin {
172    # disable asm on Tiger
173    # libblueray doesn't build on Tiger so disable for now (#39442)
174    if {${os.major} < 9} {
175        depends_lib-delete    port:libbluray
176        configure.args-replace --enable-libbluray --disable-libbluray
177        configure.args-append --disable-asm
178    }
179
180    # as of 1.6.0 libvpx only supports darwin 10 or later
181    if {${os.major} < 10} {
182        depends_lib-delete path:lib/pkgconfig/vpx.pc:libvpx
183        configure.args-replace --enable-libvpx --disable-libvpx
184    }
185
186    # filters coreimage and coreimagesrc don't build on 10.6
187    # and earlier due to use of bridged casts in Objective C (#51823)
188    if {${os.major} < 11} {
189        configure.args-append --disable-filter=coreimage \
190                              --disable-filter=coreimagesrc
191    }
192
193    # AudioToolbox support requires CoreMedia Framework available on 10.7+
194    if {${os.major} > 10} {
195        configure.args-replace --disable-audiotoolbox --enable-audiotoolbox
196    }
197
198    if {${os.major} > 9} {
199        # libsdl2 requires minimum Xcode 10.7 SDK to build successfully
200        # but builds on Snow Leopard
201        configure.args-replace --disable-sdl2 --enable-sdl2
202        depends_lib-append     port:libsdl2
203
204        # Dav1d: 10.6+ No PowerPC or Apple Silicon (for now)
205        if {![regexp -all (arm64|ppc*) [get_canonical_archs]]} {
206            configure.args-append   --enable-libdav1d
207            depends_lib-append      port:dav1d
208        }
209    }
210
211    # VideoToolbox, a new hardware acceleration framework, is supported on 10.8+ and "here to stay".
212    # It provides support for H264, H263, MPEG1, MPEG2 and MPEG4.
213    if {${os.major} > 11} {
214        configure.args-replace --disable-videotoolbox --enable-videotoolbox
215    }
216
217    # OpenCL support requires version 1.2 available 10.8+
218    if {${os.major} > 11} {
219        configure.args-replace --disable-opencl --enable-opencl
220    }
221
222    # Apple GCC has problems with SIMD intrinsics and -Werror=no-missing-prototypes.
223    if {${os.major} < 11} {
224        patchfiles-append patch-configure-no-error-on-missing-prototypes.diff
225    }
226
227    # avfoundation is only available on 10.7+
228    # as of ffmpeg 3.4.1 build fails on 10.7 as well
229    # libavdevice/avfoundation.m:207:14: error: expected method to read dictionary element not found on object of type 'NSDictionary *'
230    if {${os.major} < 12} {
231        configure.args-append --disable-indev=avfoundation
232    }
233}
234
235build.cmd           ${prefix}/bin/gmake
236build.env-append    V=1
237
238test.run            yes
239
240destroot.env-append V=1
241
242#
243# configure isn't autoconf and they do use a dep cache
244#
245
246post-destroot {
247    file mkdir ${destroot}${prefix}/share/doc/ffmpeg
248    file copy ${worksrcpath}/doc/APIchanges ${destroot}${prefix}/share/doc/ffmpeg
249    foreach f [glob ${worksrcpath}/doc/*.txt] {
250        file copy $f ${destroot}${prefix}/share/doc/ffmpeg
251    }
252}
253
254platform powerpc {
255    # absence of altivec is not automatically detected
256    if {[catch {sysctl hw.vectorunit} result] || $result == 0} {
257        configure.args-append --disable-altivec
258
259        # as this machine is a G3, force a local build so we don't download a buildbot-built
260        # version possibly built on a G4+ or cross-compiled from an Intel system
261        archive_sites
262    }
263
264    # might be needed for any gcc build...
265    #Undefined symbols:
266    #  "___atomic_fetch_sub_8", referenced from:
267    #      _fifo_thread_dispatch_message.part.4 in fifo.o
268    configure.ldflags-append -latomic
269
270
271}
272
273platform darwin 8 {
274    post-patch {
275        reinplace "s:,-compatibility_version,$\(LIBMAJOR\)::" ${worksrcpath}/configure
276    }
277}
278
279configure.universal_args-delete --disable-dependency-tracking
280
281if {![info exists universal_possible]} {
282    set universal_possible [expr {${os.universal_supported} && [llength ${configure.universal_archs}] >= 2}]
283}
284if {${universal_possible} && [variant_isset universal]} {
285    foreach arch ${configure.universal_archs} {
286        set merger_host($arch) ""
287        lappend merger_configure_args($arch) --arch=${arch}
288        lappend merger_configure_env($arch)  ASFLAGS='-arch ${arch}'
289    }
290    if {[string match "*86*" ${configure.universal_archs}]} {
291        depends_build-append port:nasm
292    }
293    lappend merger_configure_args(i386) --enable-x86asm
294    lappend merger_configure_args(x86_64) --enable-x86asm
295} else {
296    configure.args-append --arch=${configure.build_arch}
297    configure.env-append  ASFLAGS=[get_canonical_archflags]
298    if {${build_arch} eq "i386" || ${build_arch} eq "x86_64"} {
299        depends_build-append port:nasm
300        configure.args-append --enable-x86asm
301    }
302}
303
304variant x11 {
305#
306# enable x11grab_xcb input device
307#
308    depends_lib-append      port:xorg-libxcb \
309                            port:xorg-libXext \
310                            port:xorg-libXfixes
311
312    configure.args-delete   --disable-libxcb \
313                            --disable-libxcb-shm \
314                            --disable-libxcb-xfixes \
315}
316
317if {[variant_isset x11]} {
318    require_active_variants libsdl2 x11
319} else {
320    require_active_variants libsdl2 "" x11
321}
322
323variant libdc1394 description {Enable IIDC-1394 frame grabbing using libdc1394 (experimental)} {
324    depends_lib-append port:libdc1394
325    configure.args-append --enable-libdc1394
326}
327
328# Enable use of libssh for sftp support
329# https://trac.macports.org/ticket/65094
330
331variant libssh description {Use libssh as sftp:// protocol handler} {
332    configure.args-append   --enable-libssh
333
334    depends_lib-append      port:libssh
335}
336
337
338# Allow use of librtmp instead of ffmpeg's internal rtmp implementation
339# May address interoperability issues with CRtmpServer and others
340# https://trac.macports.org/ticket/32219
341# https://groups.google.com/forum/#!topic/c-rtmp-server/ywQPjvciPgc
342# https://trac.ffmpeg.org/ticket/1700
343
344variant librtmp description {Use librtmp (from rtmpdump) as rtmp[t][es]:// protocol handler} {
345    configure.args-append   --enable-librtmp
346
347    depends_lib-append      port:rtmpdump
348}
349
350# x265 currently does not support OS X < 10.6 (#48336, #48338)
351# only enable libx265 support on 10.6 or greater
352
353platform darwin {
354    if {${os.major} > 9 && [variant_isset gpl2]} {
355        configure.args-append   --enable-libx265
356        depends_lib-append      port:x265
357    }
358}
359
360variant jack description {Enable jack library and indev support} {
361# jack will autoconfigure if not disabled
362    depends_lib-append      port:jack
363    configure.args-delete   --disable-libjack \
364                            --disable-indev=jack
365}
366
367variant darwinssl description {Enable https support using Apple built-in TLS library instead of GNU TLS} {
368    configure.args-delete   --disable-securetransport
369    configure.args-delete   --enable-gnutls
370    depends_lib-delete      port:gnutls
371}
372
373variant gpl2 description {Enable GPL code, license will be GPL-2+} {
374    configure.args-append   --enable-gpl \
375                            --enable-postproc \
376                            --enable-libx264 \
377                            --enable-libxvid
378    depends_lib-append      port:XviD \
379                            port:x264
380
381    license                 GPL-2+
382}
383
384variant gpl3 requires gpl2 description {Enable GPL code, license will be GPL-3+} {
385    configure.args-append   --enable-version3 \
386                            --enable-libsmbclient \
387                            --enable-libaribb24
388
389    depends_lib-append      path:lib/pkgconfig/smbclient.pc:samba3 \
390                            port:libaribb24
391
392    license                 GPL-3+
393}
394
395# the build server uses the default variants, and we want distributable binaries
396# nonfree code is disabled by default but can be enabled using the +nonfree variant
397
398variant nonfree description {enable nonfree code, libraries and binaries will not be redistributable} {
399    configure.args-append   --enable-nonfree \
400                            --enable-libfdk-aac
401    depends_lib-append      port:libfdk-aac
402    license                 Restrictive
403}
404
405if {[variant_isset nonfree]} {
406notes "
407This build of ${name} includes nonfree code as follows:
408  libfdk-aac
409The following libraries and binaries may not be redistributed:
410  ffmpeg
411  libavcodec
412  libavdevice
413  libavfilter
414  libavformat
415  libavutil
416To remove this restriction remove the variant +nonfree
417"
418} elseif {[variant_isset gpl3]} {
419notes "
420This build of ${name} includes GPLed code and is therefore licensed under GPL v3 or later.
421The following modules are GPLed:
422  postproc
423  libsambaclient
424  libx264
425  libx265
426  libxvid
427To include all nonfree, GPLed and LGPL code use variant +nonfree.
428To remove nonfree and GPLed code leaving only LGPL code remove the +gpl2 and +gpl3 variants.
429"
430} elseif {[variant_isset gpl2]} {
431notes "
432This build of ${name} includes GPLed code and is therefore licensed under GPL v2 or later.
433The following modules are GPLed:
434  postproc
435  libx264
436  libx265
437  libxvid
438To include all nonfree, GPLed and LGPL code use variant +nonfree.
439To remove nonfree and GPLed code leaving only LGPL code remove the +gpl2 variant.
440"
441} else {
442notes "
443This build of ${name} includes no GPLed or nonfree code\
444and is therefore licensed under LGPL v2.1 or later.
445"
446}
447
448livecheck.type      regex
449livecheck.url       ${master_sites}
450livecheck.regex     "${my_name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"