{% set version = "1.1.8" %}

package:
  name: snappy
  version: {{ version }}

source:
  url: https://github.com/google/snappy/archive/{{ version }}.tar.gz
  sha256: 16b677f07832a612b0836178db7f374e414f94657c138e6993cbfc5dcc58651f
  patches:
    # Have snappy-unittest not run the slow-ish microbenchmarks, but just
    # the quick correctness tests, without bothering with gflags (which didn't
    # work out of the box). This is the recommended method in the README.
    - skip-microbenchmarks.patch
    # Name the static library snappy_static.lib on windows, to distinguish from
    # the dynamic library, since they have the same suffix there.
    # https://github.com/google/snappy/pull/57
    - windows-static-lib-name.patch
    - disable_bmi.patch

build:
  number: 3
  run_exports:
    # SO name seems to be changing with patch versions
    # https://abi-laboratory.pro/?view=timeline&l=snappy
    # No: 1.1.5 was a bug and reverted in 1.1.6
    - {{ pin_subpackage('snappy', max_pin='x') }}

requirements:
  build:
    - cmake
    - make
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
  host:
    - msinttypes  # [win]

test:
  commands:
    - test -e $PREFIX/include/snappy.h               # [unix]
    - test -e $PREFIX/include/snappy-stubs-public.h  # [unix]
    - test -e $PREFIX/lib/libsnappy$SHLIB_EXT        # [unix]
    - if not exist %LIBRARY_INC%\snappy.h exit 1               # [win]
    - if not exist %LIBRARY_INC%\snappy-stubs-public.h exit 1  # [win]
    - if not exist %LIBRARY_LIB%\snappy.lib exit 1             # [win]
    - if not exist %LIBRARY_BIN%\snappy.dll exit 1             # [win]

about:
  home: https://github.com/google/snappy
  summary: A fast compressor/decompressor
  license: BSD-3-Clause
  license_file: COPYING
  license_family: BSD

extra:
  recipe-maintainers:
    - groutr
    - jakirkham
    - wesm
    - xhochy
    - djsutherland
