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

name                airspy

github.setup        airspy airspyone_host 41c439f16818d931c4d0f8a620413ea5131c0bd6
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
version             20210912-[string range ${github.version} 0 7]
checksums           rmd160  7f69ca2d8aa1a6d6123188632e2b200f2a53b5a0 \
                    sha256  bf66cc8ecf19c4cec5265385ef237acd54ed79d89eeea8396527c1e5ad1635aa \
                    size    238652
revision            0

homepage            http://www.airspy.com/

categories          science comms
maintainers         {michaelld @michaelld} openmaintainer
description         Host software for AirSpy, a project to produce a low cost, open source software radio platform (SDR).
long_description    {*}${description}
license             MIT

depends_build-append port:pkgconfig
depends_lib-append	path:lib/pkgconfig/libusb-1.0.pc:libusb

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

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

# fix the lib version string to be MacPorts-specific

post-patch {

    reinplace "s@%d.%d.%d@%d.%d.%d MacPorts ${version}@" ${worksrcpath}/airspy-tools/src/airspy_lib_version.c

}

# airspy cmake doesn't understand build type "MacPorts";
# use release unless +debug is set

if {[variant_isset debug]} {
    cmake.build_type Debug
} else {
    cmake.build_type Release
}
