{% set version = '0.13' %}
{% set posix = 'm2-' if win else '' %}
{% set native = 'm2w64-' if win else '' %}

package:
  name: r-udunits2
  version: {{ version|replace("-", "_") }}

source:
  fn: udunits2_{{ version }}.tar.gz
  url:
    - {{ cran_mirror }}/src/contrib/udunits2_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/udunits2/udunits2_{{ version }}.tar.gz
  sha256: d155d3c07f6202b65dec4075ffd1e1c3f4f35f5fdece8cfb319d39256a3e5b79

build:
  merge_build_host: True  # [win]
  number: 2
  skip: true  # [win32]
  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - {{ compiler('c') }}        # [not win]
    - {{native}}toolchain        # [win]
    - {{posix}}filesystem        # [win]
    - {{posix}}sed               # [win]
    - {{posix}}grep              # [win]
    - {{posix}}autoconf
    - {{posix}}automake          # [not win]
    - {{posix}}automake-wrapper  # [win]
    - {{posix}}pkg-config
    - {{posix}}make
    - {{posix}}coreutils         # [win]
    - {{posix}}zip               # [win]
  host:
    - r-base
    - udunits2
  run:
    - r-base
    - {{native}}gcc-libs         # [win]
    - udunits2

test:
  commands:
    - $R -e "library('udunits2')"           # [not win]
    - "\"%R%\" -e \"library('udunits2')\""  # [win]

about:
  home: https://github.com/pacificclimate/Rudunits2 https://www.unidata.ucar.edu/software/udunits/
  license: GPL-2
  summary: Provides simple bindings to Unidata's udunits library.
  license_family: GPL2
  license_file: '{{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-2'  # [unix]
  license_file: '{{ environ["PREFIX"] }}\R\share\licenses\GPL-2'  # [win]

extra:
  recipe-maintainers:
    - johanneskoester
    - bgruening
    - daler
    - jdblischak
    - cbrueffer
    - dbast
