homebrew-core/Formula/clhep.rb
2017-03-22 08:35:59 +01:00

56 lines
1.7 KiB
Ruby

class Clhep < Formula
desc "Class Library for High Energy Physics"
homepage "https://proj-clhep.web.cern.ch/proj-clhep/"
url "https://proj-clhep.web.cern.ch/proj-clhep/DISTRIBUTION/tarFiles/clhep-2.3.4.4.tgz"
sha256 "e54de15ffa5108a1913c4910845436345c89ddb83480cd03277a795fafabfb9d"
bottle do
cellar :any_skip_relocation
sha256 "daae63975af6dcb3c7a636f17d8d04f16c486c73f8e79cde2bd4156c71aa6a49" => :sierra
sha256 "ed1ae7ae97776244892e264bdb3dd5e3d5e8766154e3924a98d80d244110dd8f" => :el_capitan
sha256 "0935ea8d2f68b5b5b0e82be32b974521c775ce41ebc371b4eb5a970bd28b4222" => :yosemite
end
head do
url "https://gitlab.cern.ch/CLHEP/CLHEP.git"
depends_on "automake" => :build
depends_on "autoconf" => :build
end
depends_on "cmake" => :build
def install
# CLHEP is super fussy and doesn't allow source tree builds
dir = Dir.mktmpdir
cd dir do
args = std_cmake_args
if build.stable?
args << buildpath/"CLHEP"
else
args << buildpath
end
system "cmake", *args
system "make", "install"
end
end
test do
(testpath/"test.cpp").write <<-EOS.undent
#include <iostream>
#include <Vector/ThreeVector.h>
int main() {
CLHEP::Hep3Vector aVec(1, 2, 3);
std::cout << "r: " << aVec.mag();
std::cout << " phi: " << aVec.phi();
std::cout << " cos(theta): " << aVec.cosTheta() << std::endl;
return 0;
}
EOS
system ENV.cxx, "-L#{lib}", "-lCLHEP", "-I#{include}/CLHEP",
testpath/"test.cpp", "-o", "test"
assert_equal "r: 3.74166 phi: 1.10715 cos(theta): 0.801784",
shell_output("./test").chomp
end
end