{% set xorg_name = "libxcb" %}
{% set xorg_category = "xcb" %}
{% set name = "libxcb" %}
{% set version = "1.13" %}
{% set sha256 = "188c8752193c50ff2dbe89db4554c63df2e26a2e47b0fa415a70918b5b851daa" %}
{% set am_version = "1.15" %} # keep synchronized with build.sh

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

source:
  fn: {{ xorg_name }}-{{ version }}.tar.bz2
  url: https://www.x.org/releases/individual/{{ xorg_category }}/{{ xorg_name }}-{{ version }}.tar.bz2
  sha256: {{ sha256 }}
  patches:
    - windows.patch  # [win]

build:
  number: 1003
  detect_binary_files_with_prefix: true

requirements:
  build:
    - m2-autoconf                   # [win]
    - m2-automake{{ am_version }}   # [win]
    - m2-libtool                    # [win]
    - m2w64-pkg-config              # [win]
    - pkg-config                    # [not win]
    - posix                         # [win]
    - gnuconfig  # [unix]
    - {{ compiler('c') }}           # [unix]
    - {{ compiler('m2w64_c') }}     # [win]
    - make                          # [unix]
    - autoconf                      # [unix]
    - automake                      # [unix]
    - gettext                       # [unix]
    - libtool                       # [unix]
    - python  # [build_platform != target_platform]
  host:
    - pthread-stubs
    - xorg-libxau
    - xorg-libxdmcp
    - xorg-util-macros
    - xcb-proto >=1.13
    - xorg-xproto
  run:
    - pthread-stubs
    - xorg-libxau
    - xorg-libxdmcp

test:
  commands:
    {% set lib_idents = [
      "xcb",
      "xcb-composite",
      "xcb-damage",
      "xcb-dpms",
      "xcb-dri2",
      "xcb-glx",
      "xcb-present",
      "xcb-randr",
      "xcb-record",
      "xcb-res",
      "xcb-screensaver",
      "xcb-shape",
      "xcb-shm",
      "xcb-sync",
      "xcb-xf86dri",
      "xcb-xfixes",
      "xcb-xinerama",
      "xcb-xkb",
      "xcb-xtest",
      "xcb-xv",
      "xcb-xvmc",
    ] %}
    {% set lib_idents = lib_idents + ['xcb-dri3', 'xcb-render', 'xcb-xinput'] %}  # [not win]
    {% for lib_ident in lib_idents %}
    - test -f $PREFIX/lib/lib{{ lib_ident }}.dylib  # [osx]
    - test -f $PREFIX/lib/lib{{ lib_ident }}.so  # [linux]
    - if not exist %PREFIX%/Library/lib/lib{{ lib_ident }}.dll.a exit /b 1  # [win]
    - if not exist %PREFIX%/Library/bin/msys-{{ lib_ident }}-*.dll exit /b 1  # [win]
    {% endfor %}

about:
  home: http://xcb.freedesktop.org/
  license: MIT
  license_family: MIT
  license_file: COPYING
  summary: "This is the C-language Binding (XCB) package to the X Window System protocol"

extra:
  recipe-maintainers:
    - ccordoba12
    - mingwandroid
    - pkgw
