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

github.setup        sparsehash sparsehash 2.0.4 sparsehash-
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            0
categories          devel
maintainers         nomaintainer

description         An extremely memory-efficient hash_map implementation
long_description    {*}${description}. 2 bits/entry overhead! The SparseHash \
                    library contains several hash-map implementations, including \
                    implementations that optimize for space or speed.\
                    These hashtable implementations are similar in API to SGI's \
                    hash_map class, but with different performance \
                    characteristics. It's easy to replace hash_map by \
                    sparse_hash_map or dense_hash_map in C++ code.

license             BSD

checksums           rmd160  8156dead55d2cf8fc3af2cd0017d494397ee812f \
                    sha256  b2dfefe6f078db39762eda9eadabb64a897c12628897aa86ac00c95f0159a26e \
                    size    323188

patchfiles          patch-configure.ac.diff \
                    patch-Makefile.am.diff

post-patch {
    reinplace "s|@VERSION@|${version}|g" ${worksrcpath}/configure.ac
}

use_autoreconf      yes
autoreconf.cmd      ./autogen.sh
autoreconf.args
depends_build-append \
                    port:autoconf \
                    port:automake \
                    port:libtool

# This is a header-only library.
supported_archs     noarch
platforms           any

# Setting compiler.cxx_standard (to any value) is necessary so that MacPorts
# sets configure.cxx_stdlib, which the port needs in order to build for the
# right stdlib. I don't know what version of the C++ standard this port
# requires, so I'll just guess.
compiler.cxx_standard 1998

# https://github.com/macports/macports-ports/pull/15768
configure.args-append \
                    ac_cv_header_google_malloc_extension_h=no

test.run            yes
test.target         check
