-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathPortfile
598 lines (528 loc) · 21.3 KB
/
Portfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
# -*- 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
PortSystem 1.0
PortGroup active_variants 1.1
PortGroup compiler_blacklist_versions 1.0
PortGroup legacysupport 1.1
PortGroup muniversal 1.0
PortGroup xcode_workaround 1.0
PortGroup xcodeversion 1.0
name ffmpeg7
set my_name ffmpeg
version 7.1
revision 3
license LGPL-2.1+
categories multimedia
maintainers {mascguy @mascguy} \
{@barracuda156 gmail.com:vital.had} \
openmaintainer
description FFmpeg is a complete solution to play, record, \
convert and stream audio and video.
long_description {*}${description}. It includes libavcodec, \
the leading audio/video codec library. \
\
The project is made of several components: \
\
ffmpeg is a command line tool to convert one video \
file format to another. It also supports grabbing \
and encoding in real time from a TV card. \
\
ffserver is an HTTP (RTSP is being developed) \
multimedia streaming server for live broadcasts. \
Time shifting of live broadcast is also supported. \
\
ffplay is a simple media player based on SDL \
and on ffmpeg libraries. \
\
ffprobe gathers information from multimedia streams \
and prints it in human- and machine-readable fashion. \
\
libavcodec is a library containing all the ffmpeg \
audio/video encoders and decoders. Most codecs were \
developed from scratch to ensure best performance \
and high code reusability. \
\
libavformat is a library containing parsers and \
generators for all common audio/video formats.
homepage https://ffmpeg.org/
master_sites ${homepage}releases/
distname ${my_name}-${version}
dist_subdir ${my_name}
use_xz yes
checksums rmd160 c7f61777bb439de61e60e372625fd77a892ad8c0 \
sha256 40973d44970dbc83ef302b0609f2e74982be2d85916dd2ee7472d30678a7abe6 \
size 11011364
depends_build-append \
port:cctools \
port:gmake \
path:bin/pkg-config:pkgconfig \
port:texinfo
depends_lib-append \
port:bzip2 \
port:dav1d \
port:fontconfig \
port:freetype \
port:fribidi \
path:lib/pkgconfig/gnutls.pc:gnutls \
path:lib/pkgconfig/harfbuzz.pc:harfbuzz \
port:lame \
port:lcms2 \
path:lib/pkgconfig/libass.pc:libass \
port:libbluray \
port:libiconv \
port:libmodplug \
port:libogg \
port:libopus \
path:lib/pkgconfig/librsvg-2.0.pc:librsvg \
port:libtheora \
port:libvorbis \
path:lib/pkgconfig/vpx.pc:libvpx \
port:lzo2 \
port:openjpeg \
port:soxr \
path:lib/libspeex.dylib:speex \
port:webp \
port:xz \
port:zimg \
port:zlib \
port:zvbi
patchfiles-append patch-libavcodec-audiotoolboxenc.c.diff
patchfiles-append patch-avutil-builtin-available.diff
# Additional fixes related to use of '__builtin_available'
# TODO: Submit patches to upstream
patchfiles-append patch-libavcodec-profvidworkflow.diff
# https://trac.macports.org/ticket/68973
# TODO: Raise the issue to upstream
patchfiles-append patch-libavcodec-librsvgdec.diff
# add retina resolution capabilities via -movflags write_pixeldensity flag
# this patch is by daniel kaiser who posted on the ffmpeg bugtracker:
# https://fftrac-bg.ffmpeg.org/ticket/7045
# but he never formally submitted it to the FFMpeg mailing list, which i did
# https://ffmpeg.org/pipermail/ffmpeg-devel/2024-July/331470.html
# so the FFMpeg team does not seem to care to include this functionality
patchfiles-append patch-add-pixeldensity.diff
platform darwin {
# Typedef AVMediaType to NSString* on older systems
# Patch submitted to upstream, remove once upstream has included it
if {${os.major} < 17} {
patchfiles-append patch-libavdevice-avfoundation.diff
}
}
# https://trac.macports.org/ticket/68720
# Remove once upstream has included these in the next release
# patchfiles-append patch-issue-10695.diff
# https://trac.macports.org/ticket/69678
# patchfiles-append patch-fix-vulkan.diff
# enable auto configure of asm optimizations
# requires Xcode 3.1 or better on Leopard
minimum_xcodeversions {9 3.1}
# requires a C11 compiler
compiler.c_standard 2011
# clang-3.1 hits https://trac.macports.org/ticket/30137 (<rdar://problem/11542429>)
# clang-139 hits https://trac.macports.org/ticket/38141
# warning: unknown warning option '-Werror=partial-availability'; did you mean '-Werror=availability'? [-Wunknown-warning-option]
# warning: unknown warning option '-Wno-bool-operation'; did you mean '-Wno-bool-conversion'? [-Wunknown-warning-option]
compiler.blacklist-append {clang < 900}
# The old ffmpeg port was GPL-2+ as base and had a no_gpl variant, so this keeps us consistent
# Also, -gpl2 causes other ports to fail to build due to the missing libpostproc (#35473)
default_variants-append +gpl2
if {[tbool configure.ccache]} {
set ccache_path ${prefix}/bin/ccache
configure.cc-prepend \
${ccache_path}
configure.cxx-prepend \
${ccache_path}
}
configure.cflags-append \
-DHAVE_LRINTF \
-Wno-deprecated-declarations \
${configure.cppflags}
set port_ver_major [lindex [split ${version} .] 0]
set port_alias ${my_name}${port_ver_major}
set port_prefix ${prefix}/libexec/${port_alias}
set port_bindir ${port_prefix}/bin
set port_sharedir ${port_prefix}/share
set port_docdir ${port_sharedir}/doc
set port_datadir ${port_sharedir}/data
configure.pre_args-delete \
--prefix=${prefix}
configure.pre_args-append \
--cc="${configure.cc}" \
--datadir=${port_datadir} \
--docdir=${port_docdir} \
--progs-suffix=${port_ver_major} \
--prefix=${port_prefix}
configure.args-append \
--disable-audiotoolbox \
--disable-indev=jack \
--disable-libjack \
--disable-libopencore-amrnb \
--disable-libopencore-amrwb \
--disable-libplacebo \
--disable-libvmaf \
--disable-libxcb \
--disable-libxcb-shm \
--disable-libxcb-xfixes \
--disable-metal \
--disable-opencl \
--disable-outdev=xv \
--disable-sdl2 \
--disable-securetransport \
--disable-videotoolbox \
--disable-xlib \
--enable-avfilter \
--enable-fontconfig \
--enable-gnutls \
--enable-lcms2 \
--enable-libass \
--enable-libbluray \
--enable-libdav1d \
--enable-libfreetype \
--enable-libfribidi \
--enable-libmodplug \
--enable-libmp3lame \
--enable-libopenjpeg \
--enable-libopus \
--enable-librsvg \
--enable-libsoxr \
--enable-libspeex \
--enable-libtheora \
--enable-libvorbis \
--enable-libvpx \
--enable-libwebp \
--enable-libzimg \
--enable-libzvbi \
--enable-lzma \
--enable-pthreads \
--enable-shared \
--enable-swscale \
--enable-zlib
post-extract {
# fix file perms; tarball contents deny group and world read
system "find ${worksrcpath} -type d -print0 | xargs -0 chmod a+rx"
system "find ${worksrcpath} -type f -print0 | xargs -0 chmod a+r"
}
platform darwin 8 {
post-patch {
reinplace "s:,-compatibility_version,$\(LIBMAJOR\)::" ${worksrcpath}/configure
}
}
platform darwin {
# disable asm on Tiger
# libblueray doesn't build on Tiger so disable for now (#39442)
if {${os.major} < 9} {
depends_lib-delete \
port:libbluray
configure.args-replace \
--enable-libbluray \
--disable-libbluray
configure.args-append \
--disable-asm
}
# as of 1.6.0 libvpx only supports darwin 10 or later
if {${os.major} < 10} {
depends_lib-delete \
path:lib/pkgconfig/vpx.pc:libvpx
configure.args-replace \
--enable-libvpx \
--disable-libvpx
}
# filters coreimage and coreimagesrc don't build on 10.6
# and earlier due to use of bridged casts in Objective C (#51823)
if {${os.major} < 11} {
configure.args-append \
--disable-filter=coreimage \
--disable-filter=coreimagesrc
}
# AudioToolbox support requires CoreMedia Framework available on 10.7+
if {${os.major} > 10} {
configure.args-replace \
--disable-audiotoolbox \
--enable-audiotoolbox
}
if {${os.major} > 9 || ${configure.build_arch} in [list ppc ppc64]} {
# libsdl2 uses X11 backend on PowerPC and builds on 10.4+.
configure.args-replace \
--disable-sdl2 \
--enable-sdl2
depends_lib-append \
port:libsdl2
}
# VideoToolbox, a new hardware acceleration framework, is supported on 10.8+ and "here to stay".
# It provides support for H265, H264, H263, MPEG1, MPEG2 and MPEG4.
if {${os.major} > 11} {
configure.args-replace \
--disable-videotoolbox \
--enable-videotoolbox
}
# OpenCL support requires version 1.2 available 10.8+
if {${os.major} > 11} {
configure.args-replace \
--disable-opencl \
--enable-opencl
}
# Apple GCC has problems with SIMD intrinsics and -Werror=no-missing-prototypes.
if {${os.major} < 11} {
patchfiles-append \
patch-configure-no-error-on-missing-prototypes.diff
}
# avfoundation is only available on 10.7+
# as of ffmpeg 3.4.1 build fails on 10.7 as well
# libavdevice/avfoundation.m:207:14: error: expected method to read dictionary element not found on object of type 'NSDictionary *'
if {${os.major} < 12} {
configure.args-append \
--disable-indev=avfoundation
}
# av1 codecs, available on 10.5+
if {${os.major} >= 9} {
configure.args-append \
--enable-libaom \
--enable-libsvtav1
depends_lib-append \
port:aom \
port:svt-av1
}
# rav1e available on 10.6+
if {(${os.major} < 10) || (${configure.build_arch} eq "ppc")} {
if {[variant_isset rav1e]} {
error "Variant rav1e not supported for macOS 10.5 and earlier, or PPC"
}
}
# due to the new linker (which was introduced in Xcode 15: https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes),
# this port requires '-ld_classic' to build successfully with the toolchains from Xcode 15 or Command Line Tools 15.
#
# TODO: This is a temporary solution, the classic linker will be removed in a future release by Apple.
if { ${os.major} == 23 && ( [vercmp ${xcodeversion} 15 ] >= 0 ) || ( [vercmp ${xcodecltversion} 15 ] >= 0 ) } {
configure.ldflags-append \
-Wl,-ld_classic
}
}
platform powerpc {
# absence of altivec is not automatically detected
if {[catch {sysctl hw.vectorunit} result] || $result == 0} {
configure.args-append \
--disable-altivec
# as this machine is a G3, force a local build so we don't download a buildbot-built
# version possibly built on a G4+ or cross-compiled from an Intel system
archive_sites
}
# might be needed for any gcc build...
#Undefined symbols:
# "___atomic_fetch_sub_8", referenced from:
# _fifo_thread_dispatch_message.part.4 in fifo.o
configure.ldflags-append \
-latomic
}
# libavcodec/pcm-bluray.c: error: passing argument 2 of 'bytestream2_get_buffer' from incompatible pointer type [-Wincompatible-pointer-types]
configure.cflags-append \
-Wno-error=incompatible-pointer-types
# configure isn't autoconf and they do use a dep cache
configure.universal_args-delete \
--disable-dependency-tracking
if {${universal_possible} && [variant_isset universal]} {
foreach arch ${configure.universal_archs} {
set merger_host($arch) ""
lappend merger_configure_args($arch) \
--arch=${arch}
lappend merger_configure_env($arch) \
"ASFLAGS=-arch ${arch}"
}
if {[string match "*86*" ${configure.universal_archs}]} {
depends_build-append \
port:nasm
}
lappend merger_configure_args(i386) \
--enable-x86asm
lappend merger_configure_args(x86_64) \
--enable-x86asm
} else {
configure.args-append \
--arch=${configure.build_arch}
configure.env-append \
ASFLAGS=[get_canonical_archflags]
if {${build_arch} eq "i386" || ${build_arch} eq "x86_64"} {
depends_build-append \
port:nasm
configure.args-append \
--enable-x86asm
}
}
build.cmd ${prefix}/bin/gmake
build.env-append V=1
test.run yes
destroot.env-append V=1
post-destroot {
# Copy docs
file mkdir ${destroot}${port_docdir}
file copy ${worksrcpath}/doc/APIchanges ${destroot}${port_docdir}
foreach f [glob ${worksrcpath}/doc/*.txt] {
file copy $f ${destroot}${port_docdir}
}
# Create bin symlinks
if {![variant_isset no_symlink]} {
set port_bin_list \
[glob -type f -directory ${destroot}${port_bindir} *]
foreach f ${port_bin_list} {
set fname [file tail ${f}]
ui_info "Symlinking bin: ${prefix}/bin/${fname} -> ${port_bindir}/${fname}"
ln -s ${port_bindir}/${fname} ${destroot}${prefix}/bin/${fname}
}
}
}
variant no_symlink description {Disable binary suffices and symlinks} {
configure.pre_args-delete \
--progs-suffix=${port_ver_major}
}
variant x11 {
# enable x11grab_xcb input device
depends_lib-append \
port:xorg-libxcb \
port:xorg-libXext \
port:xorg-libXfixes
configure.args-delete \
--disable-xlib \
--disable-libxcb \
--disable-libxcb-shm \
--disable-libxcb-xfixes
}
# On PowerPC libsdl2 is a stub for libsdl2-powerpc, which is always built
# with X11 backend. It is meaningless to require it as a variant there.
if {${configure.build_arch} ni [list ppc ppc64]} {
if {[variant_isset x11]} {
require_active_variants libsdl2 x11
} else {
require_active_variants libsdl2 "" x11
}
}
variant libdc1394 description {Enable IIDC-1394 frame grabbing using libdc1394 (experimental)} {
depends_lib-append \
port:libdc1394
configure.args-append \
--enable-libdc1394
}
# Allow use of librtmp instead of ffmpeg's internal rtmp implementation
# May address interoperability issues with CRtmpServer and others
# https://trac.macports.org/ticket/32219
# https://groups.google.com/forum/#!topic/c-rtmp-server/ywQPjvciPgc
# https://trac.ffmpeg.org/ticket/1700
variant librtmp description {Use librtmp (from rtmpdump) as rtmp[t][es]:// protocol handler} {
configure.args-append \
--enable-librtmp
depends_lib-append \
port:rtmpdump
}
variant jack description {Enable jack library and indev support} {
# jack will autoconfigure if not disabled
depends_lib-append \
port:jack
configure.args-replace \
--disable-libjack \
--enable-libjack
configure.args-replace \
--disable-indev=jack \
--enable-indev=jack
}
variant darwinssl description {Enable https support using Apple built-in TLS library instead of GNU TLS} {
configure.args-delete \
--disable-securetransport
configure.args-delete \
--enable-gnutls
depends_lib-delete \
path:lib/pkgconfig/gnutls.pc:gnutls
}
variant gpl2 description {Enable GPL code, license will be GPL-2+} {
license GPL-2+
configure.args-append \
--enable-gpl \
--enable-libvidstab \
--enable-libx264 \
--enable-libx265 \
--enable-libxvid \
--enable-postproc
depends_lib-append \
port:libvidstab \
port:x264 \
port:x265 \
port:XviD
}
variant gpl3 requires gpl2 description {Enable GPL code, license will be GPL-3+} {
license GPL-3+
configure.args-append \
--enable-libaribb24 \
--enable-libsmbclient \
--enable-version3
depends_lib-append \
port:libaribb24 \
path:lib/pkgconfig/smbclient.pc:samba3
}
# the build server uses the default variants, and we want distributable binaries
# nonfree code is disabled by default but can be enabled using the +nonfree variant
variant nonfree description {enable nonfree code, libraries and binaries will not be redistributable} {
license Restrictive
configure.args-append \
--enable-libfdk-aac \
--enable-nonfree
depends_lib-append \
port:libfdk-aac
}
variant rav1e description {Enable codec rav1e} {
configure.args-append \
--enable-librav1e
depends_lib-append \
port:rav1e
}
variant flite description {Enable flite audio source} {
configure.args-append \
--enable-libflite
depends_lib-append \
port:flite
}
if {![variant_isset rav1e]} {
notes-append "Support for rav1e now disabled by default; enable via +rav1e"
}
if {[variant_isset nonfree]} {
notes-append "
This build of ${name} includes nonfree code as follows:
libfdk-aac
The following libraries and binaries may not be redistributed:
ffmpeg libavcodec libavdevice libavfilter libavformat libavutil
To remove this restriction remove the variant +nonfree
"
} elseif {[variant_isset gpl3]} {
notes-append "
This build of ${name} includes GPLed code and is therefore licensed under GPL v3 or later.\
The following modules are GPLed:
libsambaclient libvidstab libx264 libx265 libxvid postproc
To include all nonfree, GPLed and LGPL code use variant +nonfree.\
To remove nonfree and GPLed code leaving only LGPL code remove the +gpl2 and +gpl3 variants.
"
} elseif {[variant_isset gpl2]} {
notes-append "
This build of ${name} includes GPLed code and is therefore licensed under GPL v2 or later.\
The following modules are GPLed:
libvidstab libx264 libx265 libxvid postproc
To include all nonfree, GPLed and LGPL code use variant +nonfree.\
To remove nonfree and GPLed code leaving only LGPL code remove the +gpl2 variant.
"
} else {
notes-append "
This build of ${name} includes no GPLed or nonfree code and is therefore licensed under LGPL v2.1 or later.
"
}
notes-append ""
if {[variant_isset no_symlink]} {
notes-append "
To use the ${name} command-line programs, add\
${prefix}/libexec/ffmpeg${port_ver_major}/bin to your \$PATH,\
in front of the normal ${prefix}/bin; or else use full paths.
"
}
notes-append "
To compile and link with ${name}, add\
-I${prefix}/libexec/ffmpeg${port_ver_major}/include and\
-L${prefix}/libexec/ffmpeg${port_ver_major}/lib to your compile command.
For builds using pkg-config, add\
${prefix}/libexec/ffmpeg${port_ver_major}/lib/pkgconfig to \$PKG_CONFIG_PATH.
"
livecheck.type regex
livecheck.url ${master_sites}
livecheck.regex "${my_name}-(${port_ver_major}(?:\\.\\d+)*)${extract.suffix}"