{% set version = "4.7-1.2" %}
{% set posix = 'm2-' if win else '' %}

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

source:
  url:
    - {{ cran_mirror }}/src/contrib/randomForest_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/randomForest/randomForest_{{ version }}.tar.gz
  sha256: aad33227b648bad50412849d7e0fed00fd07f1d1d4a14fa015b4b9f939b04a11

build:
  number: 0
  skip: true  # [r_base == "4.0"]
  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - cross-r-base {{ r_base }}  # [build_platform != target_platform]
    - {{ compiler('c') }}        # [not win]
    - {{ stdlib("c") }}          # [not win]
    - {{ compiler('fortran') }}  # [not win]
    - {{ compiler('m2w64_c') }}        # [win]
    - {{ stdlib("m2w64_c") }}          # [win]
    - {{ compiler('m2w64_fortran') }}        # [win]
    - {{ posix }}filesystem        # [win]
    - {{ posix }}make
    - {{ posix }}sed               # [win]
    - {{ posix }}coreutils         # [win]
    - {{ posix }}zip               # [win]
  host:
    - r-base
  run:
    - r-base

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

about:
  home: https://www.stat.berkeley.edu/~breiman/RandomForests/
  license: GPL-2.0-or-later
  summary: Classification and regression based on a forest of trees using random inputs, based on Breiman (2001) <DOI:10.1023/A:1010933404324>.
  license_family: GPL3
  license_file:
    - {{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-3

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