{% set version = "6.9.7.1" %}

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: 6444204b9c34e6eb6c0b23021ce89a0370dad2b2f5c00cd44c342753e0b204d9

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
