homebrew-core/Formula/ode.rb
2017-10-20 14:10:54 +01:00

57 lines
2 KiB
Ruby

class Ode < Formula
desc "Library for simulating articulated rigid body dynamics"
homepage "http://www.ode.org/"
url "https://bitbucket.org/odedevs/ode/downloads/ode-0.15.2.tar.gz"
sha256 "2eaebb9f8b7642815e46227956ca223806f666acd11e31708bd030028cf72bac"
head "https://bitbucket.org/odedevs/ode/", :using => :hg
bottle do
cellar :any_skip_relocation
sha256 "3425f2c71a9b413185437a0976d3380a2f00d573b73f4afdeee28b3124158c47" => :high_sierra
sha256 "2ff984f39f6825aed23e41289ebbf7302b414ff2f29df0dcc0bb0c900be1633c" => :sierra
sha256 "819a4d6c09a2fc3cda1866ac1915a8bc7166d4ecb03dc6c18dbed103ccdc70e9" => :el_capitan
end
option "with-double-precision", "Compile ODE with double precision"
option "with-shared", "Compile ODE with shared library support"
option "with-libccd", "Enable all libccd colliders (except box-cylinder)"
option "with-x11", "Build the drawstuff library and demos"
deprecated_option "enable-double-precision" => "with-double-precision"
deprecated_option "enable-shared" => "with-shared"
deprecated_option "enable-libccd" => "with-libccd"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
depends_on :x11 => :optional
def install
args = ["--prefix=#{prefix}"]
args << "--enable-double-precision" if build.with? "double-precision"
args << "--enable-shared" if build.with? "shared"
args << "--enable-libccd" if build.with? "libccd"
args << "--with-demos" if build.with? "x11"
inreplace "bootstrap", "libtoolize", "glibtoolize"
system "./bootstrap"
system "./configure", *args
system "make"
system "make", "install"
end
test do
(testpath/"test.cpp").write <<~EOS
#include <ode/ode.h>
int main() {
dInitODE();
dCloseODE();
return 0;
}
EOS
system ENV.cc, "test.cpp", "-I#{include}/ode", "-L#{lib}", "-lode", "-lc++", "-o", "test"
system "./test"
end
end