lol
1{ lib, stdenv, fetchFromGitHub, blas, lapack, gfortran, fixDarwinDylibNames }:
2
3assert (!blas.isILP64) && (!lapack.isILP64);
4
5stdenv.mkDerivation rec {
6 pname = "scs";
7 version = "3.2.3";
8
9 src = fetchFromGitHub {
10 owner = "cvxgrp";
11 repo = "scs";
12 rev = version;
13 sha256 = "sha256-0g0r3DNgkPZgag0qtz79Wk3Cre1I2yaabFi3OgUzgfc=";
14 };
15
16 # Actually link and add libgfortran to the rpath
17 postPatch = ''
18 substituteInPlace scs.mk \
19 --replace "#-lgfortran" "-lgfortran" \
20 --replace "gcc" "cc"
21 '';
22
23 nativeBuildInputs = lib.optional stdenv.isDarwin fixDarwinDylibNames;
24
25 buildInputs = [ blas lapack gfortran.cc.lib ];
26
27 doCheck = true;
28
29 # Test demo requires passing data and seed; numbers chosen arbitrarily.
30 postCheck = ''
31 ./out/demo_socp_indirect 42 0.42 0.42 42
32 '';
33
34 installPhase = ''
35 runHook preInstall
36 mkdir -p $out/lib
37 cp -r include $out/
38 cp out/*.a out/*.so out/*.dylib $out/lib/
39 runHook postInstall
40 '';
41
42 meta = with lib; {
43 description = "Splitting Conic Solver";
44 longDescription = ''
45 Numerical optimization package for solving large-scale convex cone problems
46 '';
47 homepage = "https://github.com/cvxgrp/scs";
48 license = licenses.mit;
49 platforms = platforms.all;
50 maintainers = [ maintainers.bhipple ];
51 };
52}