# -*- 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 91345 2012-03-30 14:20:38Z hum@macports.org $

PortSystem          1.0

name                libzookeeper
version             3.3.5
maintainers         brett hum openmaintainer
categories          devel
platforms           darwin
license             Apache-2.0

homepage            http://zookeeper.apache.org/
description         C bindings for ZooKeeper, the high-performance coordination service
long_description    ZooKeeper is a distributed, open-source coordination service for \
                    distributed applications. It exposes a simple set of primitives \
                    that distributed applications can build upon to implement higher \
                    level services for synchronization, configuration maintenance, \
                    and groups and naming. It is designed to be easy to program to, \
                    and uses a data model styled after the familiar directory tree \
                    structure of file systems. This port contains the C bindings for \
                    interacting with it.

distname            zookeeper-${version}
dist_subdir         zookeeper
master_sites        apache:zookeeper/stable
checksums           rmd160  bfd028deb55f075f286eed3dbb6a215f83e0f083 \
                    sha256  b78b92edf489fca7587ec6ddfcd95714449d55b1288a67a7369844fa61124f0a

worksrcdir          ${distname}/src/c

variant universal   {}

use_configure       yes
configure.args      --mandir=${prefix}/share/man

pre-configure {
    system -W "${worksrcpath}/../.." "ant compile_jute"
}

post-configure {
    reinplace "s|-Werror||"               ${worksrcpath}/Makefile
    reinplace "s|c-client-src|zookeeper|" ${worksrcpath}/Makefile
}

if {${configure.compiler} == "clang"} {
    configure.cflags-append "--std=gnu89"
}

build.args          CFLAGS="${configure.cflags} [get_canonical_archflags]"

livecheck.type      regex
livecheck.url       http://www.apache.org/dist/zookeeper/stable/
livecheck.regex     zookeeper-(\[0-9.\]+)\\.tar
