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

name                openfst
version             1.7.2
categories          devel
maintainers         nomaintainer

description         C++ finite-state transducers library

long_description    OpenFst is a library for constructing, combining, \
                    optimizing, and searching weighted finite-state \
                    transducers (FSTs).

homepage            http://www.openfst.org/
platforms           darwin
license             Apache-2

master_sites        ${homepage}twiki/pub/FST/FstDownload/

checksums           rmd160  bc5a3ccc1aaa97837d3e5753d88ee11707b487a8 \
                    sha256  21c3758ff8574dedaf22b0a6b88c2829bbf3b2e59fbf04740ce2cf92029a0f3b \
                    size    1269292

if {${os.platform} eq "darwin" && ${os.major} < 12} {
    version         1.3.4
    checksums       rmd160  5f9c9c059150dd5afb894ea1edc7dd4d7d22a166 \
                    sha256  e95fa96674e1c9d6866bbf79b9cd755c5121ad165b76224c7c6bbfa139399a61
    patchfiles      patch-c++11.diff patch-src-include-fst-config.h.in.diff
    # OpenFst doesn't like Xcode's compiler before Snow Leopard.
    # See http:/www.openfst.org/twiki/bin/view/FST/CompilingOnMacOSX
    # TODO: Change this to compiler.blacklist
    if {${os.major} < 10} {
        variant gcc43 conflicts gcc44 gcc45 description {Compile with gcc 4.3} {
            configure.compiler macports-gcc-4.3
        }
        
        variant gcc44 conflicts gcc43 gcc45 description {Compile with gcc 4.4} {
            configure.compiler macports-gcc-4.4
        }
        
        variant gcc45 conflicts gcc43 gcc44 description {Compile with gcc 4.5} {
            configure.compiler macports-gcc-4.5
        }
        
        if {![variant_isset gcc43] && ![variant_isset gcc44] && ![variant_isset gcc45]} {
            default_variants +gcc45
        }
    }
}

post-destroot {
    set dest_doc ${destroot}${prefix}/share/doc/${name}
    xinstall -d ${dest_doc}
    xinstall -m 644 -W ${worksrcpath} \
        AUTHORS \
        COPYING \
        NEWS \
        README \
        ${dest_doc}
}

livecheck.type      regex
livecheck.url       ${homepage}twiki/bin/view/FST/FstDownload
livecheck.regex     ${name}-(\[0-9.\]+)\\.
