{% set version = "3.2.4" %}
{% 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: c3f39874bf4532fa8c2f2e2c41533ba4fe20b61cf6dfc6314407dc981621298f

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
    - 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
