{% set version = "3.3.8" %}

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

source:
  fn: fftw-{{ version }}.tar.gz
  url: http://www.fftw.org/fftw-{{ version }}.tar.gz
  md5: 8aac833c943d8e90d51b697b27d4384d

build:
  number: 1

requirements:
  build:
    - {{ compiler('c') }}
    - perl                 # [not win]
    - cmake                # [win]
    - ninja                # [win]
    - make                 # [win]
  run_exports:
    - {{ pin_subpackage('fftw', max_pin='x.x') }}

test:
  commands:
    - exit $(test -f ${PREFIX}/lib/libfftw3f.a)          # [not win]
    - exit $(test -f ${PREFIX}/lib/libfftw3.a)           # [not win]
    - exit $(test -f ${PREFIX}/lib/libfftw3l.a)          # [not win]
    - exit $(test -f ${PREFIX}/lib/libfftw3f_threads.a)  # [not win]
    - exit $(test -f ${PREFIX}/lib/libfftw3_threads.a)   # [not win]
    - exit $(test -f ${PREFIX}/lib/libfftw3l_threads.a)  # [not win]

    # Verify headers are installed
    - test -f ${PREFIX}/include/fftw3.h                  # [not win]
    - if not exist %LIBRARY_INC%\\fftw3.h exit 1         # [win]

    # Verify shared libraries are installed
    {% set fftw_libs = [
            "libfftw3",
            "libfftw3_threads",
            "libfftw3f",
            "libfftw3f_threads",
            "libfftw3l",
            "libfftw3l_threads",
    ] %}

    {% set fftw_libs = ["fftw3f", "fftw3"] %}

    {% for base in fftw_libs %}
    - if not exist %LIBRARY_LIB%\\{{ base }}.lib exit 1  # [win]
    - if not exist %LIBRARY_BIN%\\{{ base }}.dll exit 1  # [win]
    {% endfor %}

about:
  home: http://fftw.org
  license: GPL 2
  summary: "The fastest Fourier transform in the west."

extra:
  recipe-maintainers:
    - alexbw
    - jakirkham
    - jjhelmus
    - grlee77
    - jschueller
