47 lines
1.7 KiB
Ruby
47 lines
1.7 KiB
Ruby
class Chipmunk < Formula
|
|
desc "2D rigid body physics library written in C"
|
|
homepage "https://chipmunk-physics.net/"
|
|
url "https://chipmunk-physics.net/release/Chipmunk-7.x/Chipmunk-7.0.3.tgz"
|
|
mirror "https://www.mirrorservice.org/sites/distfiles.macports.org/chipmunk/Chipmunk-7.0.3.tgz"
|
|
sha256 "048b0c9eff91c27bab8a54c65ad348cebd5a982ac56978e8f63667afbb63491a"
|
|
license "MIT"
|
|
head "https://github.com/slembcke/Chipmunk2D.git"
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_big_sur: "53a1d8968efd45940eda303182f7a68be0e31221295a85e803f92f3c968c45ad"
|
|
sha256 cellar: :any, big_sur: "6f68cb2c7dfecb8ef8b4572257ce7dd86d3de49af8c6073b173996020132902f"
|
|
sha256 cellar: :any, catalina: "b71191c2c1e4859cb9d5e77b8684612dec1c191780a0b1d56afc04ada66da036"
|
|
sha256 cellar: :any, mojave: "16292e5518bae60c6990a6f1565e1416f91ffe1c878ab43b58465bb2a24d3d11"
|
|
sha256 cellar: :any, high_sierra: "5370b9d8db489d6b8944c23fd4906768c84d87e22f054ca3381c7ee527233f4d"
|
|
sha256 cellar: :any, sierra: "c92a9c1134a272244ca3936b2c94431df7ed7002a9eec99f6914fe1128adae12"
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
|
|
def install
|
|
system "cmake", ".", "-DBUILD_DEMOS=OFF", *std_cmake_args
|
|
system "make", "install"
|
|
|
|
doc.install Dir["doc/*"]
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.c").write <<~EOS
|
|
#include <stdio.h>
|
|
#include <chipmunk.h>
|
|
|
|
int main(void){
|
|
cpVect gravity = cpv(0, -100);
|
|
cpSpace *space = cpSpaceNew();
|
|
cpSpaceSetGravity(space, gravity);
|
|
|
|
cpSpaceFree(space);
|
|
return 0;
|
|
}
|
|
EOS
|
|
system ENV.cc, "-I#{include}/chipmunk", "-L#{lib}", "-lchipmunk",
|
|
testpath/"test.c", "-o", testpath/"test"
|
|
system "./test"
|
|
end
|
|
end
|