{% set name = "atk" %}
{% set version = "2.36.0" %}
{% set major_minor = ".".join(version.split(".")[:2]) %}
{% set abi_version = "1.0" %}

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

source:
  url: http://ftp.gnome.org/pub/gnome/sources/{{ name }}/{{ major_minor }}/{{ name }}-{{ version }}.tar.xz
  sha256: fb76247e369402be23f1f5c65d38a9639c1164d934e40f6a9cf3c9e96b652788

build:
  number: 4
  skip: true  # [win and vc<14]
  run_exports:
    - atk-{{ abi_version }} >={{ version }}

outputs:
  - name: atk-{{ abi_version }}
    script: build_atk.sh  # [unix]
    script: bld_atk.bat   # [win]
    build:
      run_exports:
        - atk-{{ abi_version }} >={{ version }}
    requirements:
      build:
        - meson
        - gobject-introspection 1.*
        - ninja
        - python >=3.6
        - pkg-config
        - {{ compiler('c') }}
        - glib  # [build_platform != target_platform]
        # Required for the conda-forge meson cross-compilation config to work
        - {{ compiler('cxx') }}
      host:
        - glib
      run:
        - libglib
      run_constrained:
        - atk-{{ abi_version }} {{ version }}

    test:
      requires:
        - pkg-config
      commands:
        # verify that libs get installed and can be located through pkg-config
        {% set pc = "atk" %}
        {% set lib = "atk-" + abi_version  %}
        - 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\\{{ lib }}.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]

  - name: atk
    requirements:
      run:
        - atk-{{ abi_version }} {{ version }}
    test:
      commands:
       - test -f $PREFIX/lib/libatk-{{ abi_version }}${SHLIB_EXT}  # [unix]

about:
  home: http://www.gtk.org/
  license: LGPL-2.0-or-later
  license_file: COPYING
  summary: 'Accessibility Toolkit.'

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