{% set name = "libffi" %}
{% set version = "3.3" %}

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

source:
  fn: {{ name }}-{{ version }}.tar.gz
  url: ftp://sourceware.org/pub/{{ name }}/{{ name }}-{{ version }}.tar.gz
  sha1: 8df6cb570c8d6596a67d1c0773bf00650154f7aa
  patches:
    - patches/0001-check-for-existence-of-type-before-setting.patch

build:
  number: 2
  skip: True  # [win]
  run_exports:
    # good history: https://abi-laboratory.pro/tracker/timeline/libffi/
    - {{ pin_subpackage('libffi', max_pin='x.x') }}

requirements:
  build:
    - autoconf
    - automake
    - libtool
    - make
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}

test:
  commands:
    - test -e $PREFIX/lib/libffi.so  # [linux]
    - test -e $PREFIX/lib/libffi.a  # [unix]
    - test -e $PREFIX/lib/libffi.dylib  # [osx]
    - test -e $PREFIX/include/ffi.h
    - test -e $PREFIX/include/ffitarget.h

about:
  home: https://sourceware.org/libffi/
  license: Custom
  summary: A Portable Foreign Function Interface Library.
  
  description: |
    The libffi library provides a portable, high level programming interface
    to various calling conventions. This allows a programmer to call any
    function specified by a call interface description at run-time.
  doc_url: https://sourceware.org/libffi/
  dev_url: https://github.com/libffi/libffi

extra:
  recipe-maintainers:
    - stefan-balke
    - scopatz
