{% set name = "gdk-pixbuf" %}
{% set version = "2.42.6" %}
{% set sha256 = "c4a6b75b7ed8f58ca48da830b9fa00ed96d668d3ab4b1f723dcf902f78bde77f" %}

package:
    name: {{ name|lower }}
    version: {{ version }}

source:
    sha256: {{ sha256 }}
    url: http://ftp.gnome.org/pub/gnome/sources/{{ name }}/{{ '.'.join(version.split('.')[:2]) }}/{{ name }}-{{ version }}.tar.xz

build:
  number: 0
  skip: true  # [win and vc<14]
  run_exports:
    # https://abi-laboratory.pro/?view=timeline&l=gdk-pixbuf
    - {{ pin_subpackage('gdk-pixbuf', max_pin='x') }}

requirements:
  build:
    - pkg-config
    - {{ compiler('c') }}
    - meson
    - meson ==0.56.2  # [osx and arm64]
    - ninja
    - gobject-introspection
    - glib      # [build_platform != target_platform]
    - jpeg      # [build_platform != target_platform]
    - libtiff   # [build_platform != target_platform]
    - libpng    # [build_platform != target_platform]
    - zlib      # [build_platform != target_platform]
  host:
    - glib
    - jpeg
    - libtiff
    - libpng
    - zlib
  run:
    - libglib
    - jpeg
    - libtiff
    - libpng
    - zlib

test:
  requires:
    - pkg-config
  commands:
    - gdk-pixbuf-csource --version
    - gdk-pixbuf-query-loaders
    - gdk-pixbuf-pixdata --help

    # verify that libs get installed and can be located through pkg-config
    {% set pc = "gdk-pixbuf-2.0" %}
    {% set lib = "gdk_pixbuf-2.0" %}
    - test -f $PREFIX/lib/lib{{ lib }}${SHLIB_EXT}  # [unix]
    - test -f `pkg-config --variable=libdir --dont-define-prefix {{ pc }}`/lib{{ lib }}${SHLIB_EXT}  # [unix]
    - if not exist %PREFIX%\\Library\\bin\\{{ lib }}-0.dll exit 1  # [win]
    - for /f "usebackq tokens=*" %%a in (`pkg-config --variable=exec_prefix --dont-define-prefix {{ pc }}`) do if not exist "%%a/bin/{{ lib }}-0.dll" exit 1  # [win]
    - if not exist %PREFIX%\\Library\\lib\\gdk_pixbuf-2.0.lib exit 1  # [win]
    - for /f "usebackq tokens=*" %%a in (`pkg-config --variable=libdir --dont-define-prefix {{ pc }}`) do if not exist "%%a/{{ lib }}.lib" exit 1  # [win]
    - test -f $PREFIX/lib/girepository-1.0/GdkPixbuf-2.0.typelib  # [unix]
    - if not exist %PREFIX%\\Library\\lib\\girepository-1.0\\GdkPixbuf-2.0.typelib exit 1   # [win]


about:
  home: https://developer.gnome.org/gdk-pixbuf/
  license: LGPL-2.1-or-later
  license_family: LGPL
  license_file: COPYING
  summary: "GdkPixbuf is a library for image loading and manipulation."

extra:
  recipe-maintainers:
    - notestaff
    - pkgw
    - tschoonj
