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

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

source:
  fn: {{ version }}.tar.gz
  url: https://github.com/Microsoft/LightGBM/archive/v{{ version }}.tar.gz
  sha256: b7f8b1115d7aafd56bd860971355289a08ecb682b345c4a926a1ab61acd0351b

build:
  merge_build_host: True  # [win]
  number: 1002
  skip: True  # [osx and c_compiler == "toolchain_c" or win and vc<14]
  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - {{ compiler('c') }}        # [linux]
    - {{ compiler('cxx') }}      # [linux]
    - {{native}}toolchain        # [win]
    - {{posix}}filesystem        # [win]
    - {{posix}}make
    - {{posix}}sed               # [win]
    - {{posix}}coreutils         # [win]
    - {{posix}}zip               # [win]
    - cmake >=3.8
  host:
    - r-base
    - r-data.table >=1.9.6
    - r-jsonlite >=1.0
    - r-magrittr >=1.5
    - r-matrix >=1.1-0
    - r-r6 >=2.0
  run:
    - r-base
    - {{native}}gcc-libs         # [win]
    - libcxx                     # [osx]
    - llvm-openmp                # [osx]
    - r-data.table >=1.9.6
    - r-jsonlite >=1.0
    - r-magrittr >=1.5
    - r-matrix >=1.1-0
    - r-r6 >=2.0

test:
  files:
    - test.r
  commands:
    - Rscript test.r
    - $R -e "library('lightgbm')"           # [not win]
    - "\"%R%\" -e \"library('lightgbm')\""  # [win]

about:
  home: https://github.com/Microsoft/LightGBM
  license: MIT
  summary: |
    A fast, distributed, high performance gradient boosting (GBDT, GBRT, GBM or MART)
    framework based on decision tree algorithms, used for ranking, classification and
    many other machine learning tasks.
  license_family: MIT
  license_file: LICENSE

extra:
  recipe-maintainers:
    - johanneskoester
    - bgruening
    - daler
    - jdblischak
    - cbrueffer
    - dbast
