# -*- 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        github 1.0
PortGroup        clang_dependency 1.0
PortGroup        legacysupport 1.1
PortGroup        muniversal 1.0

github.setup     libuv libuv 1.44.2 v
revision         0
checksums        rmd160  3802316d7f5dcfe3906ba371d4a738ab60d77339 \
                 sha256  8ff28f6ac0d6d2a31d2eeca36aff3d7806706c7d3f5971f5ee013ddb0bdd2e9e \
                 size    3594484

master_sites     https://dist.libuv.org/dist/v${version}
distfiles        ${name}-v${version}-dist${extract.suffix}

categories       devel
platforms        darwin
maintainers      {michaelld @michaelld} \
                 openmaintainer
license          {MIT BSD}

description      Cross-platform asychronous I/O

long_description libuv is a multi-platform support library with a \
                 focus on cross-platform asynchronous I/O.

homepage         https://libuv.org/

patchfiles       patch-libuv-legacy.diff \
                 patch-libuv-unix-core-close-nocancel.diff

# strnlen, lutimes
legacysupport.newest_darwin_requires_legacy 10

configure.args  --disable-silent-rules

platform darwin {
    if { ${os.major} == 8 } {
        # Tiger has no libutil
        patchfiles-append patch-no-libutil-on-Tiger.diff

        configure.cppflags-append -D__DARWIN_UNIX03
        # prevent conflicting opentransport header from being pulled in
        configure.cppflags-append -D__OPENTRANSPORTPROVIDERS__
    } elseif { ${os.major} == 9 || ${os.major} == 10 } {
        # needed for the tests to compile correctly on Leopard
        configure.cppflags-append -D__DARWIN_64_BIT_INO_T
    }
}

test.run        yes
test.target     check
