58 lines
1.9 KiB
Ruby
58 lines
1.9 KiB
Ruby
class Libgit2 < Formula
|
|
desc "C library of Git core methods that is re-entrant and linkable"
|
|
homepage "https://libgit2.github.com/"
|
|
url "https://github.com/libgit2/libgit2/archive/v0.27.2.tar.gz"
|
|
sha256 "ffacdbd5588aeb03e98e3866a7e2ceace468723a439bdc9bb01362fe140fa9e5"
|
|
head "https://github.com/libgit2/libgit2.git"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "759270276e09159ad08eb27ee1d9097efbae7b1ce44e785aa901aab84b6a8ee1" => :high_sierra
|
|
sha256 "70d18814d867d8f4e9711834e2d74cd9bba6d9ec1a8d1fe696bd58ac0843e0e7" => :sierra
|
|
sha256 "c65f1aaad860388c9e628e8e9a0e96761ae5749b081a05b49ed09165e32d2a32" => :el_capitan
|
|
end
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "cmake" => :build
|
|
depends_on "libssh2" => :recommended
|
|
depends_on "openssl" if MacOS.version <= :lion # Uses SecureTransport on >10.7
|
|
|
|
def install
|
|
args = std_cmake_args
|
|
args << "-DBUILD_EXAMPLES=YES"
|
|
args << "-DBUILD_CLAR=NO" # Don't build tests.
|
|
args << "-DUSE_SSH=NO" if build.without? "libssh2"
|
|
|
|
mkdir "build" do
|
|
system "cmake", "..", *args
|
|
system "make", "install"
|
|
cd "examples" do
|
|
(pkgshare/"examples").install "add", "blame", "cat-file", "cgit2",
|
|
"describe", "diff", "for-each-ref",
|
|
"general", "init", "log", "remote",
|
|
"rev-list", "rev-parse", "showindex",
|
|
"status", "tag"
|
|
end
|
|
end
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.c").write <<~EOS
|
|
#include <git2.h>
|
|
|
|
int main(int argc, char *argv[]) {
|
|
int options = git_libgit2_features();
|
|
return 0;
|
|
}
|
|
EOS
|
|
libssh2 = Formula["libssh2"]
|
|
flags = %W[
|
|
-I#{include}
|
|
-I#{libssh2.opt_include}
|
|
-L#{lib}
|
|
-lgit2
|
|
]
|
|
system ENV.cc, "test.c", "-o", "test", *flags
|
|
system "./test"
|
|
end
|
|
end
|