{% set version = "1.13" %}

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

source:
  url: https://github.com/stcorp/harp/releases/download/{{ version }}/harp-{{ version }}.tar.gz
  sha256: 730992c1427d77feb2a41ee33c0818b28324f125a0ee99255a55c81997cb263c
  patches:
    - findjpeg.patch
    - findr.patch
    - rmodule.patch

build:
  number: 1
  script_env:
    - SDKROOT  # [osx]
  rpaths:
    - lib/R/lib
    - lib

requirements:
  build:
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - cmake
    - make  # [not win]
    - bison  # [not win]
    - flex  # [not win]
    - m2-bison  # [win]
    - m2-flex  # [win]

  host:
    - coda
    - python
    - zlib
    - hdf4
    - hdf5
    - jpeg
    - r-base

  run:
    - r-base
    - coda
    - python
    - numpy
    - cffi

test:
  commands:
    - test -f $PREFIX/lib/libharp$SHLIB_EXT  # [unix]
    - if not exist "%LIBRARY_PREFIX%/lib/libharp.lib" exit 1  # [win]
    - if not exist "%LIBRARY_PREFIX%/bin/harpdump.exe" exit 1  # [win]
    - $R -e "library('harp')"  # [unix]
    - "\"%R%\" -e \"library('harp')\""  # [win]
  imports:
    - harp

about:
  home: https://github.com/stcorp/harp
  license: BSD-3-Clause-Clear
  license_family: BSD
  license_file: COPYING
  summary: HARP is a toolset for ingesting, processing and inter-comparing satellite or model data against correlative data. The toolset is composed of a set of command line tools, a C library of analysis functions, and import/export interfaces for Python, R, Matlab, and IDL.

extra:
  recipe-maintainers:
    - srepmub
    - svniemeijer
