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

github.setup        rakshasa libtorrent 0.16.8 v
revision            0
conflicts           libtorrent-devel
categories          net devel
maintainers         nomaintainer
license             {GPL-2+ OpenSSLException}
description         BitTorrent library
long_description    libTorrent is a BitTorrent library written in C++ \
                    for *nix. It is designed to avoid redundant copying and \
                    storing of data that other clients and libraries suffer from.

checksums           rmd160  33bcfee9e2a6786be88e2d8c9613fb89c2fd301f \
                    sha256  8dd691bde908a6d290f36282e0af8e8daa4d3fccc811d21a78bdb3684354a56e \
                    size    475438
github.tarball_from archive

use_autoreconf      yes

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

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

depends_lib-append  port:curl \
                    port:zlib

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

compiler.cxx_standard   2017

configure.args      --disable-debug

if {${os.platform} ne "linux"} {
    configure.args-append \
                    --with-kqueue \
                    --without-epoll
}

post-destroot {
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} AUTHORS COPYING README.md \
        ${destroot}${docdir}
}
