{% set version = '1.2-1' %}

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

package:
  name: r-minpack.lm
  version: {{ version|replace("-", "_") }}

source:
  fn: minpack.lm_{{ version }}.tar.gz
  url:
    - https://cran.r-project.org/src/contrib/minpack.lm_{{ version }}.tar.gz
    - https://cran.r-project.org/src/contrib/Archive/minpack.lm/minpack.lm_{{ version }}.tar.gz
  sha256: 14cb7dba3ef2b46da0479b46d46c76198e129a31f6157cd8b37f178adb15d5a3

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('minpack.lm')"  # [not win]
    - "\"%R%\" -e \"library('minpack.lm')\""  # [win]

about:
  home: https://CRAN.R-project.org/package=minpack.lm
  license: GPL-3
  summary: 'The nls.lm function provides an R interface to lmder and lmdif from the MINPACK library,
    for solving nonlinear least-squares problems by a modification of the Levenberg-Marquardt
    algorithm, with support for lower and upper parameter bounds.  The implementation
    can be used via nls-like calls using the nlsLM function.  '

  license_family: GPL3

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