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

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

source:
  fn: nloptr_{{ version }}.tar.gz
  url:
    - {{ cran_mirror }}/src/contrib/nloptr_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/nloptr/nloptr_{{ version }}.tar.gz
  sha256: e80ea9619ac18f4bfe44812198b40b9ae5c0ddf3f9cc91778f9ccc82168d1372

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

requirements:
  build:
    - {{ compiler('c') }}        # [not win]
    - {{ compiler('cxx') }}      # [not win]
    - {{ compiler('m2w64_c') }}        # [win]
    - {{ compiler('m2w64_cxx') }}        # [win]
    - {{ posix }}filesystem        # [win]
    - {{ posix }}sed               # [win]
    - {{ posix }}grep              # [win]
    - {{ posix }}autoconf
    - {{ posix }}automake          # [not win]
    - {{ posix }}automake-wrapper  # [win]
    - {{ posix }}pkg-config
    - {{ posix }}make
    - {{ posix }}coreutils         # [win]
    - {{ posix }}zip               # [win]
  host:
    - r-base
    - {{ native }}nlopt            # [win]
  run:
    - r-base
    - {{ native }}nlopt            # [win]
    - {{ native }}gcc-libs         # [win]

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

about:
  home: https://CRAN.R-project.org/package=nloptr
  license: LGPL-3.0
  summary: ' nloptr is an R interface to NLopt. NLopt is a free/open-source library for nonlinear optimization, providing a common interface for a number of different free optimization routines available online as well as original implementations of various other algorithms. See http://ab-initio.mit.edu/wiki/index.php/NLopt_Introduction
    for more information on the available algorithms. During installation on Unix the NLopt code is downloaded and compiled from the NLopt website.'
  license_family: LGPL
  license_file:
    - {{ environ["PREFIX"] }}/lib/R/share/licenses/LGPL-3

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