2011-02-18 02:20:13 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2012-09-05 04:04:01 +00:00
|
|
|
# Leading underscore because this method is defined differently
|
|
|
|
# in compat, and anything that loads this file would end up with
|
|
|
|
# this definition instead!
|
|
|
|
def _snow_leopard_64?
|
2011-08-29 19:36:04 +00:00
|
|
|
# 64 bit builds on 10.6 require some special handling.
|
2012-09-04 23:15:31 +00:00
|
|
|
MacOS.version == :snow_leopard and MacOS.prefer_64_bit?
|
2011-08-29 19:36:04 +00:00
|
|
|
end
|
|
|
|
|
2011-03-21 20:02:58 +00:00
|
|
|
class Octave < Formula
|
2011-02-18 02:20:13 +00:00
|
|
|
homepage 'http://www.gnu.org/software/octave/index.html'
|
2012-06-10 01:31:11 +00:00
|
|
|
url 'http://ftpmirror.gnu.org/octave/octave-3.6.2.tar.bz2'
|
|
|
|
mirror 'http://ftp.gnu.org/gnu/octave/octave-3.6.2.tar.bz2'
|
|
|
|
sha1 '145fef0122268086727a60e1c33e29d56fd546d7'
|
2011-02-18 02:20:13 +00:00
|
|
|
|
2012-09-06 04:05:21 +00:00
|
|
|
option 'without-graphicsmagick', 'Compile without GraphicsMagick'
|
|
|
|
option 'without-fltk', 'Compile without fltk (disables native graphics)'
|
|
|
|
option 'test', 'Run tests before installing'
|
|
|
|
|
2011-03-25 15:15:12 +00:00
|
|
|
depends_on 'pkg-config' => :build
|
2011-02-18 02:20:13 +00:00
|
|
|
depends_on 'gnu-sed' => :build
|
2011-03-21 20:02:58 +00:00
|
|
|
depends_on 'texinfo' => :build # OS X's makeinfo won't work for this
|
|
|
|
|
2012-06-07 01:35:12 +00:00
|
|
|
depends_on :x11
|
2011-02-18 02:20:13 +00:00
|
|
|
depends_on 'fftw'
|
2011-08-29 19:36:04 +00:00
|
|
|
# When building 64-bit binaries on Snow Leopard, there are naming issues with
|
|
|
|
# the dot product functions in the BLAS library provided by Apple's
|
|
|
|
# Accelerate framework. See the following thread for the gory details:
|
|
|
|
#
|
2011-02-18 02:20:13 +00:00
|
|
|
# http://www.macresearch.org/lapackblas-fortran-106
|
2011-08-29 19:36:04 +00:00
|
|
|
#
|
|
|
|
# We can work around the issues using dotwrp.
|
2012-09-05 04:04:01 +00:00
|
|
|
depends_on 'dotwrp' if _snow_leopard_64?
|
2011-02-18 02:20:13 +00:00
|
|
|
# octave refuses to work with BSD readline, so it's either this or --disable-readline
|
|
|
|
depends_on 'readline'
|
2012-09-05 04:04:01 +00:00
|
|
|
depends_on 'curl' if MacOS.version == :leopard # Leopard's libcurl is too old
|
2011-02-18 02:20:13 +00:00
|
|
|
|
|
|
|
# additional features
|
|
|
|
depends_on 'suite-sparse'
|
|
|
|
depends_on 'glpk'
|
2012-09-06 04:05:21 +00:00
|
|
|
depends_on 'graphicsmagick' => :recommended unless build.include? 'without-graphicsmagick'
|
2011-02-18 02:20:13 +00:00
|
|
|
depends_on 'hdf5'
|
|
|
|
depends_on 'pcre'
|
|
|
|
depends_on 'qhull'
|
|
|
|
depends_on 'qrupdate'
|
|
|
|
|
2012-09-06 04:05:21 +00:00
|
|
|
if build.include? 'without-fltk'
|
|
|
|
# required for plotting if we don't have native graphics
|
|
|
|
depends_on 'gnuplot'
|
|
|
|
else
|
|
|
|
depends_on 'fltk'
|
2011-02-18 02:20:13 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
|
|
|
ENV.fortran
|
|
|
|
|
|
|
|
# yes, compiling octave takes a long time, but using -O2 gives negligible savings
|
|
|
|
# build time with -O2: user 58m5.295s sys 7m29.064s
|
|
|
|
# build time with -O3: user 58m58.054s sys 7m52.221s
|
2011-08-29 19:36:04 +00:00
|
|
|
ENV.m64 if MacOS.prefer_64_bit?
|
2011-02-18 02:20:13 +00:00
|
|
|
ENV.append_to_cflags "-D_REENTRANT"
|
|
|
|
|
2011-08-29 19:36:04 +00:00
|
|
|
args = [
|
|
|
|
"--disable-dependency-tracking",
|
|
|
|
"--prefix=#{prefix}",
|
2012-05-14 03:41:37 +00:00
|
|
|
# Cant use `-framework Accelerate` because `mkoctfile`, the tool used to
|
|
|
|
# compile extension packages, can't parse `-framework` flags.
|
2012-09-05 04:04:01 +00:00
|
|
|
"--with-blas=#{'-ldotwrp ' if _snow_leopard_64?}-Wl,-framework -Wl,Accelerate",
|
2012-08-30 19:50:07 +00:00
|
|
|
# SuiteSparse-4.x.x fix, see http://savannah.gnu.org/bugs/?37031
|
|
|
|
"--with-umfpack=-lumfpack -lsuitesparseconfig",
|
2011-08-29 19:36:04 +00:00
|
|
|
]
|
2012-09-05 04:04:01 +00:00
|
|
|
args << "--without-framework-carbon" if MacOS.version >= :lion
|
2012-04-18 02:15:47 +00:00
|
|
|
# avoid spurious 'invalid assignment to cs-list' erorrs on 32 bit installs:
|
2012-09-01 01:49:16 +00:00
|
|
|
args << 'CXXFLAGS=-O0' unless MacOS.prefer_64_bit?
|
2011-02-18 02:20:13 +00:00
|
|
|
|
2011-08-29 19:36:04 +00:00
|
|
|
system "./configure", *args
|
2011-02-18 02:20:13 +00:00
|
|
|
system "make all"
|
2012-09-06 04:05:21 +00:00
|
|
|
system "make check 2>&1 | tee make-check.log" if build.include? 'test'
|
2011-02-18 02:20:13 +00:00
|
|
|
system "make install"
|
2012-09-06 04:05:21 +00:00
|
|
|
|
|
|
|
prefix.install ["test/fntests.log", "make-check.log"] if build.include? 'test'
|
2011-02-18 02:20:13 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def caveats
|
|
|
|
native_caveats = <<-EOS.undent
|
2012-03-17 02:55:47 +00:00
|
|
|
Octave supports "native" plotting using OpenGL and FLTK. You can activate
|
2011-02-18 02:20:13 +00:00
|
|
|
it for all future figures using the Octave command
|
|
|
|
|
|
|
|
graphics_toolkit ("fltk")
|
|
|
|
|
|
|
|
or for a specific figure handle h using
|
|
|
|
|
|
|
|
graphics_toolkit (h, "fltk")
|
|
|
|
|
|
|
|
Otherwise, gnuplot is still used by default, if available.
|
|
|
|
EOS
|
|
|
|
|
|
|
|
gnuplot_caveats = <<-EOS.undent
|
|
|
|
When plotting with gnuplot, you should set "GNUTERM=x11" before running octave;
|
|
|
|
if you are using Aquaterm, use "GNUTERM=aqua".
|
|
|
|
EOS
|
|
|
|
|
|
|
|
s = gnuplot_caveats
|
2012-09-06 04:05:21 +00:00
|
|
|
s = native_caveats + s unless build.include? 'without-fltk'
|
2011-02-18 02:20:13 +00:00
|
|
|
end
|
|
|
|
end
|