PortSystem          1.0
PortGroup           muniversal 1.0

name                elinks
conflicts           elinks-devel
epoch               1
version             0.11.7
revision            7
categories          www
platforms           darwin
license             GPL-2
maintainers         nomaintainer
description         text mode web browser
long_description    ELinks is an advanced and well-established feature-rich \
                    text mode web (HTTP/FTP/..) browser.  ELinks can render \
                    both frames and tables, is highly customizable and can \
                    be extended via Lua or Guile scripts.

homepage            http://elinks.or.cz/
master_sites        ${homepage}download/
use_bzip2           yes
checksums           rmd160  2e6e863d08f9accb71892ba6f236f795c83cba9c \
                    sha256  456db6f704c591b1298b0cd80105f459ff8a1fc07a0ec1156a36c4da6f898979 \
                    size    2467915

depends_lib         path:lib/libssl.dylib:openssl \
                    port:bzip2 \
                    port:expat \
                    port:libidn \
                    port:spidermonkey

configure.args      --mandir=${prefix}/share/man \
                    --disable-nls \
                    --without-guile \
                    --without-lua \
                    --without-gnutls \
                    --with-idn \
                    --with-openssl=${prefix} \
                    --with-spidermonkey=${prefix} \
                    --without-zlib
# zlib support is broken in 0.11, ticket #24143

# Backported upstream patches for OpenSSL 1.1 compatibility
# https://repo.or.cz/elinks.git/patch/f4a58ba3b574a478fd5954ba2c5b29e8b809ff9b
# https://repo.or.cz/elinks.git/patch/54ebe365b752f8969a67279d0d29552ab638e025
patchfiles          patch-openssl11.diff \
                    patch-no-rand-egd.diff

variant col256 description {Use 256 colours if supported by the terminal} {
    post-extract {
        reinplace "s|CONFIG_256_COLORS=no|CONFIG_256_COLORS=yes|" \
            ${worksrcpath}/features.conf
    }
}

variant lua description {Build with Lua support} {
    depends_lib-append      port:lua50

    configure.args-delete   --without-lua
    configure.args-append   --with-lua
}

variant perl description {Build with Perl support} {
    depends_lib-append      path:bin/perl:perl5

    patchfiles-append       patch-perl.diff

    configure.args-append   --with-perl
}

use_parallel_build no

livecheck.url	${master_sites}
livecheck.type	regex
livecheck.regex "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
