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

name                libgsm
version             1.0.24
revision            1
license             public-domain

categories          audio
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer
description         library and tools to convert to/frm gsm audio format
long_description    {*}${description}

homepage            https://www.quut.com/gsm
distname            gsm-${version}
master_sites        ${homepage}
checksums           rmd160  b620bd0a536bdc9d6b880bcb9fe1d579d95a53aa \
                    sha256  a3c40c6471928383f4abfcb2e8f24012a1f562be2f17b8d672145d5986681a92 \
                    size    66597

worksrcdir          gsm-1.0-pl24

patchfiles-append   patch-makefile.diff

variant universal   {}

makefile.prefix_name        INSTALL_ROOT
makefile.override-append    PREFIX

build.args          VERSION=${version} \
                    GSM_INSTALL_INC=${prefix}/include \
                    GSM_INSTALL_MAN=${prefix}/share/man/man3 \
                    TOAST_INSTALL_MAN=${prefix}/share/man/man1

destroot.args       {*}${build.args}

post-destroot {
    # Rename tcat to gsm-tcat
    # https://trac.macports.org/ticket/67865
    move ${destroot}${prefix}/bin/tcat ${destroot}${prefix}/bin/gsm-tcat
}

# this is only a partial test of the software's adding algorithm
#test.run            yes
#test.target         addtst
#test.args           ${build.args}

# to test the encoding and decoding, see <https://ccrma.stanford.edu/~fujishim/199/gsm_survey.html>
# to convert samples to gsm for testing, see <https://convertio.co/wav-gsm/>

notes "
tcat has been installed as gsm-tcat
"

livecheck.type      regex
livecheck.url       ${master_sites}
livecheck.regex     gsm-(\\d+(?:\\.\\d+)*)${extract.suffix}
