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

name                rtmpdump
git.branch          f1b83c10d8beb43fcc70a6e88cf4325499f25857
set git_shortcommit [string range ${git.branch} 0 6]
set git_date        20210219
version             2.4-${git_date}
revision            1
checksums           rmd160  71267f8eac903eb78bfa13f99189f343b5bdce38 \
                    sha256  c68e05989a93c002e3ba8df3baef0021c17099aa2123a9c096a5cc8e029caf95 \
                    size    143043

categories          www net
maintainers         nomaintainer
license             GPL-2+

description         a tool for downloading RTMP streaming media

long_description    A small dumper for media content streamed over \
                    the RTMP protocol. Supplying an rtmp url will result \
                    in a dumped flv file, which can be played or transcoded \
                    using ffmpeg/mplayer, etc.

homepage            https://rtmpdump.mplayerhq.hu/
master_sites        https://git.ffmpeg.org/gitweb/rtmpdump.git/snapshot/
distname            ${git.branch}

depends_lib         path:lib/pkgconfig/gnutls.pc:gnutls

worksrcdir          ${name}-${git_shortcommit}

patchfiles          patch-Makefile.diff \
                    patch-librtmp-librtmp.pc.in.diff \
                    patch-librtmp-Makefile.diff

# The Makefile never adds this flag to specify to look in local directories
# for include files. Seems like a good things to add.
configure.cppflags-prepend \
                    -I.

# The Makefile provides no way to specify the library path for the dependencies
# that doesn't put the flag in the wrong place so remove it from LDFLAGS here
# and patch it into the Makefile in the right place.
configure.ldflags-delete \
                    -L${prefix}/lib

makefile.override-append \
                    PREFIX
makefile.prefix_name \
                    prefix

variant universal {}

build.args-append   OPT="${configure.optflags}" \
                    XCFLAGS="${configure.cflags} [get_canonical_archflags cc]" \
                    XLDFLAGS="${configure.ldflags} [get_canonical_archflags ld]"

pre-destroot {
    destroot.args   {*}${build.args}
}

post-destroot {
    xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}
    xinstall -m 0644 -W ${worksrcpath} COPYING README ChangeLog ${destroot}${prefix}/share/doc/${name}
}

platform darwin {
    build.args-append SYS=darwin
}

livecheck.type      none
