{% set version = '1.2' %}

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

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

source:
  fn: pdist_{{ version }}.tar.gz
  url:
    - https://cran.r-project.org/src/contrib/pdist_{{ version }}.tar.gz
    - https://cran.r-project.org/src/contrib/Archive/pdist/pdist_{{ version }}.tar.gz

  sha256: ad01bcc822fe58b9bf6faea1cb8d4f8a4046bb1e1c5cc6eb172e84a65e1dcda2

build:
  merge_build_host: True  # [win]
  number: 2
  skip: true  # [win32]

  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - posix                # [win]
    - {{ compiler('c') }}        # [unix]
    - {{ compiler('m2w64_c') }}  # [win]
  host:
    - r-base

  run:
    - r-base

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

about:
  home: https://cran.r-project.org/web/packages/pdist/index.html
  license: GPL
  summary: Computes the euclidean distance between rows of a matrix X and rows of another matrix
    Y.  Previously, this could be done by binding the two matrices together and calling
    'dist', but this creates unnecessary computation by computing the distances between
    a row of X and another row of X, and likewise for Y. pdist strictly computes distances
    across the two matrices, not within the same matrix, making computations significantly
    faster for certain use cases.
  license_family: GPL
extra:
   recipe-maintainers:
    - dpryan79
    - MathiasHaudgaard
    - FrodePedersen
    - ArneKr
    - johanneskoester
    - bgruening
    - daler
    - jdblischak
