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

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

source:
  url:
    - {{ cran_mirror }}/src/contrib/scs_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/scs/scs_{{ version }}.tar.gz
  sha256: 1f57b1724a9cfda638d34ca9c97ecb1b671a8d00286d4c69c973ff1de480c1a1

build:
  merge_build_host: True  # [win]
  number: 0
  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
    - libblas
    - liblapack
  run:
    - r-base
    - {{ native }}gcc-libs         # [win]
    - libblas
    - liblapack

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

about:
  home: https://github.com/FlorianSchwendinger/scs
  license: GPL-3.0-only
  summary: 'Solves convex cone programs via operator splitting. Can solve: linear programs (''LPs''),
    second-order cone programs (''SOCPs''), semidefinite programs (''SDPs''), exponential
    cone programs (''ECPs''), and power cone programs (''PCPs''), or problems with any
    combination of those cones. ''SCS'' uses ''AMD'' (a set of routines for permuting
    sparse matrices prior to factorization) and ''LDL'' (a sparse ''LDL'' factorization
    and solve package) from ''SuiteSparse'' (<https://people.engr.tamu.edu/davis/suitesparse.html>).'
  license_family: GPL3
  license_file:
    - {{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-3

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