homebrew-core/Formula/voro++.rb

31 lines
993 B
Ruby
Raw Normal View History

class Voroxx < Formula
desc "3D Voronoi cell software library"
homepage "http://math.lbl.gov/voro++"
url "http://math.lbl.gov/voro++/download/dir/voro++-0.4.6.tar.gz"
sha256 "ef7970071ee2ce3800daa8723649ca069dc4c71cc25f0f7d22552387f3ea437e"
revision 1
def install
system "make", "install", "PREFIX=#{prefix}"
pkgshare.install("examples")
mv prefix/"man", share/"man"
end
test do
(testpath/"test.cpp").write <<-EOS.undent
#include "voro++.hh"
double rnd() { return double(rand())/RAND_MAX; }
int main() {
voro::container con(0, 1, 0, 1, 0, 1, 6, 6, 6, false, false, false, 8);
for (int i = 0; i < 20; i++) con.put(i, rnd(), rnd(), rnd());
if (fabs(con.sum_cell_volumes() - 1) > 1.e-8) abort();
con.draw_cells_gnuplot("test.gnu");
}
EOS
system ENV.cxx, "test.cpp", "-I#{include}/voro++", "-L#{lib}",
"-lvoro++"
system "./a.out"
assert File.exist?("test.gnu")
end
end