diff options
| author | Gary Wolfman | 2012-11-18 16:52:50 +0000 |
|---|---|---|
| committer | Mike McQuaid | 2012-11-18 21:13:28 +0000 |
| commit | 03f75aa93d5b2f3713ec1eec99af2a54b035fa5c (patch) | |
| tree | 3c96a2d92657a17ce93ac7d7619baf16baed11e3 | |
| parent | 1751362562f9b5d56708003f0dffb88e5b2418ab (diff) | |
| download | homebrew-03f75aa93d5b2f3713ec1eec99af2a54b035fa5c.tar.bz2 | |
boost: c++11 support.
This commit modifies boost.rb to provide C++11 support for compiling Boost. The support is the simplest possible, adding a "with-c++11" option which if selected will add the appropriate toolset switch to the bootstrap.sh invocation and the appropriate toolset, cxxflags and linkflags to the b2 invocation. Due to a bug in Boost, it is also necessary to provide a patch (IAW Boost Ticket 7671) or C++11 compilation will fail.
Closes #16078.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
| -rw-r--r-- | Library/Formula/boost.rb | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/Library/Formula/boost.rb b/Library/Formula/boost.rb index 0093f975c..30149bac7 100644 --- a/Library/Formula/boost.rb +++ b/Library/Formula/boost.rb @@ -36,6 +36,7 @@ class Boost < Formula option 'with-mpi', 'Enable MPI support' option 'without-python', 'Build without Python' option 'with-icu', 'Build regexp engine with icu support' + option 'with-c++11', 'Compile using Clang, std=c++11 and stdlib=libc++' if MacOS.version >= :lion depends_on UniversalPython.new if needs_universal_python? depends_on "icu4c" if build.include? "with-icu" @@ -46,6 +47,14 @@ class Boost < Formula cause "Dropped arguments to functions when linking with boost" end + # Patch boost/config/stdlib/libcpp.hpp to fix the constexpr bug reported under Boost 1.52 in Ticket + # 7671. This patch can be removed when upstream release an updated version including the fix. + def patches + if MacOS.version >= :lion and build.include? 'with-c++11' + {:p0 => "https://svn.boost.org/trac/boost/raw-attachment/ticket/7671/libcpp_c11_numeric_limits.patch"} + end + end + def install # Adjust the name the libs are installed under to include the path to the # Homebrew lib directory so executables will work when installed to a @@ -74,6 +83,8 @@ class Boost < Formula # we specify libdir too because the script is apparently broken bargs = ["--prefix=#{prefix}", "--libdir=#{lib}"] + bargs << "--with-toolset=clang" if build.include? "with-c++11" + if build.include? 'with-icu' icu4c_prefix = Formula.factory('icu4c').opt_prefix bargs << "--with-icu=#{icu4c_prefix}" @@ -90,10 +101,18 @@ class Boost < Formula "threading=multi", "install"] + if MacOS.version >= :lion and build.include? 'with-c++11' + args << "toolset=clang" << "cxxflags=-std=c++11" + args << "cxxflags=-stdlib=libc++" << "cxxflags=-fPIC" + args << "linkflags=-stdlib=libc++" + args << "linkflags=-headerpad_max_install_names" + args << "linkflags=-arch x86_64" + end + args << "address-model=32_64" << "architecture=x86" << "pch=off" if build.universal? args << "--without-python" if build.include? "without-python" system "./bootstrap.sh", *bargs - system "./bjam", *args + system "./b2", *args end end |
