{% set version = "0.0.14" %}

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

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

source:
  fn: RcppAnnoy_{{ version }}.tar.gz
  url:
    - {{ cran_mirror }}/src/contrib/RcppAnnoy_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/RcppAnnoy/RcppAnnoy_{{ version }}.tar.gz
  sha256: c4c2da6d8c2fd00ecb78a280c13c55846d9d835ec60de6a991089df24a7f31f2

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

# Suggests: RUnit
requirements:
  build:
    - {{ compiler('c') }}        # [not win]
    - {{ compiler('cxx') }}      # [not win]
    - {{ compiler('m2w64_c') }}        # [win]
    - {{ compiler('m2w64_cxx') }}        # [win]
    - {{posix}}filesystem        # [win]
    - {{posix}}make
    - {{posix}}sed               # [win]
    - {{posix}}coreutils         # [win]
    - {{posix}}zip               # [win]

  host:
    - r-base
    - r-rcpp >=0.11.3

  run:
    - r-base
    - {{native}}gcc-libs         # [win]
    - r-rcpp >=0.11.3

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

about:
  home: https://CRAN.R-project.org/package=RcppAnnoy
  license: GPL (>= 2)
  summary: '''Annoy'' is a small C++ library for Approximate Nearest Neighbors  written for efficient
    memory usage as well an ability to load from / save to disk. This package provides
    an R interface by relying on the ''Rcpp'' package, exposing the same interface as
    the original Python wrapper to ''Annoy''. See <https://github.com/spotify/annoy>
    for more on ''Annoy''. ''Annoy'' is released under Version 2.0 of the Apache License.
    Also included is a small Windows port of ''mmap'' which is released under the MIT
    license.'
  license_file: '{{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-3'
  license_family: GPL3

extra:
   recipe-maintainers:
    - conda-forge/r
    - MathiasHaudgaard
    - FrodePedersen
    - ArneKr
