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

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

source:
  url:
    - {{ cran_mirror }}/src/contrib/ECOSolveR_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/ECOSolveR/ECOSolveR_{{ version }}.tar.gz
  sha256: 5d7489e8176c1df3f3f1290732243429280efca4f837916e6b6faa6dc8a8e324

build:
  merge_build_host: True  # [win]
  number: 1
  rpaths:
    - lib/R/lib/
    - lib/

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

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

about:
  home: https://bnaras.github.io/ECOSolveR/
  license: GPL-3.0-or-later
  summary: R interface to the Embedded COnic Solver (ECOS), an efficient and robust C library
    for convex problems. Conic and equality constraints can be specified in addition
    to integer and boolean variable constraints for mixed-integer problems. This R interface
    is inspired by the python interface and has similar calling conventions.
  license_family: GPL3
  license_file:
    - {{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-3

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