{% set name = "harfbuzz" %}
{% set version = "2.8.2" %}
{% set sha256 = "4164f68103e7b52757a732227cfa2a16cfa9984da513843bb4eb7669adc6f220" %}

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

source:
  url: https://github.com/harfbuzz/harfbuzz/archive/{{ version }}.tar.gz
  sha256: {{ sha256 }}
  patches:
    - gir-windows.patch  # [win]

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

requirements:
  build:
    - gobject-introspection
    - meson
    - ninja
    - pkg-config
    - pthread-stubs
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
  host:
    - cairo
    - glib
    - freetype
    - icu
    - graphite2
  run:
    - cairo
    - freetype
    - icu
    - graphite2

test:
  requires:
    - pygobject
  commands:
    # Libraries/headers.
    {% set libs = [
        "harfbuzz-gobject",
        "harfbuzz-icu",
        "harfbuzz"
        ] %}
    {% for lib in libs %}
    - test -f $PREFIX/lib/lib{{ lib }}${SHLIB_EXT}    # [unix]
    - if not exist %PREFIX%\Library\bin\{{ lib }}.dll exit 1       # [win]
    {% endfor %}
    - test -f $PREFIX/include/harfbuzz/hb-ft.h    # [not win]
    - if not exist %PREFIX%\Library\include\harfbuzz\hb-ft.h exit 1         # [win]
    - test -f $PREFIX/lib/girepository-1.0/HarfBuzz-0.0.typelib    # [unix]
    - if not exist %PREFIX%\Library\lib\girepository-1.0\HarfBuzz-0.0.typelib exit 1         # [win]
    # CLI tests.
    - hb-view --version  # [linux]

about:
  home: http://www.freedesktop.org/wiki/Software/HarfBuzz/
  license: MIT
  license_file: COPYING
  summary: An OpenType text shaping engine.
  description: |
    HarfBuzz is a text shaping library. New Harbuzz targets various font
    technologies while Old HarfBuzz targets only OpenType fonts.
  doc_url: https://www.freedesktop.org/wiki/Software/HarfBuzz/
  dev_url: https://github.com/behdad/harfbuzz

extra:
  recipe-maintainers:
    - ocefpaf
    - pkgw
    - tschoonj
