mongo-c-driver: rename from mongo-c, cleanup.

This commit is contained in:
Mike McQuaid 2016-11-28 14:24:29 +00:00
parent c026aa89d0
commit 2c6fd9c6c0
5 changed files with 27 additions and 20 deletions

1
Aliases/libmongoc Symbolic link
View file

@ -0,0 +1 @@
../Formula/mongo-c-driver.rb

1
Aliases/mongo-c Symbolic link
View file

@ -0,0 +1 @@
../Formula/mongo-c-driver.rb

View file

@ -1,6 +1,6 @@
class MongoC < Formula class MongoCDriver < Formula
desc "Official C driver for MongoDB" desc "C driver for MongoDB"
homepage "https://docs.mongodb.org/ecosystem/drivers/c/" homepage "https://github.com/mongodb/mongo-c-driver"
url "https://github.com/mongodb/mongo-c-driver/releases/download/1.5.0/mongo-c-driver-1.5.0.tar.gz" url "https://github.com/mongodb/mongo-c-driver/releases/download/1.5.0/mongo-c-driver-1.5.0.tar.gz"
sha256 "b9b7514052fe7ec40786d8fc22247890c97d2b322aa38c851bba986654164bd6" sha256 "b9b7514052fe7ec40786d8fc22247890c97d2b322aa38c851bba986654164bd6"
@ -20,19 +20,18 @@ class MongoC < Formula
depends_on "pkg-config" => :build depends_on "pkg-config" => :build
depends_on "openssl" => :recommended depends_on "openssl" => :recommended
depends_on "libbson"
conflicts_with "libbson",
:because => "mongo-c installs the libbson headers"
def install def install
args = %W[--prefix=#{prefix}] system "./autogen.sh" if build.head?
# --enable-sasl=no: https://jira.mongodb.org/browse/CDRIVER-447 args = %W[
args << "--enable-sasl=no" if MacOS.version <= :yosemite --disable-debug
--disable-dependency-tracking
if build.head? --disable-silent-rules
system "./autogen.sh" --prefix=#{prefix}
end --enable-man-pages
]
if build.with?("openssl") if build.with?("openssl")
args << "--enable-ssl=yes" args << "--enable-ssl=yes"
@ -42,14 +41,17 @@ class MongoC < Formula
system "./configure", *args system "./configure", *args
system "make", "install" system "make", "install"
prefix.install "examples" pkgshare.install "examples"
end end
test do test do
system ENV.cc, prefix/"examples/mongoc-ping.c", libbson = Formula["libbson"]
system ENV.cc, pkgshare/"examples/mongoc-ping.c",
"-I#{include}/libmongoc-1.0", "-I#{include}/libmongoc-1.0",
"-I#{include}/libbson-1.0", "-I#{libbson.include}/libbson-1.0",
"-L#{lib}", "-lmongoc-1.0", "-lbson-1.0", "-L#{lib}", "-L#{libbson.lib}",
"-lmongoc-1.0", "-lbson-1.0",
"-o", "test" "-o", "test"
assert_match "No suitable servers", shell_output("./test mongodb://0.0.0.0 2>&1", 3) assert_match "No suitable servers", shell_output("./test mongodb://0.0.0.0 2>&1", 3)
end end

View file

@ -23,7 +23,9 @@ class Zmap < Formula
depends_on "libdnet" depends_on "libdnet"
depends_on "json-c" depends_on "json-c"
depends_on "hiredis" => :optional depends_on "hiredis" => :optional
depends_on "mongo-c" => :optional depends_on "mongo-c-driver" => :optional
deprecated_option "with-mongo-c" => "with-mongo-c-driver"
def install def install
inreplace ["conf/zmap.conf", "src/zmap.c", "src/zopt.ggo.in"], "/etc", etc inreplace ["conf/zmap.conf", "src/zmap.c", "src/zopt.ggo.in"], "/etc", etc
@ -32,7 +34,7 @@ class Zmap < Formula
args << "-DENABLE_DEVELOPMENT=OFF" args << "-DENABLE_DEVELOPMENT=OFF"
args << "-DRESPECT_INSTALL_PREFIX_CONFIG=ON" args << "-DRESPECT_INSTALL_PREFIX_CONFIG=ON"
args << "-DWITH_REDIS=ON" if build.with? "hiredis" args << "-DWITH_REDIS=ON" if build.with? "hiredis"
args << "-DWITH_MONGO=ON" if build.with? "mongo-c" args << "-DWITH_MONGO=ON" if build.with? "mongo-c-driver"
system "cmake", ".", *args system "cmake", ".", *args
system "make" system "make"
@ -42,6 +44,6 @@ class Zmap < Formula
test do test do
system "#{sbin}/zmap", "--version" system "#{sbin}/zmap", "--version"
assert_match /redis-csv/, `#{sbin}/zmap --list-output-modules` if build.with? "hiredis" assert_match /redis-csv/, `#{sbin}/zmap --list-output-modules` if build.with? "hiredis"
assert_match /mongo/, `#{sbin}/zmap --list-output-modules` if build.with? "mongo-c" assert_match /mongo/, `#{sbin}/zmap --list-output-modules` if build.with? "mongo-c-driver"
end end
end end

View file

@ -20,6 +20,7 @@
"juju": "juju@1.25", "juju": "juju@1.25",
"letsencrypt": "certbot", "letsencrypt": "certbot",
"libcppa": "caf", "libcppa": "caf",
"mongo-c": "mongo-c-driver",
"mpich2": "mpich", "mpich2": "mpich",
"nimrod": "nim", "nimrod": "nim",
"objective-caml": "ocaml", "objective-caml": "ocaml",