homebrew-core/Formula/gromacs.rb

61 lines
2.0 KiB
Ruby

class Gromacs < Formula
desc "Versatile package for molecular dynamics calculations"
homepage "http://www.gromacs.org/"
url "https://ftp.gromacs.org/pub/gromacs/gromacs-2020.4.tar.gz"
sha256 "5519690321b5500c7951aaf53ff624042c3edd1a5f5d6dd1f2d802a3ecdbf4e6"
livecheck do
url "https://ftp.gromacs.org/pub/gromacs/"
regex(/href=.*?gromacs[._-]v?(\d+(?:\.\d+)*)\.t/i)
end
bottle do
sha256 "1bcecb34934eadf23261f044280b1794a4a99cdd6b65f85e741a16b86b3b5d34" => :big_sur
sha256 "a47955588b6626afba661dd5a72b7b2e4669f28e59060ebfd9e033f2739ba56e" => :catalina
sha256 "3741e067b76102f12bd52d2a9f5cfb5ff2a437f60c09788f8a4cd2b066966cf9" => :mojave
sha256 "931193676d571f0418f11bf67885b2a0d0f5c94ce0e6f2bcd7f6f5910ec5ebd1" => :high_sierra
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