# -*- 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$

PortSystem          1.0

name                libzookeeper
version             3.4.6
categories          devel
maintainers         hum openmaintainer

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.

homepage            http://zookeeper.apache.org/
platforms           darwin
license             Apache-2

distname            zookeeper-${version}
dist_subdir         zookeeper
master_sites        apache:zookeeper/stable
checksums           rmd160  d9fadf07a40a85b8fd5a7e04e7200c74fd7393ce \
                    sha256  01b3938547cd620dc4c93efe07c0360411f4a66962a70500b163b59014046994

worksrcdir          ${distname}/src/c

depends_build       port:apache-ant

platform darwin {
    # ZooKeeperZOOKEEPER-2049: Yosemite build failure: htonll conflict
    # https://issues.apache.org/jira/browse/ZOOKEEPER-2049, modified for 3.4.6
    if {${os.major} >= 14} {
        patchfiles-append   patch-yosemite.diff 
        patch.pre_args      -p2
    }
}

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

variant universal   {}

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

post-destroot {
    file mkdir ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 -W ${worksrcpath} \
        ChangeLog LICENSE README \
        ${destroot}${prefix}/share/doc/${name}
}

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