# -*- 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           compiler_blacklist_versions 1.0

name                flac
version             1.4.3
categories          audio
license             GPL-2+ BSD
maintainers         nomaintainer

description         Free Lossless Audio Codec
long_description    FLAC stands for Free Lossless Audio Codec. Grossly \
                    oversimplified, FLAC is similar to MP3, but \
                    lossless, meaning that audio is compressed in FLAC \
                    without throwing away any information. This is \
                    similar to how Zip works, except with FLAC you \
                    will get much better compression because it is \
                    designed specifically for audio, and you can play \
                    back compressed FLAC files in your favorite player \
                    (or your car or home stereo) just like you would \
                    an MP3 file.
homepage            https://xiph.org/flac/

depends_lib         port:libiconv port:libogg

master_sites        https://ftp.osuosl.org/pub/xiph/releases/flac/
use_xz              yes
checksums           rmd160 6beb26da0ca6f5ecefaf4135ebf36e47b99f892c \
                    sha256 6c58e69cd22348f441b861092b825e591d0b822e106de6eb0ee4d05d27205b70 \
                    size   1006728

patchfiles          single_module.patch

# https://trac.macports.org/ticket/46038
# 3.1 through 3.3 have cpuid.h but lack __cpuid_count()
compiler.blacklist  macports-clang-3.3 {clang < 503}

configure.args      --disable-silent-rules

post-configure {
    if {[variant_exists universal] && [variant_isset universal]} {
        system -W ${worksrcpath} "ed - ${worksrcpath}/config.h < ${filespath}/config.h.ed && touch stamp-h1"
    }
}

test.run            yes
test.target         check

livecheck.url       [lindex ${master_sites} 0]
livecheck.regex     "${name}-(\\d+(?:\\.\\d+)*)"
