1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
  | 
require 'formula'
class SuiteSparse <Formula
  url 'http://www.cise.ufl.edu/research/sparse/SuiteSparse/SuiteSparse-3.4.0.tar.gz'
  homepage 'http://www.cise.ufl.edu/research/sparse/SuiteSparse/'
  md5 'e59dcabc9173b1ba1b3659ae147006b8'
  depends_on "metis"
  depends_on "tbb"
  def patches
    { :p1 => DATA }
  end
  def install
    # SuiteSparse doesn't like to build in parallel
    ENV.deparallelize
    # Statically link libmetis
    metis = Formula.factory("metis")
    ENV["HOMEBREW_METIS"] = "#{metis.lib}/libmetis.a"
    # So, SuiteSparse was written by a scientific researcher.  This
    # tends to result in makefile-based build systems that are completely
    # ignorant of the existance of things such as CPPFLAGS and LDFLAGS.
    # SuiteSparse Does The Right Thing™ when homebrew is in /usr/local
    # but if it is not, we have to piggyback some stuff in on CFLAGS.
    unless HOMEBREW_PREFIX.to_s == '/usr/local'
      ENV['CFLAGS'] += " -isystem #{HOMEBREW_PREFIX}/include -L#{HOMEBREW_PREFIX}/lib"
    end
    system "make"
    lib.install Dir['*/Lib/*.a']
    include.install Dir['*/Include/*.h']
    include.install 'UFconfig/UFconfig.h'
  end
end
__END__
Patch to the SuiteSparse master Make configuration file.
Ensures SuiteSparse builds against Hombrew's copy of metis
and uses Hombrew environment variables related to compilation.
diff --git a/UFconfig/UFconfig.mk b/UFconfig/UFconfig.mk
index bda4c7b..84a878b 100644
--- a/UFconfig/UFconfig.mk
+++ b/UFconfig/UFconfig.mk
@@ -33,11 +33,11 @@
 # C compiler and compiler flags:  These will normally not give you optimal
 # performance.  You should select the optimization parameters that are best
 # for your system.  On Linux, use "CFLAGS = -O3 -fexceptions" for example.
-CC = cc
+# CC = cc
 # CFLAGS = -O   (for example; see below for details)
 
 # C++ compiler (also uses CFLAGS)
-CPLUSPLUS = g++
+CPLUSPLUS = $(CXX)
 
 # ranlib, and ar, for generating libraries
 RANLIB = ranlib
@@ -49,11 +49,11 @@ MV = mv -f
 
 # Fortran compiler (not normally required)
 F77 = f77
-F77FLAGS = -O
+F77FLAGS = $(FCFLAGS)
 F77LIB =
 
 # C and Fortran libraries
-LIB = -lm
+LIB = -lm -lstdc++ $(LDFLAGS)
 
 # For compiling MATLAB mexFunctions (MATLAB 7.5 or later)
 MEX = mex -O -largeArrayDims -lmwlapack -lmwblas
@@ -89,8 +89,8 @@ MEX = mex -O -largeArrayDims -lmwlapack -lmwblas
 # BLAS = -lgoto -lgfortran -lgfortranbegin -lg2c
 
 # This is probably slow ... it might connect to the Standard Reference BLAS:
-BLAS = -lblas -lgfortran -lgfortranbegin -lg2c
-LAPACK = -llapack
+BLAS = -Wl,-framework -Wl,Accelerate
+LAPACK = $(BLAS)
 
 # Using non-optimized versions:
 # BLAS = -lblas_plain -lgfortran -lgfortranbegin -lg2c
@@ -122,8 +122,8 @@ XERBLA =
 # The path is relative to where it is used, in CHOLMOD/Lib, CHOLMOD/MATLAB, etc.
 # You may wish to use an absolute path.  METIS is optional.  Compile
 # CHOLMOD with -DNPARTITION if you do not wish to use METIS.
-METIS_PATH = ../../metis-4.0
-METIS = ../../metis-4.0/libmetis.a
+METIS_PATH =
+METIS = $(HOMEBREW_METIS)
 
 # If you use CHOLMOD_CONFIG = -DNPARTITION then you must use the following
 # options:
@@ -198,16 +198,16 @@ CHOLMOD_CONFIG =
 # -DHAVE_TBB        enable the use of Intel's Threading Building Blocks (TBB)
 
 # default, without timing, without TBB:
-SPQR_CONFIG =
+SPQR_CONFIG = -DHAVE_TBB
 # with timing and TBB:
 # SPQR_CONFIG = -DTIMING -DHAVE_TBB
 # with timing
 # SPQR_CONFIG = -DTIMING
 
 # with TBB, you must select this:
-# TBB = -ltbb
+TBB = -ltbb
 # without TBB:
-TBB =
+# TBB =
 
 # with timing, you must include the timing library:
 # RTLIB = -lrt
@@ -220,7 +220,7 @@ RTLIB =
 
 # Using default compilers:
 # CC = gcc
-CFLAGS = -O3 -fexceptions
+# CFLAGS = -O3 -fexceptions
 
 # alternatives:
 # CFLAGS = -g -fexceptions \
  |