# -*- 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           makefile 1.0

name                wdsp
categories          science comms
platforms           darwin macosx
license             GPL-2
maintainers         {ra1nb0w @ra1nb0w} openmaintainer
description         WDSP is a full-featured signal processing library for Software Defined Radio
long_description    {*}${description}
homepage            https://github.com/TAPR/OpenHPSDR-wdsp

github.setup        dl1ycf wdsp 4c273de2980835f32176704bb1893bd6fafad2f8
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
version             20230508-[string range ${github.version} 0 7]
checksums           rmd160  36b15e553e2d9572bde8978d19f28f5cd6217b65 \
                    sha256  84d86d5fe31a369b308eb6147fe8996ce7aecbc7db8609544c90a4f63b1e1f9e \
                    size    4987350
revision            0

depends_build-append \
    path:bin/pkg-config:pkgconfig

depends_lib-append \
    port:fftw-3

# comm.h: error: redefinition of typedef ‘complex’
compiler.blacklist-append \
                    *gcc-4.0 *gcc-4.2

use_configure       no
# remove useless includes
build.env-append    INCLUDES=

post-patch {
    reinplace "s|/usr/local|${prefix}|g" ${worksrcpath}/Makefile
}

destroot {
    xinstall -m 644 ${worksrcpath}/wdsp.h ${destroot}${prefix}/include
    xinstall -m 755 ${worksrcpath}/libwdsp.dylib ${destroot}${prefix}/lib
    system "install_name_tool -id ${prefix}/lib/libwdsp.dylib ${destroot}${prefix}/lib/libwdsp.dylib"
}
