{% set version = "6.9.8" %}

package:
  name: oniguruma
  version: {{ version }}

source:
  fn: onig-{{ version }}.tar.gz
  url: https://github.com/kkos/oniguruma/releases/download/v{{ version }}/onig-{{ version }}.tar.gz
  sha256: 28cd62c1464623c7910565fb1ccaaa0104b2fe8b12bcd646e81f73b47535213e

build:
  number: 0
  run_exports:
    # https://abi-laboratory.pro/index.php?view=timeline&l=oniguruma 
    - {{ pin_subpackage('oniguruma', max_pin='x.x') }}


requirements:
  build:
    - gnuconfig  # [unix]
    - {{ compiler("c") }}
    - cmake                # [win]
    - make
  host:
    - msinttypes           # [win]

test:
  commands:
    # Check for headers.
    {% set headers = [
             "oniggnu",
             "onigposix",
             "oniguruma"
    ] %}
    {% for each_header in headers %}
    - test -f "${PREFIX}/include/{{ each_header }}.h"          # [unix]
    - if not exist "%LIBRARY_INC%\{{ each_header }}.h" exit 1  # [win]
    {% endfor %}

    # Check for libraries.
    - test -f "${PREFIX}/lib/libonig.a"                # [unix]
    - test -f "${PREFIX}/lib/libonig.so"               # [linux]
    - test -f "${PREFIX}/lib/libonig.dylib"            # [osx]
    - if not exist "%LIBRARY_BIN%\onig.dll" exit 1     # [win]
    - if not exist "%LIBRARY_LIB%\onig.lib" exit 1     # [win]

    # Check for pkg-config file.
    - test -f "${PREFIX}/lib/pkgconfig/oniguruma.pc"   # [unix]

    # Check for config executable.
    - onig-config --version                            # [unix]

about:
  home: https://github.com/kkos/oniguruma
  license: BSD-2-Clause
  license_file: COPYING
  summary: A regular expression library.

extra:
  recipe-maintainers:
    - jakirkham
    - kkos
