# -*- 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               github 1.0
PortGroup               meson 1.0
PortGroup               legacysupport 1.1

# strnlen
legacysupport.newest_darwin_requires_legacy 10

github.setup            Netflix vmaf 3.0.0 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from     tarball
name                    libvmaf
revision                1
categories              multimedia
license                 BSD
maintainers             {i0ntempest @i0ntempest} openmaintainer

description             Video Multi-Method Assessment Fusion - Perceptual video quality assessment
long_description        VMAF is an Emmy-winning perceptual video quality assessment algorithm \
                        developed by Netflix. libvmaf is the stand-alone C library. Also included \
                        in libvmaf are implementations of several other metrics: PSNR, PSNR-HVS, \
                        SSIM, MS-SSIM and CIEDE2000.

checksums               rmd160  5fd2ecb57f580b52c9644359abafb5946b7400c4 \
                        sha256  a2c667eed2598548099597310f75e23cd6489c52fa48964d35e3f3f237337fd3 \
                        size    18112296

configure.dir           ${configure.dir}/libvmaf

depends_build-append    port:nasm \
                        port:vim

# needed for stdatomic and uses newer assembly features
compiler.blacklist-append \
                        {*gcc-[3-4].*} {clang < 900}

configure.args-append   --buildtype release \
                        -Denable_asm=true \
                        -Denable_avx512=false \
                        -Dbuilt_in_models=true \
                        -Denable_tests=false

# incorrect strsep detection on <10.7
if {${os.platform} eq "darwin" && ${os.major} < 11} {
    configure.cflags-append -DHAVE_STRSEP
}

variant float description {Compile floating-point feature extractors into the library} {
    configure.args-append \
                        -Denable_float=true
}

variant avx512 description {Build AVX-512 asm files} {
    configure.args-delete \
                        -Denable_avx512=false
    configure.args-append \
                        -Denable_avx512=true
}

variant docs description {Install HTML docs} {
    depends_build-append port:doxygen
    configure.args-append \
                        -Denable_docs=true

    post-build {
        system -W ${build.dir} "${build.cmd} ${build.post_args} doc/html"
    }

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}
        copy ${build.dir}/doc/html ${destroot}${docdir}
    }
}

github.livecheck.regex  {([0-9.]+)}
