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.3/mongo-c-driver-1.9.3.tar.gz"
|
|
sha256 "c2c94ef63aaa09efabcbadc4ac3c8740faa102266bdd2559d550f1955b824398"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "08e7f1879028d6838407216d0e3c96b691dde3c1874c46e0bda4704d48c17d4a" => :high_sierra
|
|
sha256 "09ee2c21baa37e87a1d025e2cbe3ce3b296d792bfeb08c17f4c8986b87ef7165" => :sierra
|
|
sha256 "e6f9afa61700f4eaa29e6d8d819ccd288b43e0c7c45d00212b3bff5fc6a13720" => :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
|