From 29fd7d2ae43af7bbe9cc6e8da52fd389062ef393 Mon Sep 17 00:00:00 2001 From: Nikolaus Demmel Date: Thu, 27 Feb 2014 09:10:05 +0000 Subject: [PATCH] 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 Homebrew/homebrew#25253. Signed-off-by: Mike McQuaid --- Formula/mongodb.rb | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/Formula/mongodb.rb b/Formula/mongodb.rb index cf2737ed73..cb56432aa3 100644 --- a/Formula/mongodb.rb +++ b/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'