105 lines
3.7 KiB
Ruby
105 lines
3.7 KiB
Ruby
class Hdf5AT110 < Formula
|
|
desc "File format designed to store large amounts of data"
|
|
homepage "https://www.hdfgroup.org/HDF5"
|
|
url "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.8/src/hdf5-1.10.8.tar.bz2"
|
|
sha256 "66ec544b195a4cb9f6ffed034fd82e52429d6112747c2996ab69853f606e546b"
|
|
license "BSD-3-Clause"
|
|
revision 1
|
|
|
|
bottle do
|
|
rebuild 1
|
|
sha256 cellar: :any, arm64_ventura: "befeefbfcff47b7997ee6e7eda2369d5ee20a582eb78c58221c9570ed968c316"
|
|
sha256 cellar: :any, arm64_monterey: "490d7bc56417f31bf761bbc3dffd23c3123cf67099048fab728a27dc2a0684f1"
|
|
sha256 cellar: :any, arm64_big_sur: "6ffe3a34dfdefec620aa4ddab9a129e7960a1df5fad0199c5b1842a9b9dee1c8"
|
|
sha256 cellar: :any, ventura: "2be77115b4bc7fced0a2ecd5f5aea468ae5f70c3a4917971e87339d70d6d9cf5"
|
|
sha256 cellar: :any, monterey: "b634aa30af2ba672e9b240b12b6242ea87a17d1b64943d9434f2344432ebdc86"
|
|
sha256 cellar: :any, big_sur: "00ae5e5407ae574f2a9ae10ccb0d52de9a56650bde53c9328cc2e444a847b3f6"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "79a9c42606ceebd728d1c7d2373f0a117e0f45a3f64db6fc00d4dc57a23d7624"
|
|
end
|
|
|
|
keg_only :versioned_formula
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "libtool" => :build
|
|
depends_on "gcc" # for gfortran
|
|
depends_on "libaec"
|
|
|
|
uses_from_macos "zlib"
|
|
|
|
def install
|
|
inreplace %w[c++/src/h5c++.in fortran/src/h5fc.in bin/h5cc.in],
|
|
"${libdir}/libhdf5.settings",
|
|
"#{pkgshare}/libhdf5.settings"
|
|
|
|
inreplace "src/Makefile.am",
|
|
"settingsdir=$(libdir)",
|
|
"settingsdir=#{pkgshare}"
|
|
|
|
system "autoreconf", "--force", "--install", "--verbose"
|
|
|
|
args = %W[
|
|
--disable-dependency-tracking
|
|
--disable-silent-rules
|
|
--enable-build-mode=production
|
|
--enable-fortran
|
|
--enable-cxx
|
|
--prefix=#{prefix}
|
|
--with-szlib=#{Formula["libaec"].opt_prefix}
|
|
]
|
|
args << "--with-zlib=#{Formula["zlib"].opt_prefix}" if OS.linux?
|
|
|
|
system "./configure", *args
|
|
|
|
# Avoid shims in settings file
|
|
inreplace "src/libhdf5.settings", Superenv.shims_path/ENV.cxx, ENV.cxx
|
|
inreplace "src/libhdf5.settings", Superenv.shims_path/ENV.cc, ENV.cc
|
|
|
|
system "make", "install"
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.c").write <<~EOS
|
|
#include <stdio.h>
|
|
#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
|
|
|
|
(testpath/"test.f90").write <<~EOS
|
|
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
|