-
Notifications
You must be signed in to change notification settings - Fork 0
/
imp.rb
102 lines (95 loc) · 4.25 KB
/
imp.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
require "formula"
class Imp < Formula
desc "Integrative Modeling Platform"
homepage "https://integrativemodeling.org/"
url "https://integrativemodeling.org/2.22.0/download/imp-2.22.0.tar.gz"
sha256 "8dd1b6afd1f07b5c36763b21d8ad0a2e1413d7e8fd66759de2deb9c842963e3c"
license "LGPL/GPL"
bottle do
root_url "https://salilab.org/homebrew/bottles"
sha256 arm64_sequoia: "d83b9a90f6226bbd39811aff650d41c82f5fecd23e352a783572e42a2b42ac10"
sha256 arm64_sonoma: "f9c8c012b8689161e51f9a6908198400dd2756ddbdbfcd8e7815f62ca3234e82"
sha256 arm64_ventura: "0bd0e9bbe1f91af4d1010182b858a1eb5973c81c0fa49326815a824a323939d8"
sha256 sequoia: "46575c7414d2cf7f5f0c5cead4407218bf4872c957c37f0050e384b4d58537d9"
sha256 sonoma: "20b56bebe03c49f7574aec961c00ba8cad8620bc4e09fbdd24fd7ef393753352"
sha256 ventura: "8fe8dd91232cefa8f92ae0a9eaf5bd6d9d9808d93c6a8c72098e9b8856dae919"
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "swig" => :build
depends_on "cereal" => :build
depends_on "boost"
depends_on "rmf"
depends_on "ihm"
depends_on "eigen"
depends_on "fftw"
depends_on "hdf5"
depends_on "open-mpi"
depends_on "protobuf"
depends_on "[email protected]"
depends_on "cgal" => :recommended
depends_on "gsl" => :recommended
depends_on "libtau" => :recommended
depends_on "opencv" => :recommended
# We need C++17 support for protobuf
fails_with gcc: "5"
def install
pybin = Formula["[email protected]"].opt_bin/"python3.13"
pyver = Language::Python.major_minor_version pybin
args = std_cmake_args
# Work around boost/clang incompatibility
args << "-DCMAKE_CXX_FLAGS='-std=c++17 -D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION'"
args << "-DIMP_DISABLED_MODULES=scratch"
args << "-DIMP_USE_SYSTEM_RMF=on"
args << "-DIMP_USE_SYSTEM_IHM=on"
args << ".."
args << "-DCMAKE_INSTALL_PYTHONDIR=#{lib}/python#{pyver}/site-packages"
# Otherwise linkage of _IMP_em2d.so fails on arm64 because it can't find
# @rpath/libgcc_s.1.1.dylib
gcclib = Formula["gcc"].lib/"gcc/current"
args << "-DCMAKE_MODULE_LINKER_FLAGS=-L#{gcclib}"
# Don't install in lib64 on Linux systems
args << "-DCMAKE_INSTALL_LIBDIR=#{lib}"
# Don't link against gperftools, even if they were found, since then the
# bottle won't work on systems without gperftools installed
args << "-DGPerfTools_found=0"
# Don't link against log4cxx, even if available, since then the
# bottle won't work on systems without log4cxx installed
args << "-DLog4CXX_LIBRARY=Log4CXX_LIBRARY-NOTFOUND"
args << "-DIMP_NO_LOG4CXX=1"
# Help cmake to find CGAL
ENV["CGAL_DIR"] = Formula["cgal"].lib/"cmake/CGAL"
# Make sure we use Homebrew Python
args << "-DPython3_EXECUTABLE:FILEPATH=#{pybin}"
mkdir "build" do
system "cmake", *args
imppybins = []
cd "bin" do
imppybins = Dir.glob("*")
end
system "make"
system "make", "install"
cd bin do
# Make sure binaries use Homebrew Python
inreplace imppybins, %r{^#!.*python.*$}, "#!#{pybin}"
end
end
end
test do
pythons = [Formula["[email protected]"].opt_bin/"python3.13"]
pythons.each do |python|
system python, "-c", "import IMP; assert(IMP.__version__ == '#{version}')"
system python, "-c", "import IMP.em2d; assert(IMP.em2d.__version__ == '#{version}')"
system python, "-c", "import IMP.cgal; assert(IMP.cgal.__version__ == '#{version}')"
system python, "-c", "import IMP.foxs; assert(IMP.foxs.__version__ == '#{version}')"
system python, "-c", "import IMP.multifit; assert(IMP.multifit.__version__ == '#{version}')"
system python, "-c", "import IMP.npctransport; assert(IMP.npctransport.__version__ == '#{version}')"
system python, "-c", "import IMP.bayesianem; assert(IMP.bayesianem.__version__ == '#{version}')"
system python, "-c", "import IMP.sampcon; assert(IMP.sampcon.__version__ == '#{version}')"
system python, "-c", "import IMP, RMF, os; name = IMP.create_temporary_file_name('assignments', '.hdf5'); root = RMF.HDF5.create_file(name); del root; os.unlink(name)"
system python, "-c", "import IMP.mpi; assert(IMP.mpi.__version__ == '#{version}')"
end
system "multifit"
system "foxs"
end
end