Created
October 16, 2013 22:18
-
-
Save dpo/7015914 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
class Ipopt < Formula | |
homepage 'https://projects.coin-or.org/Ipopt' | |
url 'http://www.coin-or.org/download/source/Ipopt/Ipopt-3.11.4.tgz' | |
sha1 '909a7073e3e83989d1a8c5aceba2d1a96dc262d2' | |
depends_on 'mumps' => :build | |
depends_on 'openblas' => :optional | |
depends_on 'asl' => :optional | |
depends_on 'metis4' => :optional | |
depends_on 'pkg-config' => :build | |
depends_on :fortran | |
def install | |
ENV.fortran | |
mumps_libs = ['-ldmumps', '-lmumps_common', '-lpord'] | |
# See whether the parallel or sequential MUMPS library was built. | |
opts = Tab.for_formula(Formula.factory('mumps')) | |
if opts.used_options.include? 'without-mpi' | |
mumps_libs << '-lmpiseq' | |
mumps_incdir = Formula.factory('mumps').libexec/'include' | |
else | |
# The MPI libs were installed as a MUMPS dependency. | |
mumps_libs += ['-lmpi_cxx', '-lmpi_f77'] | |
mumps_incdir = Formula.factory('mumps').include | |
end | |
mumps_libcmd = "-L#{Formula.factory('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.factory('openblas').include}" | |
args << "--with-blas-lib=-L#{Formula.factory('openblas').lib} -lopenblas" | |
args << "--with-lapack-incdir=#{Formula.factory('openblas').include}" | |
args << "--with-lapack-lib=-L#{Formula.factory('openblas').lib} -lopenblas" | |
end | |
if build.with? 'asl' | |
args << "--with-asl-incdir=#{Formula.factory('asl').include}/asl" | |
args << "--with-asl-lib=-L#{Formula.factory('asl').lib} -lasl -lfuncadd0" | |
end | |
if build.with? 'metis4' | |
args << "--with-metis-incdir=#{Formula.factory('metis4').include}" | |
args << "--with-metis-lib='-L#{Formula.factory('metis4').lib} -lmetis'" | |
end | |
system "./configure", *args | |
system "make" | |
ENV.deparallelize # Needs a serialized install | |
system "make test" | |
system "make install" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pkg-config should be optional - if it's available, then Ipopt configure will use it, but if not Ipopt can still build.
I'm having some interesting link failures with Ipopt 3.11.5 in OS X Mavericks when I configure for an entirely-static build (
--disable-shared
, which makes life easier when it comes to Matlab)Edit: Found a fix for the latter, libtool was doing some strange translations of the link line, replacing
-lstdc++
with the full path to the version of libstdc++.dylib inside the homebrew copy of gfortran. Since the system compilers (which I used to build the C/C++ parts of Ipopt) in Mavericks aren't GCC at all, this breaks all the C++ linking. SpecifyingCXXLIBS=-lc++
fixed it, might need to tweak that section in COIN-OR BuildUtils appropriately.