forked from ahmadia/homebrew-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hdf5.rb
57 lines (50 loc) · 1.79 KB
/
hdf5.rb
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
46
47
48
49
50
51
52
53
54
55
56
57
require 'formula'
class Hdf5 < Formula
homepage 'http://www.hdfgroup.org/HDF5'
url 'http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8.12/src/hdf5-1.8.12.tar.bz2'
sha1 '8414ca0e6ff7d08e423955960d641ec5f309a55f'
# TODO - warn that these options conflict
option :universal
option 'enable-fortran', 'Compile Fortran bindings'
option 'enable-cxx', 'Compile C++ bindings'
option 'enable-threadsafe', 'Trade performance and C++ or Fortran support for thread safety'
option 'enable-parallel', 'Compile parallel bindings'
option 'enable-fortran2003', 'Compile Fortran 2003 bindings. Requires enable-fortran.'
option :cxx11
depends_on :fortran if build.include? 'enable-fortran' or build.include? 'enable-fortran2003'
depends_on 'szip'
depends_on :mpi => [:cc, :cxx, :f90] if build.include? "enable-parallel"
def install
ENV.universal_binary if build.universal?
ENV.cxx11 if build.cxx11?
args = %W[
--prefix=#{prefix}
--enable-production
--enable-debug=no
--disable-dependency-tracking
--with-zlib=/usr
--with-szlib=#{HOMEBREW_PREFIX}
--enable-filters=all
--enable-static=yes
--enable-shared=yes
]
args << '--enable-parallel' if build.include? 'enable-parallel'
if build.include? 'enable-threadsafe'
args.concat %w[--with-pthread=/usr --enable-threadsafe]
else
if build.include? 'enable-cxx'
args << '--enable-cxx'
end
if build.include? 'enable-fortran' or build.include? 'enable-fortran2003'
args << '--enable-fortran'
args << '--enable-fortran2003' if build.include? 'enable-fortran2003'
end
end
if build.include? 'enable-parallel'
ENV['CC'] = 'mpicc'
ENV['FC'] = 'mpif90'
end
system "./configure", *args
system "make install"
end
end