hdf5: build with fortran by default
Closes #16430. Signed-off-by: ilovezfs <ilovezfs@icloud.com>
This commit is contained in:
parent
a175cd0afa
commit
a71c8ea0ac
1 changed files with 33 additions and 9 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue