{% set major = "1.48" %}
{% set patch = "7" %}
{% set version = major + "." + patch %}

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

source:
  url: https://download.gnome.org/sources/pango/{{ major }}/pango-{{ version }}.tar.xz
  sha256: 28a82f6a6cab60aa3b75a90f04197ead2d311fa8fe8b7bfdf8666e2781d506dc

build:
  number: 0
  detect_binary_files_with_prefix: true
  ignore_run_exports_from:
    - {{ compiler('cxx') }}
  run_exports:
    - {{ pin_subpackage('pango', max_pin='x') }}

requirements:
  build:
    - meson 0.56.2
    - ninja
    - pkg-config
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - gobject-introspection
    - cairo     # [build_platform != target_platform]
    - fribidi   # [build_platform != target_platform]
    - glib      # [build_platform != target_platform]
    - harfbuzz  # [build_platform != target_platform]
    - fontconfig  # [build_platform != target_platform]
    - freetype    # [build_platform != target_platform]
    - libpng                 # [build_platform != target_platform]
  host:
    - cairo
    - fribidi
    - glib
    - harfbuzz
    - fontconfig
    - freetype
    - libpng
  run:
    - cairo
    - fribidi
    - harfbuzz
    - fontconfig
    - freetype
    - libpng

test:
  requires:
    - pkg-config
    - pygobject
  commands:
    - pango-view --help

    # check that libraries are installed and can be found through pkg-config
    # (used by downstream builds)
    {% set libs = [
        "Pango",
        "PangoCairo",
        "PangoFT2",
    ] %}
    {% for lib in libs %}
    - test -f $PREFIX/lib/lib{{ lib | lower }}-1.0${SHLIB_EXT}  # [unix]
    - test -f `pkg-config --variable=libdir --dont-define-prefix {{ lib | lower }}`/lib{{ lib | lower }}-1.0${SHLIB_EXT}  # [unix]
    - if not exist %PREFIX%\\Library\\bin\\{{ lib | lower }}-1.0-0.dll exit 1  # [win]
    - for /f "usebackq tokens=*" %%a in (`pkg-config --variable=exec_prefix --dont-define-prefix {{ lib | lower }}`) do if not exist "%%a/bin/{{ lib | lower }}-1.0-0.dll" exit 1  # [win]
    - if not exist %PREFIX%\\Library\\lib\\{{ lib | lower }}-1.0.lib exit 1  # [win]
    - for /f "usebackq tokens=*" %%a in (`pkg-config --variable=libdir --dont-define-prefix {{ lib | lower }}`) do if not exist "%%a/{{ lib | lower }}-1.0.lib" exit 1  # [win]
    - "test -f $PREFIX/lib/girepository-1.0/{{ lib }}-1.0.typelib"  # [unix]
    - "if not exist %PREFIX%\\Library\\lib\\girepository-1.0\\{{ lib }}-1.0.typelib exit 1"   # [win]
    {% endfor %}

about:
  home: http://www.pango.org/
  license: LGPL-2.1-or-later
  license_file: COPYING
  summary: 'Text layout and rendering engine.'
  description: |
    Pango is a library for laying out and rendering of text, with an emphasis
    on internationalization. Pango can be used anywhere that text layout is
    needed, though most of the work on Pango so far has been done in the
    context of the GTK+ widget toolkit. Pango forms the core of text and font
    handling for GTK+-2.x.
  doc_url: http://www.pango.org/
  dev_url: https://gitlab.gnome.org/GNOME/pango

extra:
  recipe-maintainers:
    - ocefpaf
    - ccordoba12
    - jakirkham
    - pkgw
