Created
April 27, 2017 19:00
-
-
Save xoebus/471b5ed4d5d1cc45c101a36412350f15 to your computer and use it in GitHub Desktop.
libgit2 v0.24.6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.24.6.tar.gz" | |
sha256 "7b441a96967ff525e790f8b66859faba5c6be4c347124011f536ae9075ebc30c" | |
head "https://github.com/libgit2/libgit2.git" | |
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.undent | |
#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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment