# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github 1.0
PortGroup           gnuradio 1.0

name                gr-adapt
license             GPL-3
maintainers         {ra1nb0w @ra1nb0w} {michaelld @michaelld} openmaintainer
description         Adaptive filters for GNU Radio
long_description    {*}${description}

if {${subport} eq ${name}} {

    github.setup karel gr-adapt 13245e3fbf31c7f78a0805dfffadafa5952549fc
    # Change github.tarball_from to 'releases' or 'archive' next update
    github.tarball_from tarball
    version      20200630-[string range ${github.version} 0 7]
    checksums    rmd160  45f657dc4d5e05809fea9217b395b520a1098626 \
                 sha256  6a830ffb84a85572cdb392bbd70add9eb720c2487fc407bca9d40c72c36bdbaf \
                 size    463945
    revision     10
    git.branch   maint-3.8
    github.livecheck.branch maint-3.8

    conflicts gr37-adapt

}

subport gr37-adapt {

    name         gr37-adapt

    github.setup karel gr-adapt 4bbdde4ce52e88365ab8f51c05b7f08f90573275
    # Change github.tarball_from to 'releases' or 'archive' next update
    github.tarball_from tarball
    version      20191021-[string range ${github.version} 0 7]
    checksums    rmd160 86f39d385400bbe039d0ebbdf46adfe7ecd172f0 \
                 sha256 4d6efa41c6192d15a7880b99f4f058dc4b2dcf23aeaf0a863bb5d968b9a1f5d1 \
                 size   477236
    revision     7
    git.branch   maint-3.7
    github.livecheck.branch maint-3.7

    conflicts       gr-adapt

}

variant qr description "Enable QR decomposition on RLS filters" {
    depends_lib-append \
        port:lapack \
        port:armadillo \
        path:lib/libopenblas.dylib:OpenBLAS

    configure.env-append BLA_VENDOR=OpenBLAS
}

default_variants +qr

post-destroot {
    # copy GNU Radio examples
    xinstall -m 755 -d ${destroot}${prefix}/share/gnuradio/examples/adapt
    file copy {*}[glob ${worksrcpath}/examples/*] \
        ${destroot}${prefix}/share/gnuradio/examples/adapt
}

# disabled because show the plot and wait user response
#test.run yes
