diff options
| author | nickl- | 2014-02-15 04:13:33 +0200 |
|---|---|---|
| committer | Adam Vandenberg | 2014-02-15 10:58:25 -0800 |
| commit | cb2d7f4de708a56ab4520e0568a91ec0e31aff09 (patch) | |
| tree | 5a7a79a6bd4cc5ef6778a08e52de5598a4951433 /Library/Formula/libcapn.rb | |
| parent | 8e35e85114be94f1feebc0a0ac23f80c380c18ff (diff) | |
| download | homebrew-cb2d7f4de708a56ab4520e0568a91ec0e31aff09.tar.bz2 | |
libcapn stable 1.0.0b3, HEAD
Closes #25475.
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library/Formula/libcapn.rb')
| -rw-r--r-- | Library/Formula/libcapn.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Library/Formula/libcapn.rb b/Library/Formula/libcapn.rb new file mode 100644 index 000000000..e0199c7b4 --- /dev/null +++ b/Library/Formula/libcapn.rb @@ -0,0 +1,37 @@ +require 'formula' + +class Libcapn < Formula + homepage 'http://libcapn.org/' + url 'http://libcapn.org/download/libcapn-1.0.0b3-src.tar.gz' + sha1 'a53f7b382e683249ff55214b1effbae5f82c4ef2' + head 'https://github.com/adobkin/libcapn.git' + + depends_on 'cmake' => :build + depends_on 'pkg-config' => :build + + def install + inreplace 'CMakeLists.txt', /usr\/lib\/pkgconfig/, "#{lib}/pkgconfig" unless build.head? + system "cmake", ".", *std_cmake_args + system "make", "install" + end + + test do + (testpath/'test_install.c').write <<-TEST_SCRIPT.undent + #include <apn.h> + int main() { + apn_ctx_ref ctx = NULL; + apn_error_ref error; + if (apn_init(&ctx, "apns-dev-cert.pem", "apns-dev-key.pem", NULL, &error) == APN_ERROR) { + apn_error_free(&error); + return 1; + } + apn_close(ctx); + apn_free(&ctx); + return 0; + } + TEST_SCRIPT + flags = `#{HOMEBREW_PREFIX}/bin/pkg-config --cflags --libs libcapn`.split + ENV.cflags.split + system ENV.cc, "-o", "test_install", "test_install.c", *flags + system "./test_install" + end +end |
