# -*- 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           legacysupport 1.1
PortGroup           muniversal 1.0
PortGroup           xcode_workaround 1.0
PortGroup           xcodeversion 1.0

set my_name         ffmpeg
set ffmpeg_major    8
name                ${my_name}${ffmpeg_major}

# On the next update reset revision in altivec variants below.
version             ${ffmpeg_major}.1.2
revision            2

license             LGPL-2.1+
categories          multimedia
maintainers         {@barracuda156 macos-powerpc.org:barracuda} \
                    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  7b6b2b982a22338f38022a0149f7c9f15f6df4ff \
                    sha256  464beb5e7bf0c311e68b45ae2f04e9cc2af88851abb4082231742a74d97b524c \
                    size    11710924

depends_build-append \
                    port:cctools \
                    port:gmake \
                    path:bin/pkg-config:pkgconfig \
                    port:texinfo

depends_lib-append  port:aom \
                    port:bzip2 \
                    path:lib/pkgconfig/cairo.pc:cairo \
                    port:dav1d \
                    path:lib/pkgconfig/fontconfig.pc:fontconfig \
                    path:lib/pkgconfig/freetype2.pc:freetype \
                    port:fribidi \
                    path:lib/pkgconfig/gdk-pixbuf-2.0.pc:gdk-pixbuf2 \
                    port:gettext-runtime \
                    path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    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:libgme \
                    port:libiconv \
                    port:libjxl \
                    port:libmodplug \
                    port:libogg \
                    port:libopus \
                    path:lib/pkgconfig/librsvg-2.0.pc:librsvg \
                    port:libsdl2 \
                    port:libsixel \
                    port:libtheora \
                    port:libvorbis \
                    path:lib/pkgconfig/vpx.pc:libvpx \
                    port:lzo2 \
                    port:openh264 \
                    port:openjpeg \
                    port:soxr \
                    path:lib/libspeex.dylib:speex \
                    port:svt-av1 \
                    port:uavs3d \
                    port:vvenc \
                    port:webp \
                    port:xz \
                    port:zimg \
                    port:zlib \
                    port:zvbi

patch.pre_args-replace  -p0 -p1

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

# 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
    }
}

# error: call to undeclared function 'VTRegisterProfessionalVideoWorkflowVideoEncoders' on 10.9
patchfiles-append   patch-libavcodec-videotoolboxenc.c.diff

# https://github.com/saitoha/FFmpeg-SIXEL
patchfiles-append   patch-sixel.diff

# Fix coreimage, at least for 10.6:
patchfiles-append   patch-libavfilter-vf_coreimage.m-fix-for-gcc.diff

# Provisionally tested:
# https://forums.macrumors.com/threads/ppcports-the-only-ports-you-ever-need-on-a-powerpc.2462897/page-16?post=34663189#post-34663189
patchfiles-append   patch-endian-audiotoolbox.diff

# Experimental AltiVec implementation, used only when +G4 or +G5 variant is explicitly asked for.
if {[variant_isset G4] || [variant_isset G5]} {
    revision        3

    patchfiles-append \
                    0001-avcodec-ppc-add-AltiVec-optimized-VP9-decoder.patch \
                    0002-avutil-ppc-add-AltiVec-split-radix-FFT-backend-for-a.patch \
                    0003-avcodec-ppc-add-AltiVec-optimized-Opus-DSP-postfilte.patch \
                    0004-avcodec-ppc-add-AltiVec-HEVC-8-bit-qpel-h-v-hv-refer.patch \
                    0005-avutil-ppc-add-AltiVec-vector_fmac-fmul_scalar-butte.patch \
                    0006-avcodec-ppc-add-AltiVec-H.264-intra-prediction-16x16.patch \
                    0007-avcodec-ppc-add-AltiVec-ff_put-avg_pixels8_altivec-f.patch \
                    0008-avcodec-ppc-add-AltiVec-vector_clip_int32-vector_cli.patch \
                    0009-avcodec-ppc-add-AltiVec-ac3dsp-float_to_fixed24-sum_.patch \
                    0010-tests-checkasm-add-swr_resample-resample_common-resa.patch \
                    0011-avcodec-ppc-fix-vp9dsp_altivec-vertical-MC-filters-r.patch \
                    0012-avcodec-ppc-fix-vp8dsp_altivec-unaligned-read-write-.patch \
                    0013-tests-checkasm-call-swr-resample-dsp-under-the-real-.patch \
                    0014-avcodec-ppc-H.264-chroma-intra-loop-filters-and-chro.patch \
                    0015-avcodec-ppc-VP9-horizontal-loop-filters-4-8-wide-mix.patch \
                    0016-avcodec-ppc-emulated_edge_mc-AltiVec-O4.patch \
                    0017-avcodec-ppc-fix-h264-v-chroma-loop-filters-for-pix-1.patch \
                    0018-avcodec-ppc-make-emulated_edge_mc-stores-byte-precis.patch \
                    0019-avutil-ppc-fix-wrong-sel_hi-permute-in-av_tx-fft4_ve.patch \
                    0020-avutil-ppc-add-directly-selectable-top-level-av_tx-F.patch \
                    0021-avcodec-ppc-add-AltiVec-8-wide-h264qpel-MC-O7.patch \
                    0022-avutil-ppc-drop-top-level-av_tx-codelets-for-4-and-8.patch \
                    0023-avcodec-ppc-add-AltiVec-SBR-and-AAC-PS-DSP-kernels-O.patch \
                    0024-swresample-ppc-add-AltiVec-resample_common-float-ker.patch \
                    0025-avcodec-ppc-add-AltiVec-VP9-4x4-inverse-transforms-O.patch \
                    0026-swresample-ppc-fix-misleading-comment-on-the-x4-filt.patch \
                    0027-avcodec-ppc-bench-driven-per-CPU-tuning-of-AltiVec-r.patch \
                    0028-avcodec-ppc-add-AltiVec-VP9-8x8-inverse-transforms-O.patch \
                    0029-swresample-ppc-add-AltiVec-resample_linear-float-S16.patch \
                    0030-avcodec-ppc-tuning-pass-2-from-the-2026-07-30-G5-re-.patch \
                    0031-avcodec-ppc-add-AltiVec-VP9-16x16-32x32-inverse-tran.patch
}

# 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}

if {[tbool configure.ccache]} {
    set ccache_path ${prefix}/bin/ccache

    configure.cc-prepend \
                    ${ccache_path}
    configure.cxx-prepend \
                    ${ccache_path}

    pre-configure {
        if {[catch {set result [active_variants ccache ""]}]} {
            ui_msg "Error: ccache is enabled but ccache port is inactive. Either activate ccache port or disable ccache usage."
            return -code error "Unsupported set-up."
        }
    }
}

configure.cflags-append \
                    -DHAVE_LRINTF \
                    -Wno-deprecated-declarations \
                    ${configure.cppflags}

set port_prefix     ${prefix}/libexec/${name}
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} \
                    --prefix=${port_prefix}

configure.args-append \
                    --disable-audiotoolbox \
                    --disable-indev=jack \
                    --disable-libjack \
                    --disable-libopencolorio \
                    --disable-libopencore-amrnb \
                    --disable-libopencore-amrwb \
                    --disable-libopencv \
                    --disable-libplacebo \
                    --disable-libpulse \
                    --disable-libshaderc \
                    --disable-libvmaf \
                    --disable-libxcb \
                    --disable-libxcb-shm \
                    --disable-libxcb-xfixes \
                    --disable-metal \
                    --disable-opencl \
                    --disable-outdev=xv \
                    --disable-securetransport \
                    --disable-videotoolbox \
                    --disable-xlib \
                    --enable-avfilter \
                    --enable-fontconfig \
                    --enable-gnutls \
                    --enable-lcms2 \
                    --enable-libaom \
                    --enable-libass \
                    --enable-libbluray \
                    --enable-libdav1d \
                    --enable-libfreetype \
                    --enable-libfribidi \
                    --enable-libgme \
                    --enable-libjxl \
                    --enable-libmodplug \
                    --enable-libmp3lame \
                    --enable-libopenh264 \
                    --enable-libopenjpeg \
                    --enable-libopus \
                    --enable-librsvg \
                    --enable-libsixel \
                    --enable-libsoxr \
                    --enable-libspeex \
                    --enable-libsvtav1 \
                    --enable-libtheora \
                    --enable-libuavs3d \
                    --enable-libvorbis \
                    --enable-libvpx \
                    --enable-libvvenc \
                    --enable-libwebp \
                    --enable-libzimg \
                    --enable-libzvbi \
                    --enable-lzma \
                    --enable-pthreads \
                    --enable-sdl2 \
                    --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"

    # clang chokes on this, confusing VERSION with C++ header:
    # ./version:1:1: error: expected unqualified-id
    move ${worksrcpath}/VERSION ${worksrcpath}/VERSION.txt
}

platform darwin {
    # Filters coreimage and coreimagesrc don't build on 10.5
    # and earlier due to use of bridged casts in Objective C (#51823)
    if {${os.major} < 10} {
        configure.args-append \
                    --disable-filter=coreimage \
                    --disable-filter=coreimagesrc
    }

    if {${os.major} > 8} {
        configure.args-replace \
                    --disable-audiotoolbox \
                    --enable-audiotoolbox
    }

    # 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
    }

    # 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
    }

    # 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
    }

    # Tiger support
    if {${os.major} == 8} {
        post-patch {
            reinplace "s:,-compatibility_version,$\(LIBMAJOR\)::" ${worksrcpath}/configure
        }

        depends_lib-delete \
                    port:aom \
                    port:libbluray \
                    path:lib/pkgconfig/vpx.pc:libvpx \
                    port:svt-av1

        configure.args-replace \
                    --enable-libaom \
                    --disable-libaom \
                    --enable-libbluray \
                    --disable-libbluray \
                    --enable-libsvtav1 \
                    --disable-libsvtav1 \
                    --enable-libvpx \
                    --disable-libvpx

        configure.args-append \
                    --disable-asm
    }
}

# 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

if {[string match *gcc* ${configure.compiler}] && ${configure.build_arch} in [list arm i386 ppc]} {
    # Undefined symbols:
    #  "___atomic_fetch_sub_8", referenced from:
    #      _fifo_thread_dispatch_message.part.4 in fifo.o
    configure.ldflags-append \
                    -latomic
}

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
    }

    variant G4 conflicts G5 description "Optimize for G4" {
        configure.cflags-append \
                    -mcpu=G4 -mtune=G4
    }

    variant G5 conflicts G4 description "Optimize for G5" {
        configure.cflags-append \
                    -mcpu=970 -mtune=970

        # https://github.com/iains/gcc-14-branch/issues/24
        if {${configure.build_arch} ne "ppc64"} {
            configure.cflags-append \
                    -mno-powerpc64
        }
    }
}

# 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
    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}${ffmpeg_major} -> ${port_bindir}/${fname}"
        ln -s ${port_bindir}/${fname} ${destroot}${prefix}/bin/${fname}${ffmpeg_major}
    }
}

variant darwinssl description "Enable https support using Apple built-in TLS library instead of GNU TLS" {
    depends_lib-delete \
                    path:lib/pkgconfig/gnutls.pc:gnutls
    configure.args-delete \
                    --disable-securetransport \
                    --enable-gnutls
}

variant flite description "Enable flite audio source" {
    depends_lib-append \
                    port:flite
    configure.args-append \
                    --enable-libflite
}

variant gpl2 description "Enable GPL code, license will be GPL-2+" {
    license         GPL-2+

    depends_lib-append \
                    port:davs2 \
                    port:libvidstab \
                    port:x264 \
                    port:x265 \
                    port:XviD
    configure.args-append \
                    --enable-gpl \
                    --enable-libdavs2 \
                    --enable-libvidstab \
                    --enable-libx264 \
                    --enable-libx265 \
                    --enable-libxvid
}

variant gpl3 requires gpl2 description "Enable GPL code, license will be GPL-3+" {
    license         GPL-3+

    depends_lib-append \
                    port:libaribb24 \
                    path:lib/pkgconfig/smbclient.pc:samba4
    configure.args-append \
                    --enable-libaribb24 \
                    --enable-libsmbclient \
                    --enable-version3
}

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 \
                    --disable-indev=jack \
                    --enable-indev=jack
}

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 protocol handler" {
    depends_lib-append \
                    port:rtmpdump
    configure.args-append \
                    --enable-librtmp
}

# 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

    depends_lib-append \
                    port:libfdk-aac
    configure.args-append \
                    --enable-libfdk-aac \
                    --enable-nonfree
}

variant opencl description "Enable OpenCL" {
    configure.args-replace \
                    --disable-opencl \
                    --enable-opencl
    # Apple OpenCL support requires version 1.2, available in 10.8+.
    # FIXME: FreeOCL needs some extra work to make it usable.
    if {${os.platform} ne "darwin" || ${os.major} < 12} {
        depends_build-append \
                    port:opencl-headers
        depends_lib-append \
                    port:freeocl
    }
}

variant opencolorio description "Enable opencolorio support" {
    depends_lib-append \
                    port:opencolorio
    configure.args-replace \
                    --disable-libopencolorio --enable-libopencolorio
    configure.pre_args-append \
                    --cxx="${configure.cxx}"
    compiler.cxx_standard \
                    2017
}

# variant opencv description "Enable OpenCV support" {
#     depends_lib-append \
#                     port:opencv4
#     configure.args-replace \
#                     --disable-libopencv --enable-libopencv
# }

# variant opengl description "Enable OpenGL support" {
#     configure.args-append \
#                     --enable-opengl
# }

# Broken by design atm, requires vulkan:
# require_pkg_config libplacebo libplacebo >= 5.229.0 libplacebo/vulkan.h pl_vulkan_create
variant placebo description "Enable libplacebo support" {
    depends_lib-append \
                    port:libplacebo
    configure.args-replace \
                    --disable-libplacebo --enable-libplacebo
}

variant vmaf description "Enable VMAF perceptual video quality assessment" {
    depends_lib-append \
                    port:libvmaf
    configure.args-replace \
                    --disable-libvmaf --enable-libvmaf
}

variant x11 {
    # Enable x11grab_xcb input device
    depends_lib-append \
                    port:xorg-libxcb \
                    port:xorg-libXext \
                    port:xorg-libXfixes \
                    port:xorg-libXv
    configure.args-delete \
                    --disable-libxcb \
                    --disable-libxcb-shm \
                    --disable-libxcb-xfixes \
                    --disable-xlib
}

# 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 +vmaf

# See: https://github.com/macos-powerpc/powerpc-ports/issues/131
if {![variant_isset x11]} {
    default_variants-append +opencolorio
}

# ppc64 can only be built on a G5, so default to that.
if {${os.platform} eq "darwin" && ${configure.build_arch} eq "ppc64"} {
    default_variants-append +G5
}

# On PowerPC libsdl2 is a stub. x11-based SDL2 port is libsdl2-x11.
if {[variant_isset x11]} {
    if {${configure.build_arch} in [list ppc ppc64]} {
        depends_lib-replace \
                    port:libsdl2 port:libsdl2-x11
    } else {
        require_active_variants libsdl2 x11
    }
} else {
    if {${configure.build_arch} in [list ppc ppc64]} {
        depends_lib-replace \
                    port:libsdl2 port:libsdl2-cocoa
    } else {
        require_active_variants libsdl2 "" x11
    }
}

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 "
To compile and link with ${name}, add\
-I${port_prefix}/include and\
-L${port_prefix}/lib to your compile command.
For builds using pkg-config, add\
${port_prefix}/lib/pkgconfig to \$PKG_CONFIG_PATH.
"

livecheck.type      regex
livecheck.url       ${master_sites}
livecheck.regex     "${my_name}-(${ffmpeg_major}(?:\\.\\d+)*)${extract.suffix}"
