# -*- 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           active_variants 1.1
PortGroup           github 1.0
PortGroup           qt5 1.0
PortGroup           conflicts_build 1.0
PortGroup           gnuradio 1.0

name                gr-fosphor
homepage            http://sdr.osmocom.org/trac/wiki/fosphor
license             GPL-3
maintainers         {michaelld @michaelld} {ra1nb0w @ra1nb0w} openmaintainer
description         gr-fosphor provides a GNU Radio block for RTSA-like spectrum visualization using GPU acceleration.
long_description    {*}${description} \
    This port is kept up with the gr-fosphor GIT 'master' branch, which is \
    typically updated weekly to monthly.

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

    github.setup    osmocom gr-fosphor defdd4aca6cd157ccc3b10ea16b5b4f552f34b96
    # Change github.tarball_from to 'releases' or 'archive' next update
    github.tarball_from tarball
    version         20200130-[string range ${github.version} 0 7]
    checksums       rmd160  95ea3fad5f31bdf0203b21da2db9cc44e598227a \
                    sha256  0a12468c4618aff3a6ab4a3dde03fc4220db70a8c5b4198674e5e35497f8ea28 \
                    size    244575
    revision        3

    conflicts gr37-fosphor

    conflicts_build gr-fosphor

}

subport gr37-fosphor {

    name            gr37-fosphor

    github.setup    osmocom gr-fosphor fa6761afbf8c2658782e0c7fc5d51063679b7ae4
    # Change github.tarball_from to 'releases' or 'archive' next update
    github.tarball_from tarball
    version         20191202-[string range ${github.version} 0 7]
    checksums       rmd160  a05bcc9ef655a1eef8dcd8e23938885e929d8855 \
                    sha256  e760c46ba2bee24b7488940b107d776192296b39d78040a76cec0e393e63a2d2 \
                    size    253973
    revision        1
    git.branch      gr3.7-qt5
    github.livecheck.branch gr3.7-qt5

    conflicts       gr-fosphor

}

depends_lib-append \
    port:freetype \
    port:log4cpp

# DISABLED temporary patch to fix using gr_log
#patchfiles-append patch-add_gr_log.diff

# disable the GLFW fosphor interface; see also
# https://trac.macports.org/ticket/54614
configure.args-append \
    -DENABLE_GLFW=OFF

if {${subport} eq "gr37-fosphor"} {

    variant wx description "Install Fosphor for wx" {}

    if {[variant_isset wx]} {

        PortGroup           wxWidgets 1.0
        wxWidgets.use       wxPython-3.0

        depends_lib-append \
            port:${wxWidgets.port} \
            port:py${active_python_version_no_dot}-wxpython-3.0

        configure.args-append -DENABLE_WX=ON

    } else {

        configure.args-append -DENABLE_WX=OFF

    }
}
