class Hdf5 < Formula desc "File format designed to store large amounts of data" homepage "https://www.hdfgroup.org/HDF5" url "https://www.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.1/src/hdf5-1.10.1.tar.bz2" sha256 "9c5ce1e33d2463fb1a42dd04daacbc22104e57676e2204e3d66b1ef54b88ebf2" revision 1 bottle do sha256 "23036072b3ae09d944d5dd202d424a1664f789373314ef6e2e150a7a48f31b85" => :sierra sha256 "4d162fc09c0816911e8d79b875c991498c320146b48c126b6de68689efe9c107" => :el_capitan sha256 "837619f72eefccde1fb4a0fd91031d0a14ec3eadcf60fadc888dfcedd1fce774" => :yosemite end deprecated_option "enable-fortran" => "with-fortran" deprecated_option "enable-parallel" => "with-mpi" option :cxx11 depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build depends_on "szip" depends_on :fortran => :optional depends_on :mpi => [:optional, :cc, :cxx, :f90] def install ENV.cxx11 if build.cxx11? inreplace %w[c++/src/h5c++.in fortran/src/h5fc.in tools/src/misc/h5cc.in], "${libdir}/libhdf5.settings", "#{pkgshare}/libhdf5.settings" inreplace "src/Makefile.am", "settingsdir=$(libdir)", "settingsdir=#{pkgshare}" system "autoreconf", "-fiv" args = %W[ --disable-dependency-tracking --disable-silent-rules --prefix=#{prefix} --with-szlib=#{Formula["szip"].opt_prefix} --enable-build-mode=production ] if build.without?("mpi") args << "--enable-cxx" else args << "--disable-cxx" end if build.with? "fortran" args << "--enable-fortran" else args << "--disable-fortran" end if build.with? "mpi" ENV["CC"] = ENV["MPICC"] ENV["CXX"] = ENV["MPICXX"] ENV["FC"] = ENV["MPIFC"] args << "--enable-parallel" end system "./configure", *args system "make", "install" end test do (testpath/"test.c").write <<-EOS.undent #include #include "hdf5.h" int main() { printf("%d.%d.%d\\n", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); return 0; } EOS system "#{bin}/h5cc", "test.c" assert_equal version.to_s, shell_output("./a.out").chomp end end