{% set xorg_name = "libXtst" %}
{% set xorg_category = "lib" %}
{% set name = "xorg-" ~ xorg_name %}
{% set version = "1.2.5" %}
{% set sha256 = "244ba6e1c5ffa44f1ba251affdfa984d55d99c94bb925a342657e5e7aaf6d39c" %}
{% set am_version = "1.15" %} # keep synchronized with build.sh

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

source:
  fn: {{ name }}-{{ version }}.tar.gz
  url: https://www.x.org/releases/individual/{{ xorg_category }}/{{ xorg_name }}-{{ version }}.tar.gz
  sha256: {{ sha256 }}

build:
  number: 0
  detect_binary_files_with_prefix: true
  run_exports:
    - {{ pin_subpackage(name|lower) }}

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]
    - {{ stdlib('c') }}          # [unix]
    - {{ compiler('c') }}        # [unix]
    - {{ stdlib('m2w64_c') }}    # [win]
    - {{ compiler('m2w64_c') }}  # [win]
    - make   # [unix]
  host:
    - xorg-inputproto
    - xorg-libx11 >=1.6,<2
    # Additional constraintless xorg-libx11 dep below is for conda-build to add potential pinning to.
    - xorg-libx11
    - xorg-libxext 1.3.*
    - xorg-libxi 1.7.*
    - xorg-recordproto
    - xorg-util-macros
  run:
    - xorg-inputproto
    - xorg-libxext 1.3.*
    - xorg-libxi 1.7.*
    - xorg-recordproto
    - {{ pin_compatible('xorg-libx11') }}

test:
  commands:
    {% set lib_idents = [ "Xtst" ] %}
    {% 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: https://www.x.org/
  license: MIT
  license_family: MIT
  license_file: COPYING
  summary: 'The X.org X11 test-event library.'

extra:
  recipe-maintainers:
    - pkgw
    - ehfd
