homebrew-core/Formula/hdf5@1.8.rb

106 lines
3.9 KiB
Ruby

class Hdf5AT18 < Formula
desc "File format designed to store large amounts of data"
homepage "https://www.hdfgroup.org/HDF5"
# NOTE: 1.8.23 is expected to be the last release for HDF5-1.8
# (see: https://portal.hdfgroup.org/display/support/HDF5%201.8.22#HDF51.8.22-futureFutureofHDF5-1.8).
url "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.22/src/hdf5-1.8.22.tar.bz2"
sha256 "689b88c6a5577b05d603541ce900545779c96d62b6f83d3f23f46559b48893a4"
revision 4
livecheck do
url "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/"
regex(%r{href=["']?hdf5[._-]v?(\d+(?:\.\d+)+)/?["' >]}i)
end
bottle do
rebuild 1
sha256 cellar: :any, arm64_ventura: "256b29e21285299abcf39b3c30245b7eeec4e35acfd20cbbd41f58f4dccb8f69"
sha256 cellar: :any, arm64_monterey: "18d3be813aa10a16e33d3d54553480280874c96d94232b7ec348f0382f682267"
sha256 cellar: :any, arm64_big_sur: "a8c32359ab98af7cfc8b718c028f051c6002cb01163843f33acf95e1d61a5753"
sha256 cellar: :any, ventura: "21269bba79eba8ccfc0038d39c733a97b91ac7e2f52461849fe4cf75adc13674"
sha256 cellar: :any, monterey: "454854d48dc24328a5c8b1447412c5e0395d135989790e2e14cb8426586080e8"
sha256 cellar: :any, big_sur: "8e4c4ec541b7cc9ac9211bc8517d4ba7ff6c1bf782ef5a25fd4a0188e118fc12"
sha256 cellar: :any_skip_relocation, x86_64_linux: "64281b1ce5dafd2828f11ace0bff36ee9005aa2e95393e8e1ffe6f4bb9f10c1f"
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"
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
--disable-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.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