# -*- 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           cmake 1.1

# don't forget to update py-pygit2 and libgit2-glib as well
github.setup        libgit2 libgit2 0.26.3 v
epoch               1
categories          devel
platforms           darwin
maintainers         {devans @dbevans}
license             {GPL-2 Permissive}

description         A portable, pure C implementation of the Git core methods

long_description    libgit2 is a portable, pure C implementation of the \
                    Git core methods provided as a re-entrant linkable \
                    library with a solid API, allowing you to write native \
                    speed custom Git applications in any language which \
                    supports C bindings.

homepage            http://libgit2.github.com/

checksums           rmd160  39ea46693e33c805b2f5de21fc1f6cde1884d998 \
                    sha256  60440169295a6a719164d53b999004e9d90629ff50dffe40fb9e4c4f0717068e \
                    size    4730780

depends_build-append \
                    port:pkgconfig

depends_lib         port:curl \
                    port:libiconv \
                    port:libssh2 \
                    path:lib/libssl.dylib:openssl \
                    port:zlib

patchfiles          patch-strnlen-posix.h.diff

configure.args-append \
                    -DTHREADSAFE:BOOL=OFF \
                    -DUSE_ICONV:BOOL=ON

variant threadsafe description {Build with threadsafe option} {
    configure.args-replace \
                    -DTHREADSAFE:BOOL=OFF -DTHREADSAFE:BOOL=ON
}

default_variants    +threadsafe

livecheck.regex     "archive/v(\\d+(?:\\.\\d+)*)${extract.suffix}"