From a71c8ea0acfdec287e9cb120fdc90460d953dafc Mon Sep 17 00:00:00 2001 From: Michka Popoff Date: Sat, 5 Aug 2017 10:59:30 +0200 Subject: [PATCH] hdf5: build with fortran by default Closes #16430. Signed-off-by: ilovezfs --- Formula/hdf5.rb | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/Formula/hdf5.rb b/Formula/hdf5.rb index 4d295f9eec..060c1eb075 100644 --- a/Formula/hdf5.rb +++ b/Formula/hdf5.rb @@ -3,7 +3,7 @@ class Hdf5 < Formula 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 + revision 2 bottle do sha256 "23036072b3ae09d944d5dd202d424a1664f789373314ef6e2e150a7a48f31b85" => :sierra @@ -11,7 +11,6 @@ class Hdf5 < Formula sha256 "837619f72eefccde1fb4a0fd91031d0a14ec3eadcf60fadc888dfcedd1fce774" => :yosemite end - deprecated_option "enable-fortran" => "with-fortran" deprecated_option "enable-parallel" => "with-mpi" option :cxx11 @@ -20,7 +19,7 @@ class Hdf5 < Formula depends_on "automake" => :build depends_on "libtool" => :build depends_on "szip" - depends_on :fortran => :optional + depends_on :fortran depends_on :mpi => [:optional, :cc, :cxx, :f90] def install @@ -39,6 +38,7 @@ class Hdf5 < Formula --prefix=#{prefix} --with-szlib=#{Formula["szip"].opt_prefix} --enable-build-mode=production + --enable-fortran ] if build.without?("mpi") @@ -47,12 +47,6 @@ class Hdf5 < Formula 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"] @@ -77,5 +71,35 @@ class Hdf5 < Formula EOS system "#{bin}/h5cc", "test.c" assert_equal version.to_s, shell_output("./a.out").chomp + + (testpath/"test.f90").write <<-EOS.undent + use hdf5 + integer(hid_t) :: f, dspace, dset + integer(hsize_t), dimension(2) :: dims = [2, 2] + integer :: error = 0, major, minor, rel + + call h5open_f (error) + if (error /= 0) call abort + call h5fcreate_f ("test.h5", H5F_ACC_TRUNC_F, f, error) + if (error /= 0) call abort + call h5screate_simple_f (2, dims, dspace, error) + if (error /= 0) call abort + call h5dcreate_f (f, "data", H5T_NATIVE_INTEGER, dspace, dset, error) + if (error /= 0) call abort + call h5dclose_f (dset, error) + if (error /= 0) call abort + call h5sclose_f (dspace, error) + if (error /= 0) call abort + call h5fclose_f (f, error) + if (error /= 0) call abort + call h5close_f (error) + if (error /= 0) call abort + CALL h5get_libversion_f (major, minor, rel, error) + if (error /= 0) call abort + write (*,"(I0,'.',I0,'.',I0)") major, minor, rel + end + EOS + system "#{bin}/h5fc", "test.f90" + assert_equal version.to_s, shell_output("./a.out").chomp end end