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

github.setup        google snappy 1.2.2
github.tarball_from archive
revision            1
categories          archivers
maintainers         nomaintainer
license             BSD

description         A fast compressor/decompressor

long_description    Snappy is a compression/decompression library. It does \
                    not aim for maximum compression, or compatibility with \
                    any other compression library. Instead it aims for very \
                    high speeds and reasonable compression. For instance, \
                    compared to the fastest mode of zlib, Snappy is an order \
                    of magnitude faster for most inputs, but the resulting \
                    compressed files are anywhere from 20% to 100% bigger. \
                    On a single core of a Core i7 processor in 64-bit mode, \
                    Snappy compresses at about 250 MB/sec or more and \
                    decompresses at about 500 MB/sec or more.

homepage            https://google.github.io/snappy/

checksums           rmd160  7de2e00c73a554c54926986a3e6f4dbb3c17ce46 \
                    sha256  90f74bc1fbf78a6c56b3c4a082a05103b3a56bb17bca1a27e052ea11723292dc \
                    size    1108618

# Disable Xcode clang < 1200, due to the following:
#   error: invalid output constraint '=@ccz' in asm
compiler.blacklist-append {clang < 1200}

# https://github.com/facebook/folly/issues/1583
# https://github.com/Homebrew/homebrew-core/pull/76686#issuecomment-847527483
patchfiles-append   patch-no-disable-rtti.diff

# CMake Error in CMakeLists.txt:
#  Target "snappy" requires the language dialect "CXX11" , but CMake does not
#  know the compile flags to use to enable it.
compiler.cxx_standard 2011

depends_build-append \
                    port:pkgconfig

depends_lib-append  port:lzo2 \
                    port:zlib \
                    port:lz4

configure.args-append \
                    -DBUILD_SHARED_LIBS=ON \
                    -DSNAPPY_BUILD_TESTS=OFF \
                    -DSNAPPY_BUILD_BENCHMARKS=OFF
