# $Id: Portfile 49843 2009-04-19 04:08:25Z perry@macports.org $

PortSystem          1.0

name                elinks-devel
version             0.12pre3
revision            0
categories          www
maintainers         perry
platforms           darwin

description         Full-Featured Text WWW Browser
long_description    ELinks is an advanced and well established feature rich \
                    text mode web (HTTP/FTP/..) browser.
homepage            http://elinks.or.cz/

livecheck.check     regex
livecheck.regex     {unstable version is (.*),}
livecheck.url       ${homepage}

depends_lib \
    port:boehmgc port:bzip2 port:expat port:libiconv port:openssl port:see \
    port:zlib

distname            elinks-${version}
master_sites        ${homepage}download/

checksums           rmd160 5bcf4fb7d339d185466cc91f88a8b58816d35fa7

configure.args \
    --disable-256-colors --disable-88-colors --disable-debug \
    --disable-fastmem --disable-fsp --disable-no-root --disable-own-libc \
    --disable-sm-scripting --disable-small --disable-smb --disable-sysmouse \
    --disable-true-color --enable-backtrace --enable-bittorrent \
    --enable-bookmarks --enable-cgi --enable-cookies --enable-css \
    --enable-data --enable-exmode --enable-finger --enable-formhist \
    --enable-ftp --enable-globhist --enable-gopher --enable-html-highlight \
    --enable-ipv6 --enable-largefile --enable-leds --enable-mailcap \
    --enable-marks --enable-mimetypes --enable-mouse --enable-nls \
    --enable-nntp --enable-uri-rewrite --enable-utf-8 --enable-xbel \
    --with-bzlib --with-gc --with-libiconv --with-openssl --with-see \
    --with-zlib --without-gnutls --without-gpm --without-gssapi \
    --without-guile --without-idn --without-lua --without-lzma \
    --without-perl --without-python --without-ruby --without-spidermonkey \
    --without-x --without-xterm

# Note: This variant increases memory usage regardless of color mode.
variant colors description {Enable support for 88/256 colors and True color} {
    configure.args-append \
        --enable-256-colors --enable-88-colors --enable-true-color
    configure.args-delete \
        --disable-256-colors --disable-88-colors --disable-true-color
}

variant debug description {Enable debug mode} {
    configure.args-append --enable-debug
    configure.args-delete --disable-debug
}

variant fsp description {Enable support for FSP} {
    depends_lib-append port:fsplib

    configure.args-append --enable-fsp
    configure.args-delete --disable-fsp
}

variant gnutls description {Use GnuTLS in lieu of OpenSSL} {
    depends_lib-append port:gnutls
    depends_lib-delete port:openssl

    configure.args-append --with-gnutls --without-openssl
    configure.args-delete --with-openssl --without-gnutls
}

variant guile description {Enable support for Guile} {
    depends_lib-append port:guile

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

variant idn description {Enable support for internationalized domain names} {
    depends_lib-append port:libidn

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

variant lua description {Enable support for Lua} {
    depends_lib-append port:lua50

    configure.args-append --with-lua=${prefix}
    configure.args-delete --without-lua
}

variant perl description {Enable support for Perl} {
    depends_lib-append path:bin/perl:perl5

    patchfiles patch-hooks.h.diff

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

variant python description {Enable support for Python} {
    depends_lib-append port:python26

    configure.args-append --with-python
    configure.args-delete --without-python
    configure.python      ${prefix}/bin/python2.6
}

variant ruby description {Enable support for Ruby} {
    depends_lib-append port:ruby

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

variant samba description {Enable support for Samba} {
    depends_lib-append port:samba3

    configure.args-append    --enable-smb
    configure.args-delete    --disable-smb
    configure.ldflags-append "-L${prefix}/lib/samba3"
}

variant x11 description {Enable support for X11} {
    depends_lib-append port:xorg-libX11

    pre-configure {
        reinplace "s|x_includes=NONE|x_includes=${prefix}/include/X11|g" \
                  ${worksrcpath}/configure
        reinplace "s|x_libraries=NONE|x_libraries=${prefix}/lib|g" \
                  ${worksrcpath}/configure
    }

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