# -*- 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
PortGroup           openssl 1.0

# clock_gettime()
legacysupport.newest_darwin_requires_legacy 15

name                snownews
version             1.11
revision            1
homepage            https://sourceforge.net/projects/${name}/
master_sites        sourceforge:${name}
categories          net www
license             GPL-3
maintainers         nomaintainer

description         Text mode RSS newsreader
long_description    Snownews is a text mode RSS/RDF newsreader. It supports all versions \
                    of RSS natively and supports other formats via plugins.

checksums           rmd160  e9fd727aa4fca5bb83def07a5ac19ff1d70acd7c \
                    sha256  afd4db7c770f461a49e78bc36e97711f3066097b485319227e313ba253902467 \
                    size    144174

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

depends_lib-append  port:curl \
                    port:gettext-runtime \
                    port:libiconv \
                    port:libxml2 \
                    port:ncurses \
                    port:zlib

if {${os.platform} eq "darwin" && ${os.major} < 16} {
    patchfiles-append \
                    patch-legacy.diff
}

post-patch {
    reinplace "s|/usr/include/libxml2|${prefix}/include/libxml2|" ${worksrcpath}/configure
    reinplace "s|_DEFAULT_SOURCE|_DARWIN_C_SOURCE|" ${worksrcpath}/configure
}

compiler.c_standard 2011
# Work around MacPorts base C11 compiler selection bug.
# https://github.com/macports/macports-base/pull/196
compiler.blacklist-append {clang < 500}

build.args          CC=${configure.cc} \
                    PREFIX=${prefix}

# create additional destroot directories
pre-destroot {
    foreach lang {de fr it nl ru.KOI8-R} {
        xinstall -d -m 0755 ${destroot}${prefix}/share/man/${lang}/man1
    }
    foreach locale {be@latin de es fr it ja ko nl pl pt_BR ru se sl uk_UA zh_CN zh_TW} {
        xinstall -d -m 0755 ${destroot}${prefix}/share/locale/${locale}/LC_MESSAGES
    }
}

destroot.args       PREFIX=${destroot}${prefix}
