# -*- 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           active_variants 1.1
PortGroup           github 1.0

github.setup        rakshasa rtorrent c62fa6a75649efe8cedb91c66d1b05b2b1be8872
version             20181027
revision            1

name                rtorrent-devel
conflicts           rtorrent
set real_name       rtorrent

categories          net
platforms           darwin
maintainers         nomaintainer
license             {GPL-2+ OpenSSLException}

description         console-based BitTorrent client (unstable release)

long_description    rTorrent is a console-based BitTorrent client. It aims to \
                    be a fully-featured and efficient client with the ability to \
                    run in the background using screen. It supports fast-resume \
                    and session management. \
                    This is the "unstable" release of rTorrent.

checksums           rmd160  f01865e7060a062e0fe39bfb7dfaa362c0ccaabb \
                    sha256  6021a28ac91935ba0b15ff78ca44d70bdcab8c368d62829062610f1bf7baa478 \
                    size    249150

use_autoreconf      yes
autoreconf.cmd      ./autogen.sh

depends_build-append \
                    port:pkgconfig \
                    port:autoconf \
                    port:automake \
                    port:libtool

# malformed object (unknown load command 2)
if {${os.platform} eq "darwin" && ${os.major} <= 10} {
    depends_build-append port:cctools
}

depends_lib         port:curl \
                    port:libsigcxx2 \
                    port:libtorrent-devel \
                    port:ncurses \
                    path:lib/libssl.dylib:openssl \
                    port:zlib

# https://github.com/rakshasa/rtorrent/wiki/Installing#non-blocking-hostname-lookup-in-curl
require_active_variants curl ares

compiler.cxx_standard   2011

configure.args      --mandir=${prefix}/share/man \
                    --disable-debug \
                    --enable-ipv6

variant xmlrpc description {Enable XMLRPC interface} {
    configure.args-append   --with-xmlrpc-c
    depends_lib-append      port:xmlrpc-c
}

if {${os.platform} eq "darwin" && ${os.major} <= 9} {
    # currently broken, ticket #27289
    known_fail  yes
    pre-fetch {
        return -code error "$name currently cannot be compiled on Mac OS X 10.5 or earlier."
    }
    # clear deps so users don't waste time installing them for a broken port
    depends_lib
    depends_build
}