47 lines
1.7 KiB
Ruby
47 lines
1.7 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.2.0.tar.gz"
|
|
sha256 "e26edd44cf20bd6be91907403b6d63a065ce95df4c61565770147a46716aad8c"
|
|
head "https://github.com/mongodb/mongo-cxx-driver.git"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "9ce364cb4545f7cb4453ca6adcac2d381dd724cc3df4bcddc87921d2481b586e" => :high_sierra
|
|
sha256 "5a16f976b70d1f99247e02276debb9098a42d1a92693e8447cbb62cf4e8e2f41" => :sierra
|
|
sha256 "228a9e3cc0f097b54e9464422528abd89a95c485305a4cc951f9ec0426cdfbbd" => :el_capitan
|
|
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
|