2010-05-08 02:13:11 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2012-05-23 22:24:16 +00:00
|
|
|
class NetcdfCXX < Formula
|
|
|
|
homepage 'http://www.unidata.ucar.edu/software/netcdf'
|
|
|
|
url 'http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-cxx4-4.2.tar.gz'
|
2012-07-19 17:03:49 +00:00
|
|
|
sha1 '59628c9f06c211a47517fc00d8b068da159ffa9d'
|
2012-05-23 22:24:16 +00:00
|
|
|
end
|
|
|
|
|
2012-10-03 01:52:05 +00:00
|
|
|
class NetcdfCXX_compat < Formula
|
|
|
|
homepage 'http://www.unidata.ucar.edu/software/netcdf'
|
|
|
|
url 'http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-cxx-4.2.tar.gz'
|
|
|
|
sha1 'bab9b2d873acdddbdbf07ab35481cd0267a3363b'
|
|
|
|
end
|
|
|
|
|
2012-05-23 22:24:16 +00:00
|
|
|
class NetcdfFortran < Formula
|
|
|
|
homepage 'http://www.unidata.ucar.edu/software/netcdf'
|
|
|
|
url 'http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-fortran-4.2.tar.gz'
|
2012-07-19 17:03:49 +00:00
|
|
|
sha1 'f1887314455330f4057bc8eab432065f8f6f74ef'
|
2012-05-23 22:24:16 +00:00
|
|
|
end
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Netcdf < Formula
|
2012-05-23 22:24:16 +00:00
|
|
|
homepage 'http://www.unidata.ucar.edu/software/netcdf'
|
2012-08-18 22:08:19 +00:00
|
|
|
url 'http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-4.2.1.1.tar.gz'
|
|
|
|
sha1 '76631cb4e6b767c224338415cf6e5f5ff9bd1238'
|
2010-05-08 02:13:11 +00:00
|
|
|
|
2013-06-24 03:29:13 +00:00
|
|
|
depends_on :fortran if build.include? 'enable-fortran'
|
2010-05-08 02:13:11 +00:00
|
|
|
depends_on 'hdf5'
|
2010-08-08 17:05:32 +00:00
|
|
|
|
2012-10-03 01:52:05 +00:00
|
|
|
option 'enable-fortran', 'Compile Fortran bindings'
|
2012-08-18 22:08:19 +00:00
|
|
|
option 'disable-cxx', "Don't compile C++ bindings"
|
2012-10-03 01:52:05 +00:00
|
|
|
option 'enable-cxx-compat', 'Compile C++ bindings for compatibility'
|
2010-05-08 02:13:11 +00:00
|
|
|
|
|
|
|
def install
|
2012-08-18 22:08:19 +00:00
|
|
|
if build.include? 'enable-fortran'
|
2012-07-03 00:24:42 +00:00
|
|
|
# fix for ifort not accepting the --force-load argument, causing
|
|
|
|
# the library libnetcdff.dylib to be missing all the f90 symbols.
|
|
|
|
# http://www.unidata.ucar.edu/software/netcdf/docs/known_problems.html#intel-fortran-macosx
|
|
|
|
# https://github.com/mxcl/homebrew/issues/13050
|
2013-06-24 03:39:26 +00:00
|
|
|
ENV['lt_cv_ld_force_load'] = 'no' if ENV.fc == 'ifort'
|
2012-07-03 00:24:42 +00:00
|
|
|
end
|
2012-05-24 16:53:06 +00:00
|
|
|
|
2012-05-23 22:24:16 +00:00
|
|
|
common_args = %W[
|
|
|
|
--disable-dependency-tracking
|
|
|
|
--prefix=#{prefix}
|
|
|
|
--enable-static
|
|
|
|
--enable-shared
|
|
|
|
]
|
|
|
|
|
|
|
|
args = common_args.clone
|
2012-05-24 16:53:06 +00:00
|
|
|
args.concat %w[--enable-netcdf4 --disable-doxygen]
|
2012-05-23 22:24:16 +00:00
|
|
|
|
|
|
|
system './configure', *args
|
|
|
|
system 'make install'
|
|
|
|
|
|
|
|
# Add newly created installation to paths so that binding libraries can
|
|
|
|
# find the core libs.
|
2012-06-30 06:58:28 +00:00
|
|
|
ENV.prepend 'PATH', bin, ':'
|
2012-05-23 22:24:16 +00:00
|
|
|
ENV.prepend 'CPPFLAGS', "-I#{include}"
|
|
|
|
ENV.prepend 'LDFLAGS', "-L#{lib}"
|
|
|
|
|
|
|
|
NetcdfCXX.new.brew do
|
|
|
|
system './configure', *common_args
|
|
|
|
system 'make install'
|
2012-08-18 22:08:19 +00:00
|
|
|
end unless build.include? 'disable-cxx'
|
2012-05-23 22:24:16 +00:00
|
|
|
|
2012-10-03 01:52:05 +00:00
|
|
|
NetcdfCXX_compat.new.brew do
|
|
|
|
system './configure', *common_args
|
|
|
|
system 'make install'
|
|
|
|
end if build.include? 'enable-cxx-compat'
|
|
|
|
|
2012-05-23 22:24:16 +00:00
|
|
|
NetcdfFortran.new.brew do
|
|
|
|
system './configure', *common_args
|
|
|
|
system 'make install'
|
2012-08-18 22:08:19 +00:00
|
|
|
end if build.include? 'enable-fortran'
|
2010-05-08 02:13:11 +00:00
|
|
|
end
|
|
|
|
end
|