50 lines
1.7 KiB
Ruby
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.9.4/mongo-c-driver-1.9.4.tar.gz"
|
|
sha256 "910c2f1b2e3df4d0ea39c2f242160028f90fcb8201f05339a730ec4ba70811fb"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "a1d3dc6acd22480785ae3db92a431e27dbb20c2c5a3c49da72304f8da553d897" => :high_sierra
|
|
sha256 "ab4bcb1d50251c7bffaef26f9d6a2e0c88924c4656871ffdd59e633045a0114b" => :sierra
|
|
sha256 "c57c7d0e598d43c8b6e17df1d69ccb2dc9f7abf8bc4240658367c138f1a06185" => :el_capitan
|
|
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
|