{% set name = "cfitsio" %}
{% set version = "3.470" %}
{% set nozeroversion = version[:-1] %}
# This is the SHA256 hash of the ungzipped tar file. See https://github.com/conda/conda/issues/3798.
{% set sha256 = "985606e058403c073a68d95be74e9696f0ded9414520784457a1d4cba8cca7e2" %}

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

source:
  url: https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/{{ name }}-{{ nozeroversion }}.tar.gz
  sha256: {{ sha256 }}
  patches:
    - ldflags.patch
    - unvendor_zlib.patch
    - lcurl-pkg-config.patch

build:
  number: 7
  skip: True  # [win and py27]
  run_exports:
    - {{ pin_subpackage('cfitsio', max_pin='x.x.x') }}

requirements:
  build:
    - libtool  # [unix]
    - {{ compiler('fortran') }}  # [not win]
    - {{ compiler('c') }}
    - cmake  # [win]
    - make  # [not win]
  host:
    - libcurl  # [not win]
    - bzip2  # [not win]
    - zlib  # [not win]

test:
  commands:
    - test -f ${PREFIX}/lib/libcfitsio{{ SHLIB_EXT }}  # [not win]
    - if not exist %LIBRARY_LIB%\cfitsio.lib exit 1  # [win]
    - if not exist %LIBRARY_BIN%\cfitsio.dll exit 1  # [win]
  downstreams:
    - gdal  # [x86_64]

about:
  home: http://heasarc.gsfc.nasa.gov/fitsio/fitsio.html
  license: LicenseRef-fitsio
  license_file: License.txt
  summary: "A library for reading and writing FITS files"

  description: |
    CFITSIO is a library of C and Fortran subroutines for reading and writing
    data files in FITS (Flexible Image Transport System) data format. CFITSIO
    provides simple high-level routines for reading and writing FITS files that
    insulate the programmer from the internal complexities of the FITS format.
    CFITSIO also provides many advanced features for manipulating and filtering
    the information in FITS files.
  doc_url: https://heasarc.gsfc.nasa.gov/docs/software/fitsio/quick/quick.html

extra:
  recipe-maintainers:
    - pkgw
    - teake
