{% set name = "harfbuzz" %}
{% set version = "4.3.0" %}
{% set sha256 = "32184860ddc0b264ff95010e1c64e596bd746fe4c2e34014a1185340cdddeba6" %}

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

source:
  url: https://github.com/harfbuzz/harfbuzz/archive/{{ version }}.tar.gz
  sha256: {{ sha256 }}
  patches:               # [win]
    - fix-win-gir.patch  # [win]
build:
  number: 2
  run_exports:
    # removes symbols rarely (last time in 2014).
    #    https://abi-laboratory.pro/tracker/timeline/harfbuzz/
    - {{ pin_subpackage('harfbuzz') }}
  missing_dso_whitelist:      # [linux]
    - $RPATH/libm.so.6        # [linux]
    - $RPATH/libc.so.6        # [linux]
    - $RPATH/libpthread.so.0  # [linux]

requirements:
  build:
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - {{ cdt('libxau-devel') }}          # [linux]
    - {{ cdt('libxext-devel') }}         # [linux]
    - {{ cdt('libx11-devel') }}          # [linux]
    - {{ cdt('libxrender-devel') }}      # [linux]
    - {{ cdt('xorg-x11-proto-devel') }}  # [linux and (s390x or ppc64le or x86_64)]; needed for cairo support
    - pkg-config
    - gobject-introspection
    - meson
    - ninja-base
    - pthread-stubs
    - m2-patch  # [win]
  host:
    - gobject-introspection 1.72.0
    - cairo 1.16
    - freetype 2.10
    - glib 2
    - icu 73
    - graphite2 1.3.14
  run:
    - cairo                              # [not win]
    - freetype
    - icu
    - graphite2

test:
  commands:
    # Libraries/headers.
    {% set libs = [
        "harfbuzz-icu",
        "harfbuzz"
        ] %}
    {% for lib in libs %}
    - test -f $PREFIX/lib/lib{{ lib }}.dylib  # [osx]
    - test -f $PREFIX/lib/lib{{ lib }}.so  # [linux]
    - 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/share/gir-1.0/HarfBuzz-0.0.gir  # [not win]
    # CLI tests.
    - hb-view --version  # [linux]

about:
  home: https://harfbuzz.github.io/
  license: MIT
  license_file: COPYING
  license_family: MIT
  summary: A text shaping library.
  description: |
    HarfBuzz is a text shaping library. Using the HarfBuzz library allows
    programs to convert a sequence of Unicode input into properly formatted
    and positioned glyph output—for any writing system and language.
  doc_url: https://harfbuzz.github.io/
  dev_url: https://github.com/harfbuzz/harfbuzz

extra:
  recipe-maintainers:
    - ocefpaf
    - pkgw
