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

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

source:
  url:
    - {{ cran_mirror }}/src/contrib/RApiDatetime_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/RApiDatetime/RApiDatetime_{{ version }}.tar.gz
  sha256: c1676f3ebcc2462f94b69c1ed2f21f61e2556eec02fad2f3adfcef611bef087c

build:
  merge_build_host: True  # [win]
  number: 1002
  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - {{ compiler('c') }}        # [not win]
    - {{ compiler('m2w64_c') }}        # [win]
    - {{ posix }}filesystem        # [win]
    - {{ posix }}make
    - {{ posix }}sed               # [win]
    - {{ posix }}coreutils         # [win]
    - {{ posix }}zip               # [win]
  host:
    - r-base
  run:
    - r-base
    - {{ native }}gcc-libs         # [win]

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

about:
  home: https://CRAN.R-project.org/package=RApiDatetime
  license: GPL (>= 2)
  summary: 'Access to the C-level R date and datetime code is provided for C-level API use by
    other packages via registration of native functions. Client packages simply include
    a single header ''RApiDatetime.h'' provided by this package, and also ''import''
    it.  The R Core group is the original author of the code made available with slight
    modifications by this package. '
  license_family: GPL3
  license_file: '{{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-3'

extra:
  recipe-maintainers:
    - conda-forge/r
    - philip-khor
