165 lines
5.0 KiB
Ruby
165 lines
5.0 KiB
Ruby
class Root < Formula
|
|
desc "Object oriented framework for large scale data analysis"
|
|
homepage "https://root.cern.ch/"
|
|
url "https://root.cern.ch/download/root_v6.24.06.source.tar.gz"
|
|
sha256 "907f69f4baca1e4f30eeb4979598ca7599b6aa803ca046e80e25b6bbaa0ef522"
|
|
license "LGPL-2.1-or-later"
|
|
revision 2
|
|
head "https://github.com/root-project/root.git", branch: "master"
|
|
|
|
livecheck do
|
|
url "https://root.cern.ch/download/"
|
|
regex(/href=.*?root[._-]v?(\d+(?:\.\d*[02468])+)\.source\.t/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 arm64_monterey: "4486615e37da793dea1ff7fa73416988dd11d6597aed6f14eeeb8fe18d6cf88a"
|
|
sha256 arm64_big_sur: "486e5d4cc0857645d1a4198e7e3e06e4a78acc71d11b7c2c7877e4315c14298f"
|
|
sha256 monterey: "24199045f6de3ce88197a82a02e02428a624305f9c44fdc5786d579ebe94dd3e"
|
|
sha256 big_sur: "761ba42f4e215b1908b9d9fa7d0a6409001d8464d93fe4abdae943591c9b53c1"
|
|
sha256 catalina: "3da0ffd885eaabc9e22459917e62e755eb2d907f3f76f530bba214b00016085a"
|
|
sha256 x86_64_linux: "5a2ea4436a286f7e869c072a0cb570d399de2b254050187fb8c1a0a3ee9d7c3f"
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "ninja" => :build
|
|
depends_on "cfitsio"
|
|
depends_on "davix"
|
|
depends_on "fftw"
|
|
depends_on "gcc" # for gfortran
|
|
depends_on "gl2ps"
|
|
depends_on "glew"
|
|
depends_on "graphviz"
|
|
depends_on "gsl"
|
|
depends_on "lz4"
|
|
depends_on "numpy" # for tmva
|
|
depends_on "openblas"
|
|
depends_on "openssl@1.1"
|
|
depends_on "pcre"
|
|
depends_on "python@3.9"
|
|
depends_on "sqlite"
|
|
depends_on "tbb"
|
|
depends_on :xcode
|
|
depends_on "xrootd"
|
|
depends_on "xz" # for LZMA
|
|
depends_on "zstd"
|
|
|
|
uses_from_macos "libxml2"
|
|
uses_from_macos "zlib"
|
|
|
|
on_linux do
|
|
depends_on "libxft"
|
|
depends_on "libxpm"
|
|
end
|
|
|
|
skip_clean "bin"
|
|
|
|
def install
|
|
ENV.append "LDFLAGS", "-Wl,-rpath,#{lib}/root" if OS.linux?
|
|
|
|
inreplace "cmake/modules/SearchInstalledSoftware.cmake" do |s|
|
|
# Enforce secure downloads of vendored dependencies. These are
|
|
# checksummed in the cmake file with sha256.
|
|
s.gsub! "http://lcgpackages", "https://lcgpackages"
|
|
# Patch out check that skips using brewed glew.
|
|
s.gsub! "CMAKE_VERSION VERSION_GREATER 3.15", "CMAKE_VERSION VERSION_GREATER 99.99"
|
|
end
|
|
|
|
args = std_cmake_args + %W[
|
|
-DCLING_CXX_PATH=clang++
|
|
-DCMAKE_INSTALL_ELISPDIR=#{elisp}
|
|
-DPYTHON_EXECUTABLE=#{Formula["python@3.9"].opt_bin}/python3
|
|
-Dbuiltin_cfitsio=OFF
|
|
-Dbuiltin_freetype=ON
|
|
-Dbuiltin_glew=OFF
|
|
-Ddavix=ON
|
|
-Dfftw3=ON
|
|
-Dfitsio=ON
|
|
-Dfortran=ON
|
|
-Dgdml=ON
|
|
-Dgnuinstall=ON
|
|
-Dimt=ON
|
|
-Dmathmore=ON
|
|
-Dminuit2=ON
|
|
-Dmysql=OFF
|
|
-Dpgsql=OFF
|
|
-Dpyroot=ON
|
|
-Droofit=ON
|
|
-Dssl=ON
|
|
-Dtmva=ON
|
|
-Dxrootd=ON
|
|
-GNinja
|
|
]
|
|
|
|
cxx_version = (MacOS.version < :mojave) ? 14 : 17
|
|
args << "-DCMAKE_CXX_STANDARD=#{cxx_version}"
|
|
|
|
# Homebrew now sets CMAKE_INSTALL_LIBDIR to /lib, which is incorrect
|
|
# for ROOT with gnuinstall, so we set it back here.
|
|
args << "-DCMAKE_INSTALL_LIBDIR=lib/root"
|
|
|
|
# Workaround the shim directory being embedded into the output
|
|
inreplace "build/unix/compiledata.sh", "`type -path $CXX`", ENV.cxx
|
|
|
|
mkdir "builddir" do
|
|
system "cmake", "..", *args
|
|
system "ninja", "install"
|
|
|
|
chmod 0755, Dir[bin/"*.*sh"]
|
|
|
|
version = Language::Python.major_minor_version Formula["python@3.9"].opt_bin/"python3"
|
|
pth_contents = "import site; site.addsitedir('#{lib}/root')\n"
|
|
(prefix/"lib/python#{version}/site-packages/homebrew-root.pth").write pth_contents
|
|
end
|
|
end
|
|
|
|
def caveats
|
|
<<~EOS
|
|
As of ROOT 6.22, you should not need the thisroot scripts; but if you
|
|
depend on the custom variables set by them, you can still run them:
|
|
|
|
For bash users:
|
|
. #{HOMEBREW_PREFIX}/bin/thisroot.sh
|
|
For zsh users:
|
|
pushd #{HOMEBREW_PREFIX} >/dev/null; . bin/thisroot.sh; popd >/dev/null
|
|
For csh/tcsh users:
|
|
source #{HOMEBREW_PREFIX}/bin/thisroot.csh
|
|
For fish users:
|
|
. #{HOMEBREW_PREFIX}/bin/thisroot.fish
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.C").write <<~EOS
|
|
#include <iostream>
|
|
void test() {
|
|
std::cout << "Hello, world!" << std::endl;
|
|
}
|
|
EOS
|
|
|
|
# Test ROOT command line mode
|
|
system "#{bin}/root", "-b", "-l", "-q", "-e", "gSystem->LoadAllLibraries(); 0"
|
|
|
|
# Test ROOT executable
|
|
assert_equal "\nProcessing test.C...\nHello, world!\n",
|
|
shell_output("root -l -b -n -q test.C")
|
|
|
|
# Test linking
|
|
(testpath/"test.cpp").write <<~EOS
|
|
#include <iostream>
|
|
#include <TString.h>
|
|
int main() {
|
|
std::cout << TString("Hello, world!") << std::endl;
|
|
return 0;
|
|
}
|
|
EOS
|
|
flags = %w[cflags libs ldflags].map { |f| "$(root-config --#{f})" }
|
|
flags << "-Wl,-rpath,#{lib}/root" if OS.linux?
|
|
shell_output("$(root-config --cxx) test.cpp #{flags.join(" ")}")
|
|
assert_equal "Hello, world!\n", shell_output("./a.out")
|
|
|
|
# Test Python module
|
|
system Formula["python@3.9"].opt_bin/"python3", "-c", "import ROOT; ROOT.gSystem.LoadAllLibraries()"
|
|
end
|
|
end
|