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

# sincos
legacysupport.newest_darwin_requires_legacy 12

name                zvbi
version             0.2.35
revision            6
categories          multimedia
maintainers         nomaintainer
license             GPL-2+

description         A library to capture and decode vertical blanking interval data

long_description    \
        The Zapping VBI library, in short ZVBI, provides functions to capture \
        and decode VBI data. The vertical blanking interval (VBI) \
        is an interval in a television signal that temporarily suspends \
        transmission of the signal before next screen field begins. The VBI \
        can be used to carry data, since anything sent during the VBI would \
        naturally not be displayed. This includes Closed Captions, Teletext, \
        VPS, WSS, and XDS.

homepage            https://zapping.sourceforge.net/ZVBI
master_sites        sourceforge:project/zapping/${name}/${version}
use_bzip2           yes

checksums           rmd160  36749d9f11994e0ff726ac3e9d11c790c7494455 \
                    sha256  fc883c34111a487c4a783f91b1b2bb5610d8d8e58dcba80c7ab31e67e4765318 \
                    size    1047761

patchfiles-append   patch-i386.diff

# This patch breaks the build with Xcode gcc.
# https://trac.macports.org/ticket/68520
if {![string match *gcc-4.* ${configure.compiler}]} {
    patchfiles-append \
                    endian.patch
}

# We are patching configure.in.
use_autoreconf      yes
autoreconf.args     -fvi

depends_build-append \
                    port:gettext

depends_lib-append \
                    port:gettext-runtime \
                    port:libiconv \
                    port:libpng

configure.args      --without-x

# See: https://trac.macports.org/ticket/64212
# Also: https://trac.macports.org/ticket/70160
configure.args-append \
                    --disable-rpath

variant x11 {
    depends_build-append \
                    port:xorg-xorgproto

    depends_lib-append \
                    port:xorg-libice \
                    port:xorg-libX11

    configure.args-replace \
                    --without-x --with-x
    configure.args-append \
                    --x-includes=${prefix}/include \
                    --x-libraries=${prefix}/lib
}

livecheck.url       http://sourceforge.net/projects/zapping/files/${name}
livecheck.type      regex
livecheck.regex     ${name}-(\[0-9.\]+)[quotemeta ${extract.suffix}]
