class MongoCDriver < Formula desc "C driver for MongoDB" homepage "https://github.com/mongodb/mongo-c-driver" url "https://github.com/mongodb/mongo-c-driver/releases/download/1.6.3/mongo-c-driver-1.6.3.tar.gz" sha256 "82df03de117a3ccf563b9eccfd2e5365df8f215a36dea7446d439969033ced7b" bottle do cellar :any sha256 "492bd0ee7ef60db16f8e01ac561c720dae04b128eefe03f1ad8cd46b8547e940" => :sierra sha256 "b51c99c77b8a4bcae12d53ec093a728bc024ff6f44d1fe012928ffa6ac403816" => :el_capitan sha256 "1b17f9b75a1103f20b6d07b0de19ab0d14789e60316f62c327796e9e0981f1e9" => :yosemite end depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build depends_on "pkg-config" => :build depends_on "sphinx-doc" => :build def install system "autoreconf", "-fiv" args = %W[ --disable-debug --disable-dependency-tracking --disable-silent-rules --prefix=#{prefix} --enable-man-pages --with-libbson=bundled --enable-ssl=darwin ] system "./configure", *args system "make", "install" (pkgshare/"libbson").install "src/libbson/examples" (pkgshare/"mongoc").install "examples" end test do system ENV.cc, "-o", "test", pkgshare/"libbson/examples/json-to-bson.c", "-I#{include}/libbson-1.0", "-L#{lib}", "-lbson-1.0" (testpath/"test.json").write('{"name": "test"}') assert_match "\u0000test\u0000", shell_output("./test test.json") system ENV.cc, "-o", "test", pkgshare/"mongoc/examples/mongoc-ping.c", "-I#{include}/libmongoc-1.0", "-I#{include}/libbson-1.0", "-L#{lib}", "-lmongoc-1.0", "-lbson-1.0" assert_match "No suitable servers", shell_output("./test mongodb://0.0.0.0 2>&1", 3) end end