# -*- 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           github 1.0
PortGroup           gnuradio 1.0

name                gr-gsm
maintainers         {michaelld @michaelld} openmaintainer
description         Provides augmented functionality for GNU Radio: a set of tools for receiving information transmitted by GSM equipment/devices.
long_description    {*}${description}
license             GPL-3

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

    github.setup    ptrkrysik gr-gsm fd4454d6ec6e2e65db60519892e77dece299a6c7
    # Change github.tarball_from to 'releases' or 'archive' next update
    github.tarball_from tarball
    version         20200214-[string range ${github.version} 0 7]
    checksums       rmd160  b0c22e3f4e1d16b364e63696bc5fa774b085b8cf \
                    sha256  8ecffa8a6f7733ac7e4e3744592534478425ce89811e4483cf687cb7ad31ad4a \
                    size    417371
    revision        5

    github.livecheck.branch porting_to_gr38

    # fix using GRCC, which will load the just-built swig .so and hence
    # the just-built gr-gsm library
    patchfiles-append \
        patch-fix-local-library-load_38.diff

    conflicts gr37-gsm

}

subport gr37-gsm {

    name            gr37-gsm

    github.setup    ptrkrysik gr-gsm 592ec9b7859f544b297e9352323b45ceb450a68a
    # Change github.tarball_from to 'releases' or 'archive' next update
    github.tarball_from tarball
    version         20180812
    checksums       rmd160 76289afc52c484bdb1a4a60a18b6cb85f2a4ba3d \
                    sha256 d628af9a27130a89458efd9f91056457e97f01a66ee5809455f0c95607033d41 \
                    size   413183
    revision        3

    # fix name of rst2man
    patchfiles-append patch-docs_CMakeLists.txt.diff
    patch.pre_args-replace  -p0 -p1

    # fix allowing for CMAKE_MODULES_DIR
    patchfiles-append patch-CMakeLists.txt.diff

    # add Boost::thread linkage
    patchfiles-append patch-add-boost-thread.diff

    # temporary patch to #include <grgsm/endian.h> where requred
    patchfiles-append patch-add_endian.h.diff

    # fix using GRCC, which will load the just-built swig .so and hence
    # the just-built gr-gsm library
    patchfiles-append patch-fix-local-library-load.diff

    conflicts       gr-gsm

}

depends_build-append \
    port:py${active_python_version_no_dot}-docutils

depends_lib-append \
    path:lib/libosmocore.dylib:osmocore

configure.args-append \
    -DRST2MAN_EXECUTABLE=${python_framework_dir}/bin/rst2man
