aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/hdf5.rb
blob: bbbb4b78ab76c0ccad69acdac3c18e5aa1dc5d34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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/hdf5-1.8.7/src/hdf5-1.8.7.tar.bz2'
  homepage 'http://www.hdfgroup.org/HDF5/'
  sha1 'be1daff26f066aca0b5be52d86dada6757fc4b95'
  version '1.8.7'

  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
    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