{% set version = '1.1-4' %}

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

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

source:
  fn: ucminf_{{ version }}.tar.gz
  url:
    - https://cran.r-project.org/src/contrib/ucminf_{{ version }}.tar.gz
    - https://cran.r-project.org/src/contrib/Archive/ucminf/ucminf_{{ version }}.tar.gz
  sha256: a2eb382f9b24e949d982e311578518710f8242070b3aa3314a331c1e1e7f6f07

build:
  number: 0
  skip: true  # [win32]
  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - r-base
    - posix                # [win]
    - {{native}}toolchain  # [win]
    - gcc                  # [not win]

  run:
    - r-base
    - libgcc  # [not win]

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

about:
  home: https://CRAN.R-project.org/package=ucminf
  license: GPL (>= 2)
  summary: An algorithm for general-purpose unconstrained non-linear optimization. The algorithm
    is of quasi-Newton type with BFGS updating of the inverse Hessian and soft line
    search with a trust region type monitoring of the input to the line search algorithm.
    The interface of 'ucminf' is designed for easy interchange with 'optim'.
  license_family: GPL3
  license_file: '{{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-3'  # [unix]
  license_file: '{{ environ["PREFIX"] }}\R\share\licenses\GPL-3'  # [win]

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