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

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

source:
  url:
    - {{ cran_mirror }}/src/contrib/minqa_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/minqa/minqa_{{ version }}.tar.gz
  sha256: 51a7b8850e5f2fee79e8f460b9d9eca4221d9702087cca5fab5851ad3d594110

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

requirements:
  build:
    - cross-r-base {{ r_base }}  # [build_platform != target_platform]
    - r-rcpp                     # [build_platform != target_platform]
    - {{ compiler('c') }}        # [not win]
    - {{ compiler('cxx') }}      # [not win]
    - {{ compiler('fortran') }}  # [not win]
    - {{ compiler('m2w64_c') }}        # [win]
    - {{ compiler('m2w64_cxx') }}        # [win]
    - {{ compiler('m2w64_fortran') }}        # [win]
    - {{ posix }}filesystem        # [win]
    - {{ posix }}make
    - {{ posix }}sed               # [win]
    - {{ posix }}coreutils         # [win]
    - {{ posix }}zip               # [win]
  host:
    - r-base
    - r-rcpp >=0.9.10
  run:
    - r-base
    - {{ native }}gcc-libs         # [win]
    - r-rcpp >=0.9.10

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

about:
  home: http://optimizer.r-forge.r-project.org
  license: GPL-2.0-only
  summary: Derivative-free optimization by quadratic approximation based on an interface to Fortran implementations by M. J. D. Powell.
  license_family: GPL2
  license_file:
    - {{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-2

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