From 2311fe2b2c5adf4904a5a01c864c1e18bdf9c9ba Mon Sep 17 00:00:00 2001 From: Nikolaus Demmel Date: Thu, 27 Feb 2014 09:10:05 +0000 Subject: mongodb: libc++, boost, --full support. * On 10.9, use libc++ (not libstdc++) for devel and HEAD builds * Pass --full flag to install headers and library also. * Add option --with-boost, to pass --use-system-boost to scons (avoid linking issues with the created library). Closes #25253. Signed-off-by: Mike McQuaid --- Library/Formula/mongodb.rb | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'Library') diff --git a/Library/Formula/mongodb.rb b/Library/Formula/mongodb.rb index cf2737ed7..cb56432aa 100644 --- a/Library/Formula/mongodb.rb +++ b/Library/Formula/mongodb.rb @@ -27,18 +27,42 @@ class Mongodb < Formula end end + # When 2.6 is released this conditional can be removed. + if MacOS.version < :mavericks || !build.stable? + option "with-boost", "Compile using installed boost, not the version shipped with mongodb" + depends_on "boost" => :optional + end + depends_on 'scons' => :build depends_on 'openssl' => :optional def install - # mongodb currently can't build with libc++; this should be fixed in - # 2.6, but can't be backported to the current stable release. - ENV.cxx += ' -stdlib=libstdc++' if ENV.compiler == :clang && MacOS.version >= :mavericks - args = ["--prefix=#{prefix}", "-j#{ENV.make_jobs}"] + + cxx = ENV.cxx + if ENV.compiler == :clang && MacOS.version >= :mavericks + if build.stable? + # When 2.6 is released this cxx hack can be removed + # ENV.append "CXXFLAGS", "-stdlib=libstdc++" does not work with scons + # so use this hack of appending the flag to the --cxx parameter of the sconscript. + # mongodb 2.4 can't build with libc++, but defaults to it on Mavericks + cxx += " -stdlib=libstdc++" + else + # build devel and HEAD version on Mavericks with libc++ + # Use --osx-version-min=10.9 such that the compiler defaults to libc++. + # Upstream issue discussing the default flags: + # https://jira.mongodb.org/browse/SERVER-12682 + args << "--osx-version-min=10.9" + end + end + args << '--64' if MacOS.prefer_64_bit? args << "--cc=#{ENV.cc}" - args << "--cxx=#{ENV.cxx}" + args << "--cxx=#{cxx}" + + # --full installs development headers and client library, not just binaries + args << "--full" + args << "--use-system-boost" if build.with? "boost" if build.with? 'openssl' args << '--ssl' -- cgit v1.2.3