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

name                hackrf
maintainers         {michaelld @michaelld} openmaintainer

description         ${name} is a project to build a low cost software radio (SDR) platform.

categories          science comms
license             GPL-3
platforms           darwin macosx

long_description    ${description}

subport hackrf-devel {}

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

    # release
    github.setup        mossmann hackrf 2018.01.1 v
    checksums           rmd160 97e9e7ca94f91ba898dd9a20a56aa3843688be64 \
                        sha256 e7ee6e09c1e0d2498cfdc974047cbe42177d3d6688a106be283d67d36051a155

    # bump the epoch because I moved the version from 20170219 to 2017.02.1
    epoch               1

} else {

    # devel
    github.setup        mossmann hackrf 370ee2dce5c5d26753ca7f725c2d1d5dbf832d1e
    version             20180228
    checksums           rmd160 00dff38a5725f0185331a4aeef8136ab8a713ba6 \
                        sha256 bb7f88d38b254a3a574ca2d7cdf774d80d59f00cb23c39c501f982df00ce1842 \
                        size   17055262

}

depends_build-append port:pkgconfig
depends_lib-append   path:lib/libusb-1.0.dylib:libusb \
                     port:fftw-3-single

# Many compilers do not recognize "-std=gnu90", so remove it.
# Temporary patch.

patchfiles-append   patch-no-gnu90.diff

# do VPATH (out of source tree) build

cmake.out_of_source yes

# set last configure argument to the reletive path
# to the top-level cmake source

configure.post_args ../${worksrcdir}/host

# remove top-level library path, such that internal libraries are used
# instead of any already-installed ones.

configure.ldflags-delete -L${prefix}/lib