{% set version = "2.1.8" %}

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

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

source:
  fn: gbm_{{ version }}.tar.gz
  url:
    - {{ cran_mirror }}/src/contrib/gbm_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/gbm/gbm_{{ version }}.tar.gz
  sha256: 7d5de3b980b8f23275e86ac9bed48a497c9aa53c58e407dfd676309f38272ec1

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

# Suggests: knitr, pdp, RUnit, splines, viridis
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-gridextra
    - r-lattice
    - r-survival

  run:
    - r-base
    - {{ native }}gcc-libs         # [win]
    - r-gridextra
    - r-lattice
    - r-survival

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

about:
  home: https://github.com/gbm-developers/gbm
  license: GPL-2.0-or-later
  summary: An implementation of extensions to Freund and Schapire's AdaBoost  algorithm and Friedman's gradient boosting machine. Includes regression  methods for least squares, absolute loss, t-distribution loss, quantile  regression, logistic, multinomial logistic, Poisson, Cox proportional hazards  partial likelihood,
    AdaBoost exponential loss, Huberized hinge loss, and  Learning to Rank measures (LambdaMart). Originally developed by Greg Ridgeway.
  license_family: GPL3
  license_file:
    - {{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-3

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