From 8ebbece488205ccd353d0c8255a2940d28557a99 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 1 Dec 2016 14:16:22 +0000 Subject: [PATCH] mongo-cxx-driver: rename from libmongoclient, cleanup. Closes #7352. Signed-off-by: Mike McQuaid --- Aliases/libmongoclient | 1 + Formula/libmongoclient.rb | 52 ------------------------------------- Formula/mongo-cxx-driver.rb | 46 ++++++++++++++++++++++++++++++++ formula_renames.json | 1 + 4 files changed, 48 insertions(+), 52 deletions(-) create mode 120000 Aliases/libmongoclient delete mode 100644 Formula/libmongoclient.rb create mode 100644 Formula/mongo-cxx-driver.rb diff --git a/Aliases/libmongoclient b/Aliases/libmongoclient new file mode 120000 index 0000000000..8aa39420c2 --- /dev/null +++ b/Aliases/libmongoclient @@ -0,0 +1 @@ +../Formula/mongo-cxx-driver.rb \ No newline at end of file diff --git a/Formula/libmongoclient.rb b/Formula/libmongoclient.rb deleted file mode 100644 index 56d0ea1ec8..0000000000 --- a/Formula/libmongoclient.rb +++ /dev/null @@ -1,52 +0,0 @@ -class Libmongoclient < Formula - desc "C and C++ driver for MongoDB" - homepage "https://www.mongodb.org" - url "https://github.com/mongodb/mongo-cxx-driver/archive/legacy-0.0-26compat-2.6.12.tar.gz" - sha256 "e4245210a8fdc9282b1d48eae6ef7448557f9e325b7d1d5c3ac9ba89120839ab" - head "https://github.com/mongodb/mongo-cxx-driver.git", :branch => "26compat" - - bottle do - sha256 "4907896f59be2159c14c5d113e7bd5aed8bd5e53b9b8d9f8bfc033179e3f15a4" => :sierra - sha256 "52a5b6ac0764be74eea200b9e3012982622762cc2f45e31896819750b1fa4a8d" => :el_capitan - sha256 "b86a75b625b28a5378c23678a0d02d42b0bfeb01f64d16a7eee111bfa97284b0" => :yosemite - end - - option :cxx11 - - depends_on "scons" => :build - - if build.cxx11? - depends_on "boost" => "c++11" - else - depends_on "boost" - end - - def install - ENV.cxx11 if build.cxx11? - - args = %W[ - --prefix=#{prefix} - -j#{ENV.make_jobs} - --cc=#{ENV.cc} - --cxx=#{ENV.cxx} - --extrapath=#{Formula["boost"].opt_prefix} - --full - --use-system-all - --sharedclient - ] - - # --osx-version-min is required to override --osx-version-min=10.6 added - # by SConstruct which causes "invalid deployment target for -stdlib=libc++" - # when using libc++ - if MacOS.version >= :sierra - # no 10.12; reported 4 Oct 2016 https://jira.mongodb.org/browse/CXX-1067 - args << "--osx-version-min=10.11" - else - args << "--osx-version-min=#{MacOS.version}" - end - - args << "--libc++" if MacOS.version >= :mavericks - - scons *args - end -end diff --git a/Formula/mongo-cxx-driver.rb b/Formula/mongo-cxx-driver.rb new file mode 100644 index 0000000000..92ca114ebc --- /dev/null +++ b/Formula/mongo-cxx-driver.rb @@ -0,0 +1,46 @@ +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.0.3.tar.gz" + sha256 "297957788ed6f8d32ff05cf1a92f022aa4e3cd4398b0c2a0d4a2434363fbde6d" + head "https://github.com/mongodb/mongo-cxx-driver.git" + + bottle do + sha256 "4907896f59be2159c14c5d113e7bd5aed8bd5e53b9b8d9f8bfc033179e3f15a4" => :sierra + sha256 "52a5b6ac0764be74eea200b9e3012982622762cc2f45e31896819750b1fa4a8d" => :el_capitan + sha256 "b86a75b625b28a5378c23678a0d02d42b0bfeb01f64d16a7eee111bfa97284b0" => :yosemite + 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 diff --git a/formula_renames.json b/formula_renames.json index 30264aba99..183af18414 100644 --- a/formula_renames.json +++ b/formula_renames.json @@ -20,6 +20,7 @@ "juju": "juju@1.25", "letsencrypt": "certbot", "libcppa": "caf", + "libmongoclient": "mongo-cxx-driver", "mongo-c": "mongo-c-driver", "mpich2": "mpich", "nimrod": "nim",