homebrew-core/Formula/mongo-c-driver.rb
2017-03-09 02:29:14 +01:00

50 lines
1.7 KiB
Ruby

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.1/mongo-c-driver-1.6.1.tar.gz"
sha256 "8dd237e8bc3c2956ebd1d39c3a34c1d7d071c03d36f3d18d5735025ad08753d4"
bottle do
cellar :any
sha256 "26d89d86c058516dd809487a89a06739c8025795fa98055f1506c5283786576a" => :sierra
sha256 "230b32540cda8c9ac81816770ed76741129891d1e495209fd609c9d2b0b916ca" => :el_capitan
sha256 "84c857d33a26d63357c520e669822bf0f3e7320f434e3c393c4da91d096dc5fe" => :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