85 lines
3.0 KiB
Ruby
85 lines
3.0 KiB
Ruby
class Rdkit < Formula
|
|
desc "Open-source chemoinformatics library"
|
|
homepage "https://rdkit.org/"
|
|
url "https://github.com/rdkit/rdkit/archive/Release_2021_03_1.tar.gz"
|
|
sha256 "9495f797a54ac70b3b6e12776de7d82acd7f7b5d5f0cc1f168c763215545610b"
|
|
license "BSD-3-Clause"
|
|
head "https://github.com/rdkit/rdkit.git"
|
|
|
|
bottle do
|
|
sha256 arm64_big_sur: "b3c25f8041b97feb1d44b0881ade496bc030ef7cd7bb472b0e5f2f3ed15c70e5"
|
|
sha256 big_sur: "b858bd08a423315f15f0e261730488fe1e303734ab07cc8ca31d9dfb10272f6d"
|
|
sha256 catalina: "a809feb8d0cff4c9c1a357d7e434de5cefc42e254ea47d65079e6c72d4322ad8"
|
|
sha256 mojave: "e5aaf566b2d5a33553bc626eb99e785da5359a1e803d3abbeb86501804f9ffb7"
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "swig" => :build
|
|
depends_on "boost"
|
|
depends_on "boost-python3"
|
|
depends_on "eigen"
|
|
depends_on "freetype"
|
|
depends_on "numpy"
|
|
depends_on "postgresql"
|
|
depends_on "py3cairo"
|
|
depends_on "python@3.9"
|
|
|
|
def install
|
|
ENV.cxx11
|
|
ENV.libcxx
|
|
ENV.append "CFLAGS", "-Wno-parentheses -Wno-logical-op-parentheses -Wno-format"
|
|
ENV.append "CXXFLAGS", "-Wno-parentheses -Wno-logical-op-parentheses -Wno-format"
|
|
|
|
# Get Python location
|
|
python_executable = Formula["python@3.9"].opt_bin/"python3"
|
|
py3ver = Language::Python.major_minor_version Formula["python@3.9"].opt_bin/"python3"
|
|
py3prefix = Formula["python@3.9"].opt_frameworks/"Python.framework/Versions/#{py3ver}"
|
|
on_linux do
|
|
py3prefix = Formula["python@3.9"].opt_prefix
|
|
end
|
|
py3include = "#{py3prefix}/include/python#{py3ver}"
|
|
numpy_include = Formula["numpy"].opt_lib/"python#{py3ver}/site-packages/numpy/core/include"
|
|
|
|
# set -DMAEPARSER and COORDGEN_FORCE_BUILD=ON to avoid conflicts with some formulae i.e. open-babel
|
|
args = std_cmake_args + %W[
|
|
-DCMAKE_INSTALL_RPATH=#{opt_lib}
|
|
-DRDK_INSTALL_INTREE=OFF
|
|
-DRDK_BUILD_SWIG_WRAPPERS=OFF
|
|
-DRDK_BUILD_AVALON_SUPPORT=ON
|
|
-DRDK_BUILD_PGSQL=ON
|
|
-DRDK_PGSQL_STATIC=ON
|
|
-DMAEPARSER_FORCE_BUILD=ON
|
|
-DCOORDGEN_FORCE_BUILD=ON
|
|
-DRDK_BUILD_INCHI_SUPPORT=ON
|
|
-DRDK_BUILD_CPP_TESTS=OFF
|
|
-DRDK_INSTALL_STATIC_LIBS=OFF
|
|
-DRDK_BUILD_CAIRO_SUPPORT=ON
|
|
-DRDK_BUILD_YAEHMOP_SUPPORT=ON
|
|
-DRDK_BUILD_FREESASA_SUPPORT=ON
|
|
-DBoost_NO_BOOST_CMAKE=ON
|
|
-DPYTHON_INCLUDE_DIR=#{py3include}
|
|
-DPYTHON_EXECUTABLE=#{python_executable}
|
|
-DPYTHON_NUMPY_INCLUDE_PATH=#{numpy_include}
|
|
]
|
|
|
|
system "cmake", ".", *args
|
|
system "make"
|
|
system "make", "install"
|
|
end
|
|
|
|
def caveats
|
|
<<~EOS
|
|
You may need to add RDBASE to your environment variables.
|
|
For Bash, put something like this in your $HOME/.bashrc:
|
|
export RDBASE=#{HOMEBREW_PREFIX}/share/RDKit
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.py").write <<~EOS
|
|
from rdkit import Chem ; print(Chem.MolToSmiles(Chem.MolFromSmiles('C1=CC=CN=C1')))
|
|
EOS
|
|
assert_match "c1ccncc1", shell_output("#{Formula["python@3.9"].opt_bin}/python3 test.py 2>&1")
|
|
end
|
|
end
|