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

name                wavpack
version             5.8.1
revision            0

checksums           rmd160 24b952ba29ef8b5ab5381741e6245e044030e294 \
                    sha256 7322775498602c8850afcfc1ae38f99df4cbcd51386e873d6b0f8047e55c0c26 \
                    size   822696

categories          audio
license             BSD
maintainers         nomaintainer
description         Hybrid lossless audio compression
long_description    WavPack is a completely open audio compression format \
                    providing lossless, high-quality lossy, and a unique \
                    hybrid compression mode. Although the technology is \
                    loosely based on previous versions of WavPack, the new \
                    version 4 format has been designed from the ground up \
                    to offer unparalleled performance and functionality.
homepage            https://www.wavpack.com
master_sites        ${homepage}
use_xz              yes

depends_lib         port:libiconv

platform darwin {
    # handrolled asm has issues on older platforms.  Disable it if we don't have access to newer compilers.
    # Note that "libc++" is really a proxy here for "configuration that supports newer compilers"; the C++
    # runtime actually isn't relevant other than being a requirement of clang-3.5+.
    if {${configure.cxx_stdlib} eq "libc++"} {
        compiler.blacklist {macports-clang-3.[34]} {clang < 500} *gcc*
    } else {
        configure.args-append --disable-asm
    }
}

# unpack_armv7.S:1:1: error: unexpected token at start of statement
lappend merger_configure_args(arm64)    --disable-asm

# if host is not set in 32-bit mode, wrong assembly code is used
lappend merger_configure_args(i386)     --host=i686-apple-${os.platform}${os.version}

if {!(${universal_possible} && [variant_isset universal]) && [info exists merger_configure_args(${configure.build_arch})]} {
    configure.args-append   {*}$merger_configure_args(${configure.build_arch})
}

livecheck.type      regex
livecheck.url       ${homepage}/downloads.html
livecheck.regex     "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
