homebrew-core/Formula/gromacs.rb

61 lines
2.0 KiB
Ruby

class Gromacs < Formula
desc "Versatile package for molecular dynamics calculations"
homepage "https://www.gromacs.org/"
url "https://ftp.gromacs.org/pub/gromacs/gromacs-2021.tar.gz"
sha256 "efa78ab8409b0f5bf0fbca174fb8fbcf012815326b5c71a9d7c385cde9a8f87b"
livecheck do
url "https://ftp.gromacs.org/pub/gromacs/"
regex(/href=.*?gromacs[._-]v?(\d+(?:\.\d+)*)\.t/i)
end
bottle do
sha256 arm64_big_sur: "217825d39e125e97af17405a9617386bea4db7efdb6a7698cb86b0972212f9f9"
sha256 big_sur: "6e77d33e5f9daa524601bdb6c298758290b42be4fb481f102161a33acad07df8"
sha256 catalina: "231561edcfb1afb096727fdac62a2ccb72e1d54e1adf015e77cd4aa93ad16bd5"
sha256 mojave: "e34650e543535f254bbe425a5d44f0d7f903b987d1011f8624c976767d91872f"
end
depends_on "cmake" => :build
depends_on "fftw"
depends_on "gcc" # for OpenMP
depends_on "openblas"
def install
# Non-executable GMXRC files should be installed in DATADIR
inreplace "scripts/CMakeLists.txt", "CMAKE_INSTALL_BINDIR",
"CMAKE_INSTALL_DATADIR"
# Avoid superenv shim reference
inreplace "src/gromacs/gromacs-toolchain.cmake.cmakein", "@CMAKE_LINKER@",
"/usr/bin/ld"
gcc_major_ver = Formula["gcc"].any_installed_version.major
args = std_cmake_args + %W[
-DCMAKE_C_COMPILER=gcc-#{gcc_major_ver}
-DCMAKE_CXX_COMPILER=g++-#{gcc_major_ver}
]
mkdir "build" do
system "cmake", "..", *args
system "make", "install"
end
bash_completion.install "build/scripts/GMXRC" => "gromacs-completion.bash"
bash_completion.install "#{bin}/gmx-completion-gmx.bash" => "gmx-completion-gmx.bash"
bash_completion.install "#{bin}/gmx-completion.bash" => "gmx-completion.bash"
zsh_completion.install "build/scripts/GMXRC.zsh" => "_gromacs"
end
def caveats
<<~EOS
GMXRC and other scripts installed to:
#{HOMEBREW_PREFIX}/share/gromacs
EOS
end
test do
system "#{bin}/gmx", "help"
end
end