{% set name = "libaec" %}
{% set version = "1.0.5" %}

package:
  name: {{ name|lower }}
  version: {{ version }}

source:
  url: https://gitlab.dkrz.de/k202009/{{ name }}/-/archive/v{{ version }}/{{ name }}-v{{ version }}.tar.gz
  sha256: 563e3f9c614a6c848340eb070f01b4a915e9ebc8a67199254bf37712b92e24d3
  # Windows doesn't support the restrict keyword
  #
  #      sed -i "s/restrict /__restrict /" src/*
  #      git diff -u > remove_restrict.diff
  patches:                   # [win]
    - windows_restrict_keyword.diff   # [win]

build:
  number: 0
  skip: true  # [win and vc<14]
  run_exports:
    - {{ pin_subpackage('libaec') }}

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

test:
  commands:
    - test -f ${PREFIX}/lib/libaec${SHLIB_EXT}        # [not win]
    - test -f ${PREFIX}/lib/libsz${SHLIB_EXT}         # [not win]
    - if not exist %LIBRARY_LIB%\\aec.lib exit 1      # [win]
    - if not exist %LIBRARY_BIN%\\aec.dll exit 1      # [win]
    - if not exist %LIBRARY_LIB%\\szip.lib exit 1     # [win]
    - if not exist %LIBRARY_BIN%\\szip.dll exit 1     # [win]
    - if not exist %LIBRARY_INC%\\libaec.h exit 1     # [win]

about:
  home: https://gitlab.dkrz.de/k202009/libaec
  license: BSD-2-Clause
  license_family: BSD
  license_file: LICENSE.txt
  summary: Adaptive Entropy Coding library
  description: |
    Libaec provides fast lossless compression of 1 up to 32 bit wide signed or unsigned integers (samples).
    The library achieves best results for low entropy data as often encountered in space imaging instrument
    data or numerical model output from weather or climate simulations. While floating point representations
    are not directly supported, they can also be efficiently coded by grouping exponents and mantissa.
    Libaec implements Golomb-Rice coding as defined in the Space Data System Standard documents 121.0-B-2
    and 120.0-G-2.
  dev_url: https://gitlab.dkrz.de/k202009/libaec

extra:
  recipe-maintainers:
    - kmuehlbauer
    - hmaarrfk
