2010-05-08 02:13:11 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-04-01 19:27:38 +00:00
|
|
|
def fortran?
|
|
|
|
ARGV.include? '--enable-fortran'
|
|
|
|
end
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Netcdf < Formula
|
2011-04-01 19:27:38 +00:00
|
|
|
url 'http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-4.1.2.tar.gz'
|
2010-05-08 02:13:11 +00:00
|
|
|
homepage 'http://www.unidata.ucar.edu/software/netcdf/'
|
2011-04-01 19:27:38 +00:00
|
|
|
md5 '4a94ebe2d998d649159aa5665c83fb1a'
|
2010-05-08 02:13:11 +00:00
|
|
|
|
|
|
|
depends_on 'hdf5'
|
2010-08-08 17:05:32 +00:00
|
|
|
|
|
|
|
def options
|
2011-04-01 19:27:38 +00:00
|
|
|
[['--enable-fortran', 'Compile Fortran bindings']]
|
2010-08-08 17:05:32 +00:00
|
|
|
end
|
2010-05-08 02:13:11 +00:00
|
|
|
|
|
|
|
def install
|
2011-04-01 19:27:38 +00:00
|
|
|
ENV.fortran if fortran?
|
2011-04-01 23:10:43 +00:00
|
|
|
ENV.append 'LDFLAGS', '-lsz' # So configure finds szip during HDF5 tests
|
2011-04-01 19:27:38 +00:00
|
|
|
|
2010-08-08 17:05:32 +00:00
|
|
|
# HDF5 is required to create and access files in the version 4 format
|
2011-04-01 19:27:38 +00:00
|
|
|
hdf5 = Formula.factory 'hdf5'
|
2010-05-08 02:13:11 +00:00
|
|
|
|
2010-08-08 17:05:32 +00:00
|
|
|
args = ["--disable-dependency-tracking",
|
|
|
|
"--prefix=#{prefix}",
|
|
|
|
"--with-hdf5=#{hdf5.prefix}",
|
|
|
|
"--enable-netcdf4",
|
2011-04-01 23:10:43 +00:00
|
|
|
"--enable-shared",
|
|
|
|
"--with-szlib=#{HOMEBREW_PREFIX}"]
|
2011-04-01 19:27:38 +00:00
|
|
|
args << "--disable-fortran" unless fortran?
|
2010-08-08 17:05:32 +00:00
|
|
|
|
|
|
|
system "./configure", *args
|
2010-05-08 02:13:11 +00:00
|
|
|
system "make install"
|
|
|
|
end
|
|
|
|
end
|