summaryrefslogtreecommitdiff
path: root/tools/patches
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2020-02-23 14:51:56 +0100
committerRobin Gareus <robin@gareus.org>2020-02-23 16:21:50 +0100
commit96ef1dc0ed9862bf4937d182f789edd20c17581f (patch)
tree6851918f213f836e3e4de0bb6cccfa5a270b0ca2 /tools/patches
parent3e77680a57ee28571ec5558845df2ad82246741a (diff)
Cleanup cource tree: collect patches
Diffstat (limited to 'tools/patches')
-rw-r--r--tools/patches/GdkQuartzWindow.patch44
-rw-r--r--tools/patches/boost-1.55-ptr-debug.patch292
-rw-r--r--tools/patches/boost-1.62-ptr-debug.patch289
-rw-r--r--tools/patches/boost-ptr-debug.patch275
-rw-r--r--tools/patches/gtk-osx.patch542
-rw-r--r--tools/patches/gtkdnd-quartz.patch55
-rw-r--r--tools/patches/shared_ptr.patch275
-rw-r--r--tools/patches/waf-str.patch11
-rw-r--r--tools/patches/waflib-tar.patch11
-rw-r--r--tools/patches/waflib.patch13
10 files changed, 1807 insertions, 0 deletions
diff --git a/tools/patches/GdkQuartzWindow.patch b/tools/patches/GdkQuartzWindow.patch
new file mode 100644
index 0000000000..217c010ffb
--- /dev/null
+++ b/tools/patches/GdkQuartzWindow.patch
@@ -0,0 +1,44 @@
+--- old/gtk+-2.24.23/gdk/quartz/GdkQuartzWindow.c 2013-10-16 11:29:55.000000000 -0400
++++ new/gtk+-2.24.23/gdk/quartz/GdkQuartzWindow.c 2015-07-20 15:05:40.000000000 -0400
+@@ -625,6 +625,41 @@
+ event.dnd.send_event = FALSE;
+ event.dnd.context = _gdk_quartz_drag_source_context;
+
++ /* Check to see if the coordinates are inside a known GdkWindow */
++
++ GdkScreen* screen = gdk_window_get_screen (event.dnd.window);
++
++ if (screen)
++ {
++ GList* windows, *list;
++ gint gx, gy;
++
++ event.dnd.context->dest_window = NULL;
++
++ windows = gdk_screen_get_toplevel_windows (screen);
++ _gdk_quartz_window_nspoint_to_gdk_xy (aPoint, &gx, &gy);
++
++ for (list = windows; list; list = list->next)
++ {
++ GdkWindow* win = (GdkWindow*) list->data;
++ gint wx, wy;
++ gint ww, wh;
++
++ gdk_window_get_root_origin (win, &wx, &wy);
++ ww = gdk_window_get_width (win);
++ wh = gdk_window_get_height (win);
++
++ if (gx > wx &&
++ gy > wy &&
++ gx <= wx + ww &&
++ gy <= wy + wh)
++ {
++ /* found a toplevel GdkWindow at the drop position */
++ event.dnd.context->dest_window = win;
++ }
++ }
++ }
++
+ (*_gdk_event_func) (&event, _gdk_event_data);
+
+ g_object_unref (event.dnd.window);
diff --git a/tools/patches/boost-1.55-ptr-debug.patch b/tools/patches/boost-1.55-ptr-debug.patch
new file mode 100644
index 0000000000..83f20a5154
--- /dev/null
+++ b/tools/patches/boost-1.55-ptr-debug.patch
@@ -0,0 +1,292 @@
+--- /usr/include/boost/smart_ptr/shared_ptr.hpp.orig 2016-01-15 11:54:21.423304649 -0500
++++ /usr/include/boost/smart_ptr/shared_ptr.hpp 2016-01-15 12:27:20.324047643 -0500
+@@ -52,6 +52,13 @@
+ #endif
+ #endif
+
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++void boost_debug_shared_ptr_operator_equals (void const *, void const *, int, void const*, int);
++void boost_debug_shared_ptr_reset (void const *, void const *, int, void const*, int);
++void boost_debug_shared_ptr_destructor (void const *, void const *, int);
++void boost_debug_shared_ptr_constructor (void const *, void const *, int);
++#endif
++
+ namespace boost
+ {
+
+@@ -275,20 +282,29 @@
+ {
+ boost::detail::shared_count( p ).swap( pn );
+ boost::detail::sp_enable_shared_from_this( ppx, p, p );
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (ppx, ppx->get(), ppx->use_count());
++#endif
+ }
+
+ #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+
+-template< class T, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[] > * /*ppx*/, Y * p, boost::detail::shared_count & pn )
++template< class T, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[] > * ppx, Y * p, boost::detail::shared_count & pn )
+ {
+ sp_assert_convertible< Y[], T[] >();
+ boost::detail::shared_count( p, boost::checked_array_deleter< T >() ).swap( pn );
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ /* no code for this yet - shared_ptr to array of T */
++#endif
+ }
+
+ template< class T, std::size_t N, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[N] > * /*ppx*/, Y * p, boost::detail::shared_count & pn )
+ {
+ sp_assert_convertible< Y[N], T[N] >();
+ boost::detail::shared_count( p, boost::checked_array_deleter< T >() ).swap( pn );
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ /* no code for this yet - shared_ptr to array of T */
++#endif
+ }
+
+ #endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+@@ -298,6 +314,9 @@
+ template< class T, class Y > inline void sp_deleter_construct( boost::shared_ptr< T > * ppx, Y * p )
+ {
+ boost::detail::sp_enable_shared_from_this( ppx, p, p );
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (ppx, ppx->get(), ppx->use_count());
++#endif
+ }
+
+ #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+@@ -305,11 +324,17 @@
+ template< class T, class Y > inline void sp_deleter_construct( boost::shared_ptr< T[] > * /*ppx*/, Y * /*p*/ )
+ {
+ sp_assert_convertible< Y[], T[] >();
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ /* no code for this yet - shared_ptr to array of T */
++#endif
+ }
+
+ template< class T, std::size_t N, class Y > inline void sp_deleter_construct( boost::shared_ptr< T[N] > * /*ppx*/, Y * /*p*/ )
+ {
+ sp_assert_convertible< Y[N], T[N] >();
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ /* no code for this yet - shared_ptr to array of T */
++#endif
+ }
+
+ #endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+@@ -338,12 +363,20 @@
+
+ shared_ptr() BOOST_NOEXCEPT : px( 0 ), pn() // never throws in 1.30+
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ /* default constructor case */
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ #if !defined( BOOST_NO_CXX11_NULLPTR )
+
+ shared_ptr( boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT : px( 0 ), pn() // never throws
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ /* explicit nullptr constructor case */
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ #endif
+@@ -384,11 +417,23 @@
+
+ template<class D, class A> shared_ptr( boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( p, d, a )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ #endif
+
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ ~shared_ptr() {
++ boost_debug_shared_ptr_destructor (this, get(), use_count());
++ }
++ shared_ptr(const shared_ptr<T>& r ) : px (r.px), pn (r.pn) {
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++ }
++#else
+ // generated copy constructor, destructor are fine...
++#endif /* BOOST_SP_ENABLE_DEBUG_HOOKS */
+
+ #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
+
+@@ -396,6 +441,9 @@
+
+ shared_ptr( shared_ptr const & r ) BOOST_NOEXCEPT : px( r.px ), pn( r.pn )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ }
+
+ #endif
+@@ -405,6 +453,9 @@
+ {
+ boost::detail::sp_assert_convertible< Y, T >();
+
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.px, -1);
++#endif
+ // it is now safe to copy r.px, as pn(r.pn) did not throw
+ px = r.px;
+ }
+@@ -415,6 +466,9 @@
+ {
+ if( !pn.empty() )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.px, -1);
++#endif
+ px = r.px;
+ }
+ }
+@@ -432,6 +486,9 @@
+ BOOST_NOEXCEPT : px( r.px ), pn( r.pn )
+ {
+ boost::detail::sp_assert_convertible< Y, T >();
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ }
+
+ // aliasing
+@@ -513,6 +570,9 @@
+ template<class Y>
+ shared_ptr & operator=(shared_ptr<Y> const & r) BOOST_NOEXCEPT
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type(r).swap(*this);
+ return *this;
+ }
+@@ -524,6 +584,9 @@
+ template<class Y>
+ shared_ptr & operator=( std::auto_ptr<Y> & r )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type( r ).swap( *this );
+ return *this;
+ }
+@@ -533,6 +596,9 @@
+ template<class Y>
+ shared_ptr & operator=( std::auto_ptr<Y> && r )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type( static_cast< std::auto_ptr<Y> && >( r ) ).swap( *this );
+ return *this;
+ }
+@@ -555,6 +621,9 @@
+ template<class Y, class D>
+ shared_ptr & operator=( std::unique_ptr<Y, D> && r )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type( static_cast< std::unique_ptr<Y, D> && >( r ) ).swap(*this);
+ return *this;
+ }
+@@ -567,6 +636,9 @@
+
+ shared_ptr( shared_ptr && r ) BOOST_NOEXCEPT : px( r.px ), pn()
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ pn.swap( r.pn );
+ r.px = 0;
+ }
+@@ -585,12 +657,18 @@
+ {
+ boost::detail::sp_assert_convertible< Y, T >();
+
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ pn.swap( r.pn );
+ r.px = 0;
+ }
+
+ shared_ptr & operator=( shared_ptr && r ) BOOST_NOEXCEPT
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type( static_cast< shared_ptr && >( r ) ).swap( *this );
+ return *this;
+ }
+@@ -598,6 +676,9 @@
+ template<class Y>
+ shared_ptr & operator=( shared_ptr<Y> && r ) BOOST_NOEXCEPT
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type( static_cast< shared_ptr<Y> && >( r ) ).swap( *this );
+ return *this;
+ }
+@@ -608,6 +689,9 @@
+
+ shared_ptr & operator=( boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT // never throws
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type().swap(*this);
+ return *this;
+ }
+@@ -616,27 +700,42 @@
+
+ void reset() BOOST_NOEXCEPT // never throws in 1.30+
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_reset (this, get(), use_count(), 0, 0);
++#endif
+ this_type().swap(*this);
+ }
+
+ template<class Y> void reset( Y * p ) // Y must be complete
+ {
+ BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
++#endif
+ this_type( p ).swap( *this );
+ }
+
+ template<class Y, class D> void reset( Y * p, D d )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
++#endif
+ this_type( p, d ).swap( *this );
+ }
+
+ template<class Y, class D, class A> void reset( Y * p, D d, A a )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
++#endif
+ this_type( p, d, a ).swap( *this );
+ }
+
+ template<class Y> void reset( shared_ptr<Y> const & r, element_type * p )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
++#endif
+ this_type( r, p ).swap( *this );
+ }
+
diff --git a/tools/patches/boost-1.62-ptr-debug.patch b/tools/patches/boost-1.62-ptr-debug.patch
new file mode 100644
index 0000000000..057c587a2b
--- /dev/null
+++ b/tools/patches/boost-1.62-ptr-debug.patch
@@ -0,0 +1,289 @@
+--- shared_ptr.hpp.orig 2016-11-12 13:46:50.000000000 -0500
++++ shared_ptr.hpp 2018-12-19 10:33:00.022538689 -0500
+@@ -53,6 +53,13 @@
+ #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+ #endif
+
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++void boost_debug_shared_ptr_operator_equals (void const *, void const *, int, void const*, int);
++void boost_debug_shared_ptr_reset (void const *, void const *, int, void const*, int);
++void boost_debug_shared_ptr_destructor (void const *, volatile void const *, int);
++void boost_debug_shared_ptr_constructor (void const *, volatile void const *, int);
++#endif
++
+ namespace boost
+ {
+
+@@ -283,20 +290,29 @@
+ {
+ boost::detail::shared_count( p ).swap( pn );
+ boost::detail::sp_enable_shared_from_this( ppx, p, p );
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (ppx, ppx->get(), ppx->use_count());
++#endif
+ }
+
+ #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+
+-template< class T, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[] > * /*ppx*/, Y * p, boost::detail::shared_count & pn )
++template< class T, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[] > * ppx, Y * p, boost::detail::shared_count & pn )
+ {
+ sp_assert_convertible< Y[], T[] >();
+ boost::detail::shared_count( p, boost::checked_array_deleter< T >() ).swap( pn );
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ /* no code for this yet - shared_ptr to array of T */
++#endif
+ }
+
+ template< class T, std::size_t N, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[N] > * /*ppx*/, Y * p, boost::detail::shared_count & pn )
+ {
+ sp_assert_convertible< Y[N], T[N] >();
+ boost::detail::shared_count( p, boost::checked_array_deleter< T >() ).swap( pn );
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ /* no code for this yet - shared_ptr to array of T */
++#endif
+ }
+
+ #endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+@@ -306,6 +322,9 @@
+ template< class T, class Y > inline void sp_deleter_construct( boost::shared_ptr< T > * ppx, Y * p )
+ {
+ boost::detail::sp_enable_shared_from_this( ppx, p, p );
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (ppx, ppx->get(), ppx->use_count());
++#endif
+ }
+
+ #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+@@ -313,11 +332,17 @@
+ template< class T, class Y > inline void sp_deleter_construct( boost::shared_ptr< T[] > * /*ppx*/, Y * /*p*/ )
+ {
+ sp_assert_convertible< Y[], T[] >();
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ /* no code for this yet - shared_ptr to array of T */
++#endif
+ }
+
+ template< class T, std::size_t N, class Y > inline void sp_deleter_construct( boost::shared_ptr< T[N] > * /*ppx*/, Y * /*p*/ )
+ {
+ sp_assert_convertible< Y[N], T[N] >();
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ /* no code for this yet - shared_ptr to array of T */
++#endif
+ }
+
+ #endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+@@ -346,12 +371,20 @@
+
+ shared_ptr() BOOST_NOEXCEPT : px( 0 ), pn() // never throws in 1.30+
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ /* default constructor case */
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ #if !defined( BOOST_NO_CXX11_NULLPTR )
+
+ shared_ptr( boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT : px( 0 ), pn() // never throws
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ /* explicit nullptr constructor case */
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ #endif
+@@ -392,11 +425,20 @@
+
+ template<class D, class A> shared_ptr( boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( p, d, a )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ #endif
+
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ ~shared_ptr() {
++ boost_debug_shared_ptr_destructor (this, get(), use_count());
++ }
++#else
+ // generated copy constructor, destructor are fine...
++#endif /* BOOST_SP_ENABLE_DEBUG_HOOKS */
+
+ #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
+
+@@ -404,6 +446,9 @@
+
+ shared_ptr( shared_ptr const & r ) BOOST_NOEXCEPT : px( r.px ), pn( r.pn )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ }
+
+ #endif
+@@ -413,6 +458,9 @@
+ {
+ boost::detail::sp_assert_convertible< Y, T >();
+
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.px, -1);
++#endif
+ // it is now safe to copy r.px, as pn(r.pn) did not throw
+ px = r.px;
+ }
+@@ -423,6 +471,9 @@
+ {
+ if( !pn.empty() )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.px, -1);
++#endif
+ px = r.px;
+ }
+ }
+@@ -440,6 +491,9 @@
+ BOOST_NOEXCEPT : px( r.px ), pn( r.pn )
+ {
+ boost::detail::sp_assert_convertible< Y, T >();
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ }
+
+ // aliasing
+@@ -532,6 +586,9 @@
+ template<class Y>
+ shared_ptr & operator=(shared_ptr<Y> const & r) BOOST_NOEXCEPT
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type(r).swap(*this);
+ return *this;
+ }
+@@ -543,6 +600,9 @@
+ template<class Y>
+ shared_ptr & operator=( std::auto_ptr<Y> & r )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type( r ).swap( *this );
+ return *this;
+ }
+@@ -552,6 +612,9 @@
+ template<class Y>
+ shared_ptr & operator=( std::auto_ptr<Y> && r )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type( static_cast< std::auto_ptr<Y> && >( r ) ).swap( *this );
+ return *this;
+ }
+@@ -574,6 +637,9 @@
+ template<class Y, class D>
+ shared_ptr & operator=( std::unique_ptr<Y, D> && r )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type( static_cast< std::unique_ptr<Y, D> && >( r ) ).swap(*this);
+ return *this;
+ }
+@@ -607,6 +673,9 @@
+
+ shared_ptr( shared_ptr && r ) BOOST_NOEXCEPT : px( r.px ), pn()
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ pn.swap( r.pn );
+ r.px = 0;
+ }
+@@ -625,12 +694,18 @@
+ {
+ boost::detail::sp_assert_convertible< Y, T >();
+
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ pn.swap( r.pn );
+ r.px = 0;
+ }
+
+ shared_ptr & operator=( shared_ptr && r ) BOOST_NOEXCEPT
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type( static_cast< shared_ptr && >( r ) ).swap( *this );
+ return *this;
+ }
+@@ -638,6 +713,9 @@
+ template<class Y>
+ shared_ptr & operator=( shared_ptr<Y> && r ) BOOST_NOEXCEPT
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type( static_cast< shared_ptr<Y> && >( r ) ).swap( *this );
+ return *this;
+ }
+@@ -656,6 +734,9 @@
+
+ shared_ptr & operator=( boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT // never throws
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_reset (this, get(), use_count(), 0, 0);
++#endif
+ this_type().swap(*this);
+ return *this;
+ }
+@@ -664,27 +745,42 @@
+
+ void reset() BOOST_NOEXCEPT // never throws in 1.30+
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_reset (this, get(), use_count(), 0, 0);
++#endif
+ this_type().swap(*this);
+ }
+
+ template<class Y> void reset( Y * p ) // Y must be complete
+ {
+ BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
++#endif
+ this_type( p ).swap( *this );
+ }
+
+ template<class Y, class D> void reset( Y * p, D d )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
++#endif
+ this_type( p, d ).swap( *this );
+ }
+
+ template<class Y, class D, class A> void reset( Y * p, D d, A a )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
++#endif
+ this_type( p, d, a ).swap( *this );
+ }
+
+ template<class Y> void reset( shared_ptr<Y> const & r, element_type * p )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
++#endif
+ this_type( r, p ).swap( *this );
+ }
+
diff --git a/tools/patches/boost-ptr-debug.patch b/tools/patches/boost-ptr-debug.patch
new file mode 100644
index 0000000000..e32975ab2b
--- /dev/null
+++ b/tools/patches/boost-ptr-debug.patch
@@ -0,0 +1,275 @@
+--- shared_ptr.hpp.clean 2014-03-12 10:32:10.054102239 -0400
++++ shared_ptr.hpp 2014-03-12 10:34:09.413172291 -0400
+@@ -51,6 +51,13 @@
+ #endif
+ #endif
+
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++void boost_debug_shared_ptr_operator_equals (void const *, void const *, int, void const*, int);
++void boost_debug_shared_ptr_reset (void const *, void const *, int, void const*, int);
++void boost_debug_shared_ptr_destructor (void const *, void const *, int);
++void boost_debug_shared_ptr_constructor (void const *, void const *, int);
++#endif
++
+ namespace boost
+ {
+
+@@ -177,12 +184,31 @@
+
+ shared_ptr(): px(0), pn() // never throws in 1.30+
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
++ }
++
++ ~shared_ptr()
++ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_destructor (this, get(), use_count());
++#endif
++ }
++
++ shared_ptr(const shared_ptr<T>& r ) : px (r.px), pn (r.pn) {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ template<class Y>
+ explicit shared_ptr( Y * p ): px( p ), pn( p ) // Y must be complete
+ {
+ boost::detail::sp_enable_shared_from_this( this, p, p );
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ //
+@@ -193,7 +219,10 @@
+
+ template<class Y, class D> shared_ptr(Y * p, D d): px(p), pn(p, d)
+ {
+- boost::detail::sp_enable_shared_from_this( this, p, p );
++ boost::detail::sp_enable_shared_from_this( this, p, p );
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ // As above, but with allocator. A's copy constructor shall not throw.
+@@ -201,6 +230,9 @@
+ template<class Y, class D, class A> shared_ptr( Y * p, D d, A a ): px( p ), pn( p, d, a )
+ {
+ boost::detail::sp_enable_shared_from_this( this, p, p );
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ // generated copy constructor, destructor are fine...
+@@ -220,6 +252,9 @@
+ {
+ // it is now safe to copy r.px, as pn(r.pn) did not throw
+ px = r.px;
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ template<class Y>
+@@ -229,6 +264,9 @@
+ {
+ px = r.px;
+ }
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ template<class Y>
+@@ -243,22 +281,34 @@
+ #endif
+ : px( r.px ), pn( r.pn ) // never throws
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ // aliasing
+ template< class Y >
+ shared_ptr( shared_ptr<Y> const & r, T * p ): px( p ), pn( r.pn ) // never throws
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ template<class Y>
+ shared_ptr(shared_ptr<Y> const & r, boost::detail::static_cast_tag): px(static_cast<element_type *>(r.px)), pn(r.pn)
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ template<class Y>
+ shared_ptr(shared_ptr<Y> const & r, boost::detail::const_cast_tag): px(const_cast<element_type *>(r.px)), pn(r.pn)
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ template<class Y>
+@@ -268,6 +318,9 @@
+ {
+ pn = boost::detail::shared_count();
+ }
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ template<class Y>
+@@ -277,6 +330,9 @@
+ {
+ boost::throw_exception(std::bad_cast());
+ }
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ #ifndef BOOST_NO_AUTO_PTR
+@@ -287,6 +343,9 @@
+ Y * tmp = r.get();
+ pn = boost::detail::shared_count(r);
+ boost::detail::sp_enable_shared_from_this( this, tmp, tmp );
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ #if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+@@ -297,6 +356,9 @@
+ typename Ap::element_type * tmp = r.get();
+ pn = boost::detail::shared_count( r );
+ boost::detail::sp_enable_shared_from_this( this, tmp, tmp );
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+
+@@ -308,6 +370,9 @@
+
+ shared_ptr & operator=( shared_ptr const & r ) // never throws
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type(r).swap(*this);
+ return *this;
+ }
+@@ -317,6 +382,9 @@
+ template<class Y>
+ shared_ptr & operator=(shared_ptr<Y> const & r) // never throws
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type(r).swap(*this);
+ return *this;
+ }
+@@ -328,6 +396,9 @@
+ template<class Y>
+ shared_ptr & operator=( std::auto_ptr<Y> & r )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type(r).swap(*this);
+ return *this;
+ }
+@@ -354,6 +425,9 @@
+ {
+ pn.swap( r.pn );
+ r.px = 0;
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ template<class Y>
+@@ -370,10 +444,16 @@
+ {
+ pn.swap( r.pn );
+ r.px = 0;
+++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
+++#endif
+ }
+
+ shared_ptr & operator=( shared_ptr && r ) // never throws
+ {
+++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
+++#endif
+ this_type( static_cast< shared_ptr && >( r ) ).swap( *this );
+ return *this;
+ }
+@@ -381,6 +461,9 @@
+ template<class Y>
+ shared_ptr & operator=( shared_ptr<Y> && r ) // never throws
+ {
+++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
+++#endif
+ this_type( static_cast< shared_ptr<Y> && >( r ) ).swap( *this );
+ return *this;
+ }
+@@ -389,27 +472,42 @@
+
+ void reset() // never throws in 1.30+
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_reset (this, get(), use_count(), 0, 0);
++#endif
+ this_type().swap(*this);
+ }
+
+ template<class Y> void reset(Y * p) // Y must be complete
+ {
+ BOOST_ASSERT(p == 0 || p != px); // catch self-reset errors
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
++#endif
+ this_type(p).swap(*this);
+ }
+
+ template<class Y, class D> void reset( Y * p, D d )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
++#endif
+ this_type( p, d ).swap( *this );
+ }
+
+ template<class Y, class D, class A> void reset( Y * p, D d, A a )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
++#endif
+ this_type( p, d, a ).swap( *this );
+ }
+
+ template<class Y> void reset( shared_ptr<Y> const & r, T * p )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_reset (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type( r, p ).swap( *this );
+ }
+
diff --git a/tools/patches/gtk-osx.patch b/tools/patches/gtk-osx.patch
new file mode 100644
index 0000000000..013e4561bb
--- /dev/null
+++ b/tools/patches/gtk-osx.patch
@@ -0,0 +1,542 @@
+Index: gtk/gtktreeview.c
+===================================================================
+--- gtk/gtktreeview.c (revision 21770)
++++ gtk/gtktreeview.c (working copy)
+@@ -2534,6 +2534,7 @@
+ gboolean row_double_click = FALSE;
+ gboolean rtl;
+ gboolean node_selected;
++ gboolean edits_allowed;
+
+ /* Empty tree? */
+ if (tree_view->priv->tree == NULL)
+@@ -2643,9 +2644,17 @@
+
+ tree_view->priv->focus_column = column;
+
++ /* ARDOUR HACK */
++
++ if (g_object_get_data (G_OBJECT(tree_view), "mouse-edits-require-mod1")) {
++ edits_allowed = (event->state & GDK_MOD1_MASK);
++ } else {
++ /* regular GTK design: do edits if none of the default modifiers are active */
++ edits_allowed = !(event->state & gtk_accelerator_get_default_mod_mask ());
++ }
++
+ /* decide if we edit */
+- if (event->type == GDK_BUTTON_PRESS && event->button == 1 &&
+- !(event->state & gtk_accelerator_get_default_mod_mask ()))
++ if (event->type == GDK_BUTTON_PRESS && event->button == 1 && edits_allowed)
+ {
+ GtkTreePath *anchor;
+ GtkTreeIter iter;
+Index: gtk/gtkquartz.c
+===================================================================
+--- gtk/gtkquartz.c (revision 21770)
++++ gtk/gtkquartz.c (working copy)
+@@ -24,6 +24,23 @@
+ #include "gtkalias.h"
+
+ NSImage *
++_gtk_quartz_create_image_from_drawable (GdkDrawable* drawable)
++{
++ GdkPixbuf* pixbuf;
++ NSImage* image = NULL;
++
++ pixbuf = gdk_pixbuf_get_from_drawable (NULL, drawable, NULL,
++ 0, 0, /* src */
++ 0, 0, /* dst */
++ -1, -1);
++ if (pixbuf)
++ image = _gtk_quartz_create_image_from_pixbuf (pixbuf);
++
++ return image;
++}
++
++
++NSImage *
+ _gtk_quartz_create_image_from_pixbuf (GdkPixbuf *pixbuf)
+ {
+ CGColorSpaceRef colorspace;
+Index: gtk/gtkquartz.h
+===================================================================
+--- gtk/gtkquartz.h (revision 21770)
++++ gtk/gtkquartz.h (working copy)
+@@ -41,6 +41,7 @@
+ GtkSelectionData *selection_data);
+
+ NSImage *_gtk_quartz_create_image_from_pixbuf (GdkPixbuf *pixbuf);
++NSImage *_gtk_quartz_create_image_from_drawable (GdkDrawable *drawable);
+
+ G_END_DECLS
+
+Index: gtk/gtktooltip.c
+===================================================================
+--- gtk/gtktooltip.c (revision 21770)
++++ gtk/gtktooltip.c (working copy)
+@@ -426,6 +426,7 @@
+ gtk_tooltip_trigger_tooltip_query (GdkDisplay *display)
+ {
+ gint x, y;
++ gint rx, ry;
+ GdkWindow *window;
+ GdkEvent event;
+
+@@ -434,10 +435,14 @@
+ if (!window)
+ return;
+
++ gdk_window_get_origin (window, &rx, &ry);
++
+ event.type = GDK_MOTION_NOTIFY;
+ event.motion.window = window;
+ event.motion.x = x;
++ event.motion.x_root = rx + x;
+ event.motion.y = y;
++ event.motion.y_root = ry + y;
+ event.motion.is_hint = FALSE;
+
+ _gtk_tooltip_handle_event (&event);
+Index: gtk/gtkdnd-quartz.c
+===================================================================
+--- gtk/gtkdnd-quartz.c (revision 21770)
++++ gtk/gtkdnd-quartz.c (working copy)
+@@ -63,6 +63,11 @@
+ gboolean create);
+ static void gtk_drag_source_site_destroy (gpointer data);
+
++static GtkDragSourceInfo *gtk_drag_get_source_info (GdkDragContext *context,
++ gboolean create);
++
++extern GdkDragContext *gdk_quartz_drag_source_context(); /* gdk/quartz/gdkdnd-quartz.c */
++
+ struct _GtkDragSourceSite
+ {
+ GdkModifierType start_button_mask;
+@@ -89,13 +94,16 @@
+
+ struct _GtkDragSourceInfo
+ {
++ GtkWidget *source_widget;
+ GtkWidget *widget;
+ GtkTargetList *target_list; /* Targets for drag data */
+ GdkDragAction possible_actions; /* Actions allowed by source */
+ GdkDragContext *context; /* drag context */
+-
++ NSEvent *nsevent; /* what started it */
+ gint hot_x, hot_y; /* Hot spot for drag */
+ GdkPixbuf *icon_pixbuf;
++ gboolean success;
++ gboolean delete;
+ };
+
+ struct _GtkDragDestSite
+@@ -223,7 +231,9 @@
+ selection_data,
+ 0, time);
+ }
++
+
++
+ if (site && site->flags & GTK_DEST_DEFAULT_DROP)
+ {
+ gtk_drag_finish (context,
+@@ -233,19 +243,24 @@
+ }
+ }
+
+-
+-GtkWidget *
+-gtk_drag_get_source_widget (GdkDragContext *context)
+-{
+- return NULL;
+-}
+-
+ void
+ gtk_drag_finish (GdkDragContext *context,
+ gboolean success,
+ gboolean del,
+ guint32 time)
+ {
++ GtkDragSourceInfo *info;
++ GdkDragContext* source_context = gdk_quartz_drag_source_context ();
++
++ if (source_context)
++ {
++ info = gtk_drag_get_source_info (source_context, FALSE);
++ if (info)
++ {
++ info->success = success;
++ info->delete = del;
++ }
++ }
+ }
+
+ static void
+@@ -307,6 +322,22 @@
+ g_object_set_qdata (G_OBJECT (context), dest_info_quark, NULL);
+ }
+
++GtkWidget *
++gtk_drag_get_source_widget (GdkDragContext *context)
++{
++ GtkDragSourceInfo *info;
++ GdkDragContext* real_source_context = gdk_quartz_drag_source_context();
++
++ if (!real_source_context)
++ return NULL;
++
++ info = gtk_drag_get_source_info (real_source_context, FALSE);
++ if (!info)
++ return NULL;
++
++ return info->source_widget;
++}
++
+ /*************************************************************
+ * gtk_drag_highlight_expose:
+ * Callback for expose_event for highlighted widgets.
+@@ -857,6 +888,8 @@
+ gtk_drag_get_data (widget, context, target, time);
+ }
+
++ /* leave a note for the source-side context about the action chosen */
++
+ g_signal_emit_by_name (widget, "drag-drop",
+ context, x, y, time, &retval);
+
+@@ -1031,6 +1064,45 @@
+ return GDK_NONE;
+ }
+
++static gboolean
++gtk_drag_begin_idle (gpointer arg)
++{
++ GdkDragContext* context = (GdkDragContext*) arg;
++ GtkDragSourceInfo* info = gtk_drag_get_source_info (context, FALSE);
++ NSWindow *nswindow;
++ NSPasteboard *pasteboard;
++ GtkDragSourceOwner *owner;
++ NSPoint point;
++
++ g_assert (info != NULL);
++
++ pasteboard = [NSPasteboard pasteboardWithName:NSDragPboard];
++ owner = [[GtkDragSourceOwner alloc] initWithInfo:info];
++
++ [pasteboard declareTypes:_gtk_quartz_target_list_to_pasteboard_types (info->target_list) owner:owner];
++
++ if ((nswindow = get_toplevel_nswindow (info->source_widget)) == NULL)
++ return FALSE;
++
++ /* Ref the context. It's unreffed when the drag has been aborted */
++ g_object_ref (info->context);
++
++ /* FIXME: If the event isn't a mouse event, use the global cursor position instead */
++ point = [info->nsevent locationInWindow];
++
++ [nswindow dragImage:_gtk_quartz_create_image_from_pixbuf (info->icon_pixbuf)
++ at:point
++ offset:NSMakeSize(0, 0)
++ event:info->nsevent
++ pasteboard:pasteboard
++ source:nswindow
++ slideBack:YES];
++
++ [info->nsevent release];
++
++ return FALSE;
++}
++
+ static GdkDragContext *
+ gtk_drag_begin_internal (GtkWidget *widget,
+ GtkDragSourceSite *site,
+@@ -1042,16 +1114,13 @@
+ GtkDragSourceInfo *info;
+ GdkDragContext *context;
+ NSWindow *nswindow;
+- NSPasteboard *pasteboard;
+- GtkDragSourceOwner *owner;
+- NSEvent *nsevent;
+- NSPoint point;
+
+ context = gdk_drag_begin (NULL, NULL);
+ context->is_source = TRUE;
+
+ info = gtk_drag_get_source_info (context, TRUE);
+
++ info->source_widget = g_object_ref (widget);
+ info->widget = g_object_ref (widget);
+ info->target_list = target_list;
+ gtk_target_list_ref (target_list);
+@@ -1086,13 +1155,13 @@
+ GdkPixbuf *pixbuf;
+
+ pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 1, 1);
+- gdk_pixbuf_fill (pixbuf, 0xffffff);
+-
+- gtk_drag_set_icon_pixbuf (context,
+- pixbuf,
++ gdk_pixbuf_fill (pixbuf, 0xffffff);
++
++ gtk_drag_set_icon_pixbuf (context,
++ pixbuf,
+ 0, 0);
+
+- g_object_unref (pixbuf);
++ g_object_unref (pixbuf);
+ }
+ break;
+ case GTK_IMAGE_PIXBUF:
+@@ -1117,31 +1186,17 @@
+ }
+ }
+
+- gdk_pointer_ungrab (0);
+-
+- pasteboard = [NSPasteboard pasteboardWithName:NSDragPboard];
+- owner = [[GtkDragSourceOwner alloc] initWithInfo:info];
++ nswindow = get_toplevel_nswindow (widget);
++ info->nsevent = [nswindow currentEvent];
++ [info->nsevent retain];
+
+- [pasteboard declareTypes:_gtk_quartz_target_list_to_pasteboard_types (target_list) owner:owner];
++ /* drag will begin in an idle handler to avoid nested run loops */
+
+- /* Ref the context. It's unreffed when the drag has been aborted */
+- g_object_ref (info->context);
++ g_idle_add_full (G_PRIORITY_HIGH_IDLE, gtk_drag_begin_idle, context, NULL);
+
+- nswindow = get_toplevel_nswindow (widget);
++ gdk_pointer_ungrab (0);
+
+- /* FIXME: If the event isn't a mouse event, use the global cursor position instead */
+- nsevent = [nswindow currentEvent];
+- point = [nsevent locationInWindow];
+-
+- [nswindow dragImage:_gtk_quartz_create_image_from_pixbuf (info->icon_pixbuf)
+- at:point
+- offset:NSMakeSize(0, 0)
+- event:nsevent
+- pasteboard:pasteboard
+- source:nswindow
+- slideBack:YES];
+-
+- return info->context;
++ return context;
+ }
+
+ GdkDragContext *
+@@ -1668,7 +1723,20 @@
+ gint hot_x,
+ gint hot_y)
+ {
+- g_warning ("gtk_drag_set_icon_pixmap is not supported on Mac OS X");
++ GdkPixbuf *pixbuf;
++
++ g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
++ g_return_if_fail (context->is_source);
++ g_return_if_fail (GDK_IS_COLORMAP (colormap));
++ g_return_if_fail (GDK_IS_PIXMAP (pixmap));
++
++ pixbuf = gdk_pixbuf_get_from_drawable (NULL, pixmap, colormap,
++ 0, 0, /* src */
++ 0, 0, /* dst */
++ -1, -1);
++
++ gtk_drag_set_icon_pixbuf (context, pixbuf, hot_x, hot_y);
++ g_object_unref (pixbuf);
+ }
+
+ /**
+@@ -1760,6 +1828,9 @@
+ g_signal_emit_by_name (info->widget, "drag-end",
+ info->context);
+
++ if (info->source_widget)
++ g_object_unref (info->source_widget);
++
+ if (info->widget)
+ g_object_unref (info->widget);
+
+@@ -1781,6 +1852,10 @@
+ static void
+ gtk_drag_drop_finished (GtkDragSourceInfo *info)
+ {
++ if (info->success && info->delete)
++ g_signal_emit_by_name (info->source_widget, "drag-data-delete",
++ info->context);
++
+ /* Workaround for the fact that the NS API blocks until the drag is
+ * over. This way the context is still valid when returning from
+ * drag_begin, even if it will still be quite useless. See bug #501588.
+Index: gdk/quartz/gdkevents-quartz.c
+===================================================================
+--- gdk/quartz/gdkevents-quartz.c (revision 21770)
++++ gdk/quartz/gdkevents-quartz.c (working copy)
+@@ -112,6 +112,18 @@
+ return ((GdkEventPrivate *) event)->windowing_data;
+ }
+
++/* A category that exposes the protected carbon event for an NSEvent. */
++@interface NSEvent (GdkQuartzNSEvent)
++- (void *)gdk_quartz_event_ref;
++@end
++
++@implementation NSEvent (GdkQuartzNSEvent)
++- (void *)gdk_quartz_event_ref
++{
++ return _eventRef;
++}
++@end
++
+ void
+ _gdk_events_init (void)
+ {
+@@ -1668,6 +1680,65 @@
+ }
+
+ static gboolean
++_gdk_quartz_possibly_forward_accelerator (NSEvent* nsevent)
++{
++ /* Special-case menu shortcut events. We create command events for
++ * those and forward to the corresponding menu.
++ */
++ if ((!_gdk_quartz_keyboard_grab_window ||
++ (_gdk_quartz_keyboard_grab_window && keyboard_grab_owner_events)) &&
++ [nsevent type] == NSKeyDown)
++ {
++ EventRef event_ref;
++ MenuRef menu_ref;
++ MenuItemIndex index;
++
++ event_ref = [nsevent gdk_quartz_event_ref];
++ if (IsMenuKeyEvent (NULL, event_ref,
++ kMenuEventQueryOnly,
++ &menu_ref, &index))
++ {
++ MenuCommand menu_command;
++ HICommand hi_command;
++
++ if (GetMenuItemCommandID (menu_ref, index, &menu_command) != noErr)
++ return FALSE;
++
++ hi_command.commandID = menu_command;
++ hi_command.menu.menuRef = menu_ref;
++ hi_command.menu.menuItemIndex = index;
++
++ CreateEvent (NULL, kEventClassCommand, kEventCommandProcess,
++ 0, kEventAttributeUserEvent, &event_ref);
++ SetEventParameter (event_ref, kEventParamDirectObject,
++ typeHICommand,
++ sizeof (HICommand), &hi_command);
++
++ SendEventToEventTarget (event_ref, GetMenuEventTarget (menu_ref));
++
++ ReleaseEvent (event_ref);
++
++ return TRUE;
++ }
++ }
++ return FALSE;
++}
++
++gboolean
++gdk_quartz_possibly_forward (GdkEvent* event)
++{
++ NSEvent *nsevent;
++ g_return_val_if_fail (event != NULL, FALSE);
++
++ nsevent = ((GdkEventPrivate*)event)->windowing_data;
++
++ if (nsevent)
++ return _gdk_quartz_possibly_forward_accelerator (nsevent);
++
++ return FALSE;
++}
++
++static gboolean
+ gdk_event_translate (NSEvent *nsevent)
+ {
+ NSWindow *nswindow;
+Index: gdk/quartz/gdkdnd-quartz.c
+===================================================================
+--- gdk/quartz/gdkdnd-quartz.c (revision 21770)
++++ gdk/quartz/gdkdnd-quartz.c (working copy)
+@@ -101,6 +101,12 @@
+
+ GdkDragContext *_gdk_quartz_drag_source_context = NULL;
+
++GdkDragContext*
++gdk_quartz_drag_source_context()
++{
++ return _gdk_quartz_drag_source_context;
++}
++
+ GdkDragContext *
+ gdk_drag_begin (GdkWindow *window,
+ GList *targets)
+Index: gdk/quartz/GdkQuartzWindow.c
+===================================================================
+--- gdk/quartz/GdkQuartzWindow.c (revision 21770)
++++ gdk/quartz/GdkQuartzWindow.c (working copy)
+@@ -461,8 +461,29 @@
+ {
+ GdkDragAction result = 0;
+
++ /* GDK and Quartz drag operations do not map 1:1.
++ This mapping represents about the best that we
++ can come up.
++
++ Note that NSDragOperationPrivate and GDK_ACTION_PRIVATE
++ have almost opposite meanings: the GDK one means that the
++ destination is solely responsible for the action; the Quartz
++ one means that the source and destination will agree
++ privately on the action. NSOperationGeneric is close in meaning
++ to GDK_ACTION_PRIVATE but there is a problem: it will be
++ sent for any ordinary drag, and likely not understood
++ by any intra-widget drag (since the source & dest are the
++ same)
++ */
++
+ if (operation & NSDragOperationGeneric)
++ result |= GDK_ACTION_MOVE;
++ if (operation & NSDragOperationCopy)
+ result |= GDK_ACTION_COPY;
++ if (operation & NSDragOperationMove)
++ result |= GDK_ACTION_MOVE;
++ if (operation & NSDragOperationLink)
++ result |= GDK_ACTION_LINK;
+
+ return result;
+ }
+@@ -474,6 +495,10 @@
+
+ if (action & GDK_ACTION_COPY)
+ result |= NSDragOperationCopy;
++ if (action & GDK_ACTION_LINK)
++ result |= NSDragOperationLink;
++ if (action & GDK_ACTION_MOVE)
++ result |= NSDragOperationMove;
+
+ return result;
+ }
+@@ -485,6 +510,7 @@
+
+ GDK_DRAG_CONTEXT_PRIVATE (current_context)->dragging_info = sender;
+ current_context->suggested_action = drag_operation_to_drag_action ([sender draggingSourceOperationMask]);
++ current_context->actions = current_context->suggested_action;
+ }
+
+ - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
+@@ -510,6 +536,10 @@
+
+ - (void)draggingEnded:(id <NSDraggingInfo>)sender
+ {
++ /* leave a note for the source about what action was taken */
++ if (_gdk_quartz_drag_source_context && current_context)
++ _gdk_quartz_drag_source_context->action = current_context->action;
++
+ if (current_context)
+ g_object_unref (current_context);
+ current_context = NULL;
diff --git a/tools/patches/gtkdnd-quartz.patch b/tools/patches/gtkdnd-quartz.patch
new file mode 100644
index 0000000000..07723ad533
--- /dev/null
+++ b/tools/patches/gtkdnd-quartz.patch
@@ -0,0 +1,55 @@
+--- old/gtk+-2.24.23/gtk/gtkdnd-quartz.c 2013-10-16 11:29:55.000000000 -0400
++++ new/gtk+-2.24.23/gtk/gtkdnd-quartz.c 2015-07-20 14:53:33.000000000 -0400
+@@ -1928,16 +1928,29 @@
+ static gboolean
+ drag_drop_finished_idle_cb (gpointer data)
+ {
+- gtk_drag_source_info_destroy (data);
++ GtkDragSourceInfo* info = (GtkDragSourceInfo*) data;
++ if (info->success)
++ {
++ gtk_drag_source_info_destroy (data);
++ }
+ return FALSE;
+ }
+
+ static void
+-gtk_drag_drop_finished (GtkDragSourceInfo *info)
++gtk_drag_drop_finished (GtkDragSourceInfo *info, GtkDragResult result)
+ {
+- if (info->success && info->delete)
+- g_signal_emit_by_name (info->source_widget, "drag-data-delete",
+- info->context);
++ gboolean success = (result == GTK_DRAG_RESULT_SUCCESS);
++
++ if (!success) {
++ g_signal_emit_by_name (info->source_widget, "drag-failed",
++ info->context, GTK_DRAG_RESULT_NO_TARGET, &success);
++ }
++
++ if (success && info->delete) {
++ g_signal_emit_by_name (info->source_widget, "drag-data-delete",
++ info->context);
++ }
++
+
+ /* Workaround for the fact that the NS API blocks until the drag is
+ * over. This way the context is still valid when returning from
+@@ -1963,6 +1976,7 @@
+ {
+ GtkDragSourceInfo *info;
+ GdkDragContext *context;
++ GtkDragResult result;
+
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (event != NULL);
+@@ -1975,7 +1989,8 @@
+ switch (event->type)
+ {
+ case GDK_DROP_FINISHED:
+- gtk_drag_drop_finished (info);
++ result = (gdk_drag_context_get_dest_window (context) != NULL) ? GTK_DRAG_RESULT_SUCCESS : GTK_DRAG_RESULT_NO_TARGET;
++ gtk_drag_drop_finished (info, result);
+ break;
+ default:
+ g_assert_not_reached ();
diff --git a/tools/patches/shared_ptr.patch b/tools/patches/shared_ptr.patch
new file mode 100644
index 0000000000..ff397b5e85
--- /dev/null
+++ b/tools/patches/shared_ptr.patch
@@ -0,0 +1,275 @@
+--- shared_ptr.hpp.KEEP 2011-02-09 11:54:05.203963701 -0500
++++ shared_ptr.hpp 2011-02-10 08:27:24.643133773 -0500
+@@ -55,6 +55,13 @@
+ # pragma warning(disable:4284) // odd return type for operator->
+ #endif
+
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++void boost_debug_shared_ptr_operator_equals (void const *, void const *, int, void const*, int);
++void boost_debug_shared_ptr_reset (void const *, void const *, int, void const*, int);
++void boost_debug_shared_ptr_destructor (void const *, void const *, int);
++void boost_debug_shared_ptr_constructor (void const *, void const *, int);
++#endif
++
+ namespace boost
+ {
+
+@@ -181,12 +188,31 @@
+
+ shared_ptr(): px(0), pn() // never throws in 1.30+
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
++ }
++
++ ~shared_ptr()
++ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_destructor (this, get(), use_count());
++#endif
++ }
++
++ shared_ptr(const shared_ptr<T>& r ) : px (r.px), pn (r.pn) {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ template<class Y>
+ explicit shared_ptr( Y * p ): px( p ), pn( p ) // Y must be complete
+ {
+ boost::detail::sp_enable_shared_from_this( this, p, p );
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ //
+@@ -197,7 +223,10 @@
+
+ template<class Y, class D> shared_ptr(Y * p, D d): px(p), pn(p, d)
+ {
+- boost::detail::sp_enable_shared_from_this( this, p, p );
++ boost::detail::sp_enable_shared_from_this( this, p, p );
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, 9249 /*use_count()*/);
++#endif
+ }
+
+ // As above, but with allocator. A's copy constructor shall not throw.
+@@ -205,6 +234,9 @@
+ template<class Y, class D, class A> shared_ptr( Y * p, D d, A a ): px( p ), pn( p, d, a )
+ {
+ boost::detail::sp_enable_shared_from_this( this, p, p );
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ // generated copy constructor, destructor are fine
+@@ -214,6 +246,9 @@
+ {
+ // it is now safe to copy r.px, as pn(r.pn) did not throw
+ px = r.px;
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ template<class Y>
+@@ -223,6 +258,9 @@
+ {
+ px = r.px;
+ }
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ template<class Y>
+@@ -237,22 +275,34 @@
+ #endif
+ : px( r.px ), pn( r.pn ) // never throws
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ // aliasing
+ template< class Y >
+ shared_ptr( shared_ptr<Y> const & r, T * p ): px( p ), pn( r.pn ) // never throws
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ template<class Y>
+ shared_ptr(shared_ptr<Y> const & r, boost::detail::static_cast_tag): px(static_cast<element_type *>(r.px)), pn(r.pn)
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ template<class Y>
+ shared_ptr(shared_ptr<Y> const & r, boost::detail::const_cast_tag): px(const_cast<element_type *>(r.px)), pn(r.pn)
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ template<class Y>
+@@ -262,6 +312,9 @@
+ {
+ pn = boost::detail::shared_count();
+ }
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ template<class Y>
+@@ -271,6 +324,9 @@
+ {
+ boost::throw_exception(std::bad_cast());
+ }
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ #ifndef BOOST_NO_AUTO_PTR
+@@ -281,6 +337,9 @@
+ Y * tmp = r.get();
+ pn = boost::detail::shared_count(r);
+ boost::detail::sp_enable_shared_from_this( this, tmp, tmp );
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ #if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+@@ -291,6 +350,9 @@
+ typename Ap::element_type * tmp = r.get();
+ pn = boost::detail::shared_count( r );
+ boost::detail::sp_enable_shared_from_this( this, tmp, tmp );
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+
+@@ -302,6 +364,9 @@
+
+ shared_ptr & operator=( shared_ptr const & r ) // never throws
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type(r).swap(*this);
+ return *this;
+ }
+@@ -311,6 +376,9 @@
+ template<class Y>
+ shared_ptr & operator=(shared_ptr<Y> const & r) // never throws
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type(r).swap(*this);
+ return *this;
+ }
+@@ -322,6 +390,9 @@
+ template<class Y>
+ shared_ptr & operator=( std::auto_ptr<Y> & r )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type(r).swap(*this);
+ return *this;
+ }
+@@ -348,6 +419,9 @@
+ {
+ pn.swap( r.pn );
+ r.px = 0;
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ template<class Y>
+@@ -364,10 +438,16 @@
+ {
+ pn.swap( r.pn );
+ r.px = 0;
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_constructor (this, px, use_count());
++#endif
+ }
+
+ shared_ptr & operator=( shared_ptr && r ) // never throws
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type( static_cast< shared_ptr && >( r ) ).swap( *this );
+ return *this;
+ }
+@@ -375,6 +455,9 @@
+ template<class Y>
+ shared_ptr & operator=( shared_ptr<Y> && r ) // never throws
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_operator_equals (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type( static_cast< shared_ptr<Y> && >( r ) ).swap( *this );
+ return *this;
+ }
+@@ -383,27 +466,42 @@
+
+ void reset() // never throws in 1.30+
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_reset (this, get(), use_count(), 0, 0);
++#endif
+ this_type().swap(*this);
+ }
+
+ template<class Y> void reset(Y * p) // Y must be complete
+ {
+ BOOST_ASSERT(p == 0 || p != px); // catch self-reset errors
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
++#endif
+ this_type(p).swap(*this);
+ }
+
+ template<class Y, class D> void reset( Y * p, D d )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
++#endif
+ this_type( p, d ).swap( *this );
+ }
+
+ template<class Y, class D, class A> void reset( Y * p, D d, A a )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_reset (this, get(), use_count(), p, 0);
++#endif
+ this_type( p, d, a ).swap( *this );
+ }
+
+ template<class Y> void reset( shared_ptr<Y> const & r, T * p )
+ {
++#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
++ boost_debug_shared_ptr_reset (this, get(), use_count(), r.get(), r.use_count());
++#endif
+ this_type( r, p ).swap( *this );
+ }
+
diff --git a/tools/patches/waf-str.patch b/tools/patches/waf-str.patch
new file mode 100644
index 0000000000..8d37f68d32
--- /dev/null
+++ b/tools/patches/waf-str.patch
@@ -0,0 +1,11 @@
+--- a/waflib/Build.py 2020-01-21 15:01:13.864899388 +0100
++++ b/waflib/Build.py 2020-01-21 15:01:59.573030630 +0100
+@@ -953,7 +953,7 @@
+ tsk.link = kw.get('link', '') or kw.get('install_from', '')
+ tsk.relative_trick = kw.get('relative_trick', False)
+ tsk.type = kw['type']
+- tsk.install_to = tsk.dest = kw['install_to']
++ tsk.install_to = tsk.dest = str(kw['install_to'])
+ tsk.install_from = kw['install_from']
+ tsk.relative_base = kw.get('cwd') or kw.get('relative_base', self.path)
+ tsk.install_user = kw.get('install_user')
diff --git a/tools/patches/waflib-tar.patch b/tools/patches/waflib-tar.patch
new file mode 100644
index 0000000000..9858590d56
--- /dev/null
+++ b/tools/patches/waflib-tar.patch
@@ -0,0 +1,11 @@
+--- .waf-1.6.11-06ee4b7efbeab1252ed3b11499834d2a/waflib/Scripting.py~ 2016-07-14 16:34:10.741387174 -0400
++++ .waf-1.6.11-06ee4b7efbeab1252ed3b11499834d2a/waflib/Scripting.py 2016-08-11 11:45:11.833131519 -0400
+@@ -252,7 +252,7 @@
+ return node.abspath()
+ def add_tar_file(self,x,tar):
+ p=self.get_tar_path(x)
+- tinfo=tar.gettarinfo(name=p,arcname=self.get_tar_prefix()+'/'+x.path_from(self.base_path))
++ tinfo=tar.gettarinfo(name=p,arcname=self.get_tar_prefix()+'/'+(x.path_from(self.base_path)).decode ('utf8'))
+ tinfo.uid=0
+ tinfo.gid=0
+ tinfo.uname='root'
diff --git a/tools/patches/waflib.patch b/tools/patches/waflib.patch
new file mode 100644
index 0000000000..c5f2f18c83
--- /dev/null
+++ b/tools/patches/waflib.patch
@@ -0,0 +1,13 @@
+diff --git a/waflib/Tools/c_config.py b/waflib/Tools/c_config.py
+index ee1c5c2..0672f3d 100644
+--- a/waflib/Tools/c_config.py
++++ b/waflib/Tools/c_config.py
+@@ -150,6 +150,8 @@ def parse_flags(self, line, uselib, env=None, force_static=False):
+ elif st == '-L':
+ if not ot: ot = lst.pop(0)
+ appu('LIBPATH_' + uselib, [ot])
++ elif x.startswith('-std=c++'):
++ app('CXXFLAGS_' + uselib, [x])
+ elif x == '-pthread' or x.startswith('+') or x.startswith('-std'):
+ app('CFLAGS_' + uselib, [x])
+ app('CXXFLAGS_' + uselib, [x])