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.2/mongo-c-driver-1.6.2.tar.gz" sha256 "7ec27e9be4da2bf9e4b316374f8c29f816f0a0f019b984411777e9681e17f70e" bottle do cellar :any sha256 "fb0aaf375f18f1ad1555ba249c7eb6af4824f63c9fa06190a2461c53019c9590" => :sierra sha256 "3fb6b2866ec90c6c3362eb7f1a4840c33b65a3f9464221474804c13d5e55ba1e" => :el_capitan sha256 "09b477ddaa1b8fab4177090e08bfc4cbba2574064912f18424bebfec2dfb042b" => :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