homebrew-core/Formula/mongo-cxx-driver.rb
2016-12-20 23:22:30 -08:00

46 lines
1.6 KiB
Ruby

class MongoCxxDriver < Formula
desc "C++ driver for MongoDB"
homepage "https://github.com/mongodb/mongo-cxx-driver"
url "https://github.com/mongodb/mongo-cxx-driver/archive/r3.1.1.tar.gz"
sha256 "cf8557c00774bdc0fa7e9ba67d6531c52386747e8bd59b5c8e3677ddb7bf25a9"
head "https://github.com/mongodb/mongo-cxx-driver.git"
bottle do
sha256 "22e269490eb2522d5c150562c94a96946312a8a291f0d7a5c3ade057fa34d154" => :sierra
sha256 "d2cc8ac3df89347f48bd1e0c718d137c88418cd7bf0d5fbe7dba1fc332b02660" => :el_capitan
sha256 "351ebd4f1332785e8232382c10b13595bb40d1953501009ec59a3e81abb84d5d" => :yosemite
end
needs :cxx11
depends_on "cmake" => :build
depends_on "mongo-c-driver"
def install
mongo_c_prefix = Formula["mongo-c-driver"].opt_prefix
system "cmake", ".", *std_cmake_args,
"-DLIBBSON_DIR=#{mongo_c_prefix}", "-DLIBMONGOC_DIR=#{mongo_c_prefix}"
system "make"
system "make", "install"
pkgshare.install "examples"
end
test do
mongo_c_include = Formula["mongo-c-driver"]
system ENV.cc, "-o", "test", pkgshare/"examples/bsoncxx/builder_basic.cpp",
"-I#{include}/bsoncxx/v_noabi",
"-I#{mongo_c_include}/libbson-1.0",
"-L#{lib}", "-lbsoncxx", "-std=c++11", "-lstdc++"
system "./test"
system ENV.cc, "-o", "test", pkgshare/"examples/mongocxx/connect.cpp",
"-I#{include}/mongocxx/v_noabi",
"-I#{include}/bsoncxx/v_noabi",
"-I#{mongo_c_include}/libmongoc-1.0",
"-I#{mongo_c_include}/libbson-1.0",
"-L#{lib}", "-lmongocxx", "-lbsoncxx", "-std=c++11", "-lstdc++"
assert_match "No suitable servers",
shell_output("./test mongodb://0.0.0.0 2>&1", 1)
end
end