{% set version = "1.16.0" %}

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

source:
  url: https://pypi.io/packages/source/c/cffi/cffi-{{ version }}.tar.gz
  sha256: bcb3ef43e58665bbda2fb198698fcae6776483e0c4a631aa5647806c25e02cc0
  patches:
    - 0001-Link-to-dl-library.patch
    - 0002-setup-linux.patch
    - 0003-apple-api.patch  # [osx]

build:
  number: 0
  script: {{ PYTHON }} -m pip install . -vv

requirements:
  build:
    - python                                 # [build_platform != target_platform]
    - cross-python_{{ target_platform }}     # [build_platform != target_platform]
    - {{ compiler('c') }}
    - patch     # [not win]
    - m2-patch  # [win]
  host:
    - python
    - pip
    - wheel
    - setuptools
    - libffi  # [not win]
    - pycparser
  run:
    - python
    - libffi  # [not win]
    - pycparser

test:
  imports:
    - cffi
    - _cffi_backend
  requires:
    - pip
    - openssl *
  commands:
    - pip check
    - python -X faulthandler -c "from cffi import FFI; print(FFI().dlopen('ucrtbase'))"  # [win]
    - python -X faulthandler -c "from cffi import FFI; print(FFI().dlopen(None))"  # [not win]

about:
  home: https://bitbucket.org/cffi/cffi
  license: MIT
  license_file: LICENSE
  summary: Foreign Function Interface for Python calling C code.

  description: |
    Cffi aims to allow users to call C code from Python without having to
    learn a 3rd language. It provides a convenient and reliable way to call
    compiled C code from Python using interface declarations written in C.
  doc_url: http://cffi.readthedocs.org
  dev_url: https://bitbucket.org/cffi/cffi/overview
  doc_source_url: https://bitbucket.org/cffi/cffi/src/default/doc/?at=default

extra:
  recipe-maintainers:
    - goanpeca
    - ocefpaf
    - mingwandroid
    - katietz
