From 5f02cd59e6480724fca59f628701e33d028b3ec6 Mon Sep 17 00:00:00 2001 From: Trevor Wennblom Date: Wed, 23 Nov 2011 23:06:13 -0600 Subject: [PATCH] boost: Fix boost::BOOST_FOREACH errors Fixed by adding a patch against 1.48.0. HEAD url also added. Closes Homebrew/homebrew#8763. Signed-off-by: Charlie Sharpsteen --- Formula/boost.rb | 74 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/Formula/boost.rb b/Formula/boost.rb index 4a5d041318..96b3bc4d2a 100644 --- a/Formula/boost.rb +++ b/Formula/boost.rb @@ -4,11 +4,24 @@ class Boost < Formula homepage 'http://www.boost.org' url 'http://downloads.sourceforge.net/project/boost/boost/1.48.0/boost_1_48_0.tar.bz2' md5 'd1e9a7a7f532bb031a3c175d86688d95' + head 'http://svn.boost.org/svn/boost/trunk', :using => :svn # Bottle built on 10.7.2 using XCode 4.2 bottle 'https://downloads.sourceforge.net/project/machomebrew/Bottles/boost-1.48.0-bottle.tar.gz' bottle_sha1 'd5edc2714c4182081d0399f0a0278672e1c85410' + def patches + # https://svn.boost.org/trac/boost/ticket/6131 + # + # #define foreach BOOST_FOREACH causes weird compile error in certain + # circumstances with boost 1.48 + # + # #define foreach BOOST_FOREACH causes compile error "'boost::BOOST_FOREACH' + # has not been declared" on its line if it appears after #include + # and before certain other boost headers. + DATA + end + def options [ ["--with-mpi", "Enable MPI support"], @@ -73,3 +86,64 @@ class Boost < Formula system "./bjam", *args end end +__END__ +Index: /boost/foreach_fwd.hpp +=================================================================== +--- /boost/foreach_fwd.hpp (revision 62661) ++++ /boost/foreach_fwd.hpp (revision 75540) +@@ -15,4 +15,6 @@ + #define BOOST_FOREACH_FWD_HPP + ++#include // for std::pair ++ + // This must be at global scope, hence the uglified name + enum boost_foreach_argument_dependent_lookup_hack +@@ -26,4 +28,7 @@ + namespace foreach + { ++ template ++ std::pair in_range(T begin, T end); ++ + /////////////////////////////////////////////////////////////////////////////// + // boost::foreach::tag +@@ -47,4 +52,22 @@ + } // namespace foreach + ++// Workaround for unfortunate https://svn.boost.org/trac/boost/ticket/6131 ++namespace BOOST_FOREACH ++{ ++ using foreach::in_range; ++ using foreach::tag; ++ ++ template ++ struct is_lightweight_proxy ++ : foreach::is_lightweight_proxy ++ {}; ++ ++ template ++ struct is_noncopyable ++ : foreach::is_noncopyable ++ {}; ++ ++} // namespace BOOST_FOREACH ++ + } // namespace boost + +Index: /boost/foreach.hpp +=================================================================== +--- /boost/foreach.hpp (revision 75077) ++++ /boost/foreach.hpp (revision 75540) +@@ -166,5 +166,5 @@ + // at the global namespace for your type. + template +-inline boost::foreach::is_lightweight_proxy * ++inline boost::BOOST_FOREACH::is_lightweight_proxy * + boost_foreach_is_lightweight_proxy(T *&, BOOST_FOREACH_TAG_DEFAULT) { return 0; } + +@@ -191,5 +191,5 @@ + // at the global namespace for your type. + template +-inline boost::foreach::is_noncopyable * ++inline boost::BOOST_FOREACH::is_noncopyable * + boost_foreach_is_noncopyable(T *&, BOOST_FOREACH_TAG_DEFAULT) { return 0; } +