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

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

source:
  url:
    - {{ cran_mirror }}/src/contrib/IsingSampler_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/IsingSampler/IsingSampler_{{ version }}.tar.gz
  sha256: fb9d1c851941d74d218ae5be6d45ea3e9c228c938ef9cdfd34de9535cadc44b3

build:
  merge_build_host: True  # [win]
  number: 0

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

requirements:
  build:
    - {{ compiler('c') }}              # [not win]
    - {{ compiler('m2w64_c') }}        # [win]
    - {{ compiler('cxx') }}            # [not win]
    - {{ compiler('m2w64_cxx') }}      # [win]
    - {{ posix }}filesystem        # [win]
    - {{ posix }}make
    - {{ posix }}sed               # [win]
    - {{ posix }}coreutils         # [win]
    - {{ posix }}zip               # [win]
    - cross-r-base {{ r_base }}    # [build_platform != target_platform]

  host:
    - r-base
    - r-rcpp >=0.10.4
    - r-dplyr
    - r-magrittr
    - r-nnet
    - r-plyr

  run:
    - r-base
    - {{ native }}gcc-libs         # [win]
    - r-rcpp >=0.10.4
    - r-dplyr
    - r-magrittr
    - r-nnet
    - r-plyr

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

about:
  home: github.com/SachaEpskamp/IsingSampler

  license: GPL-2.0-only
  summary: Sample states from the Ising model and compute the probability of states. Sampling
    can be done for any number of nodes, but due to the intractibility of the Ising
    model the distribution can only be computed up to ~10 nodes.

  license_family: GPL2
  license_file:
    - '{{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-2'

extra:
  recipe-maintainers:
    - conda-forge/r
    - izahn
