forked from ahmadia/homebrew-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathipopt.rb
67 lines (55 loc) · 2.28 KB
/
ipopt.rb
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
require 'formula'
class Ipopt < Formula
homepage 'https://projects.coin-or.org/Ipopt'
url 'http://www.coin-or.org/download/source/Ipopt/Ipopt-3.11.8.tgz'
sha1 '530d718fb5a0c994c305deb3bcfdacc16cc0e2ef'
head 'https://projects.coin-or.org/svn/Ipopt/trunk', :using => :svn
option 'without-check', 'Skip build-time tests (not recommended)'
depends_on 'asl' => :recommended
depends_on 'openblas' => :optional
depends_on 'pkg-config' => :build
depends_on 'mumps' => (build.with? 'openblas') ? ['with-openblas'] : :build
depends_on :fortran
def mumps_options
Tab.for_formula(Formula["mumps"]).used_options
end
def install
ENV.delete('MPICC') # configure will pick these up and use them to link
ENV.delete('MPIFC') # which leads to the linker crashing.
ENV.delete('MPICXX')
mumps_libs = %w[-ldmumps -lmumps_common -lpord]
# See whether the parallel or sequential MUMPS library was built.
if mumps_options.include? 'without-mpi'
mumps_libs << '-lmpiseq'
mumps_incdir = Formula["mumps"].libexec / 'include'
else
# The MPI libs were installed as a MUMPS dependency.
mumps_libs += %w[-lmpi_cxx -lmpi_mpifh]
mumps_incdir = Formula["mumps"].include
ENV.append_to_cflags "-DHAVE_MPI_INITIALIZED" # Mumps initializes MPI.
end
mumps_libcmd = "-L#{Formula["mumps"].lib} " + mumps_libs.join(' ')
args = ["--disable-debug",
"--disable-dependency-tracking",
"--prefix=#{prefix}",
"--with-mumps-incdir=#{mumps_incdir}",
"--with-mumps-lib=#{mumps_libcmd}",
"--enable-shared",
"--enable-static"]
if build.with? 'openblas'
args << "--with-blas-incdir=#{Formula["openblas"].include}"
args << "--with-blas-lib=-L#{Formula["openblas"].lib} -lopenblas"
args << "--with-lapack-incdir=#{Formula["openblas"].include}"
args << "--with-lapack-lib=-L#{Formula["openblas"].lib} -lopenblas"
end
if build.with? 'asl'
args << "--with-asl-incdir=#{Formula["asl"].include}/asl"
args << "--with-asl-lib=-L#{Formula["asl"].lib} -lasl -lfuncadd0"
end
system "./configure", *args
system "make"
ENV.deparallelize # Needs a serialized install
system "make test" if build.with? "check"
system "make install"
end
end