aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/hdf5.rb
diff options
context:
space:
mode:
authorCharlie Sharpsteen2011-04-01 13:43:30 -0700
committerAdam Vandenberg2011-04-01 14:25:10 -0700
commit372cdd8f68cd0d3db8a383f9b1f3eba98e532b8a (patch)
tree5a59ea2a5876b9a1ff9783e59a70018775af9bcb /Library/Formula/hdf5.rb
parent165dbf7e89a56b14434e64ed28b3fcc54319954a (diff)
downloadhomebrew-372cdd8f68cd0d3db8a383f9b1f3eba98e532b8a.tar.bz2
Refactor HDF5 formula
Some changes to the way HDF5 is configured: * The SZIP dependency is actually used * C++ bindings are compiled by default as it requires no additional dependencies. New formula options: * Build Fortran bindings although this disables the production of shared libraries. * Build a threadsafe HDF5 library, although this disables C++ and Fortran bindings and causes a performance hit. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library/Formula/hdf5.rb')
-rw-r--r--Library/Formula/hdf5.rb32
1 files changed, 31 insertions, 1 deletions
diff --git a/Library/Formula/hdf5.rb b/Library/Formula/hdf5.rb
index e0c1f5353..eafbfeb80 100644
--- a/Library/Formula/hdf5.rb
+++ b/Library/Formula/hdf5.rb
@@ -1,5 +1,13 @@
require 'formula'
+def fortran?
+ ARGV.include? '--enable-fortran'
+end
+
+def threadsafe?
+ ARGV.include? '--enable-threadsafe'
+end
+
class Hdf5 < Formula
url 'http://www.hdfgroup.org/ftp/HDF5/current/src/hdf5-1.8.6.tar.bz2'
homepage 'http://www.hdfgroup.org/HDF5/'
@@ -8,8 +16,30 @@ class Hdf5 < Formula
depends_on 'szip'
+ def options
+ [
+ ['--enable-fortran', 'Compile Fortran bindings at the expense of having shared libraries'],
+ ['--enable-threadsafe', 'Trade performance and C++ or Fortran support for thread safety']
+ ]
+ end
+
def install
- system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking"
+ ENV.fortran if fortran?
+
+ args = [
+ "--prefix=#{prefix}",
+ '--disable-debug',
+ '--disable-dependency-tracking',
+ '--enable-production',
+ '--with-zlib=yes',
+ '--with-szlib=yes',
+ '--enable-filters=all'
+ ]
+ args.concat ['--with-pthread=/usr', '--enable-threadsafe'] if threadsafe?
+ args << '--enable-cxx' unless threadsafe?
+ args << '--enable-fortran' if fortran? and not threadsafe?
+
+ system "./configure", *args
system "make install"
end
end