Skip to content

Instantly share code, notes, and snippets.

@nickloman
Last active August 29, 2015 14:02
Show Gist options
  • Save nickloman/8c5cd8befb7239d859d3 to your computer and use it in GitHub Desktop.
Save nickloman/8c5cd8befb7239d859d3 to your computer and use it in GitHub Desktop.
hdf5.rb
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'
version '1.8.12'
# 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'
depends_on 'szip'
depends_on MPIDependency.new(:cc, :cxx, :f90) if build.include? "enable-parallel"
def install
ENV.universal_binary if build.universal?
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'
args << '--enable-fortran'
ENV.fortran
end
end
if build.include? 'enable-parallel'
ENV['CC'] = 'mpicc'
ENV['FC'] = 'mpif90'
end
system "./configure", *args
system "make install"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment