# -*- 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
# $Id: Portfile 99445 2012-11-05 13:59:30Z ryandesign@macports.org $

PortSystem          1.0
PortGroup           github 1.0

github.setup        italiangrid voms 2_0_9
version             [strsed ${github.version} {g/_/./}]
revision            1
categories          security
platforms           darwin
maintainers         nikhef.nl:okoeroo
license             Apache-2

description         create a proxy with VOMS extensions

long_description    The voms-proxy-init generates a proxy with the VOMS information included in a non-critical extension.

checksums           voms-2_0_9.tar.gz \
                    rmd160  5d6f8ba7aba00173cb22149d7b867ec4684e7435 \
                    sha256  aab51fab8ad4a89fb8dc68dcfc4e44a9eab0542bf437ec3bc330628830ba8633

patchfiles          ${name}-obsolete-configure-macro.patch \
                    ${name}-ipv6sock-posix.patch \
                    ${name}-empty-replib.patch

patch.pre_args      -p1

depends_build       port:autoconf \
                    port:automake \
                    port:libtool

depends_lib         port:expat \
                    port:openssl

pre-configure {
    system -W ${worksrcpath} "./autogen.sh"
}

configure.args      --with-expat-prefix=${prefix} \
                    --with-openssl-prefix=${prefix}

# Fix build conflict with mongodb's ${prefix}/include/server.h
configure.cppflags-delete -I${prefix}/include
configure.cppflags-append -isystem${prefix}/include

pre-test {
    if {![file exists ${prefix}/bin/runtest]} {
        ui_error "To test ${name}, you must first install the dejagnu port."
        return -code error "dejagnu is not installed"
    }
}

test.run            yes
test.target         check

# https://github.com/italiangrid/voms/issues/2
#if {${os.platform} == "darwin" && ${os.major} < 10} {
#    pre-fetch {
#        ui_error "${name} ${version} requires OS X 10.6 or greater."
#        return -code error "incompatible OS X version"
#    }
#}
