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

github.setup                PromyLOPh pianobar 2024.12.21
checksums                   rmd160  85932329f4baf8cf061dd0419623994d036efad9 \
                            sha256  e988dff4a4b7cc6a19e944b7516f697d7e6c41d6dc0ff25a708bcb6b92d72a89 \
                            size    61715

categories                  audio
maintainers                 {ryandesign @ryandesign} openmaintainer
license                     MIT

description                 Console-based pandora.com player

long_description            pianobar is a console client for the \
                            personalized web radio pandora \
                            (http://www.pandora.com).\
                            Play and manage stations, rate songs and \
                            see why they were selected, show upcoming \
                            configure keybindings, last.fm scrobbling, \
                            proxy support for listening outside of USA.

github.tarball_from         archive

set ffmpeg_version          7

depends_build               path:bin/pkg-config:pkgconfig

depends_lib                 port:curl \
                            port:ffmpeg${ffmpeg_version} \
                            port:libao \
                            port:libgcrypt \
                            port:json-c

compiler.c_standard         1999
configure.cflags-append     -std=c99

# Prevent upgrade failure.
configure.cppflags-replace  -I${prefix}/include -isystem${prefix}/include

# Prevent opportunistic linking against ffmpeg and consequent undefined symbols.
configure.ldflags-delete    -L${prefix}/lib

configure.pkg_config_path-prepend \
                            ${prefix}/libexec/ffmpeg${ffmpeg_version}/lib/pkgconfig

use_configure               no

variant universal {}

build.args                  CC="${configure.cc} [get_canonical_archflags cc]" \
                            DYNLINK=1 \
                            PREFIX=${prefix} \
                            CFLAGS="${configure.cflags} ${configure.cppflags}" \
                            LDFLAGS="${configure.ldflags}" \
                            V=1

build.env                   "PKG_CONFIG_PATH=[join ${configure.pkg_config_path} :]"
destroot.env                {*}${build.env}

destroot.args               PREFIX=${prefix}

if {${subport} eq ${name}} {
    revision                0
    depends_lib-append      port:libpiano
} else {
    livecheck.type          none
}

subport libpiano {
    revision                0
    depends_lib-append      path:lib/pkgconfig/gnutls.pc:gnutls
    build.target            libpiano.so.0
    destroot.target         install-libpiano
    platform darwin {
        build.target        libpiano.0.dylib
    }
}

platform darwin {
    patchfiles-append       patch-Makefile.diff
}