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.11.0/mongo-c-driver-1.11.0.tar.gz" sha256 "bba4afd0e5cc81fc0ddff3c76f1f6d37ddeff684dcf4d4970a414f9ebd84894c" head "https://github.com/mongodb/mongo-c-driver.git" bottle do cellar :any sha256 "08fb75415848ed02f2b6841ed034f63f30be004154f019feb48dea836858b47a" => :high_sierra sha256 "2e94bc03f68420899849e61ca6f18157dae950b472d0722266ef162054326d98" => :sierra sha256 "949a93b4597ce205a9c0846fd53122f5da2c6ca55b8b98edd0f35a98445b981d" => :el_capitan end depends_on "cmake" => :build depends_on "pkg-config" => :build depends_on "sphinx-doc" => :build def install system "cmake", ".", *std_cmake_args system "make", "install" (pkgshare/"libbson").install "src/libbson/examples" (pkgshare/"libmongoc").install "src/libmongoc/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/"libmongoc/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