# -*- 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.5.0
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 8a853d4b85b62dd6ac870c5f80a15c8c4e0ee19b \
                    sha256 f2c1c76592a82ffff8413ba3c4a1299b6c7ab06c734dee03fd88630485c2b920 \
                    size   1078872

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     [string cat ${name}- {(\d+(?:\.\d+)*)}]
