[kicad] Add upstream patch to support new Boost.Context API

Petr Machata pmachata at fedoraproject.org
Tue Feb 3 23:32:30 UTC 2015


commit f0302eead2eec2420d7a602c7f67f572150968bb
Author: Petr Machata <pmachata at redhat.com>
Date:   Wed Feb 4 00:29:13 2015 +0100

    Add upstream patch to support new Boost.Context API

 kicad-2014.03.13-boost-context.patch |   90 ++++++++++++++++++++++++++++++++++
 kicad.spec                           |    4 ++
 2 files changed, 94 insertions(+), 0 deletions(-)
---
diff --git a/kicad-2014.03.13-boost-context.patch b/kicad-2014.03.13-boost-context.patch
new file mode 100644
index 0000000..8e1b3c2
--- /dev/null
+++ b/kicad-2014.03.13-boost-context.patch
@@ -0,0 +1,90 @@
+=== modified file 'include/tool/coroutine.h'
+--- include/tool/coroutine.h	2014-07-09 11:50:27 +0000
++++ include/tool/coroutine.h	2014-08-26 09:16:56 +0000
+@@ -28,6 +28,7 @@
+ #include <cstdlib>
+ 
+ #include <boost/context/fcontext.hpp>
++#include <boost/version.hpp>
+ 
+ #include "delegate.h"
+ 
+@@ -86,6 +89,11 @@
+         if( m_saved )
+             delete m_saved;
+ 
++#if BOOST_VERSION >= 105600
++        if( m_self )
++            delete m_self;
++#endif
++
+         if( m_stack )
+             free( m_stack );
+     }
+@@ -99,7 +107,7 @@
+      */
+     void Yield()
+     {
+-        boost::context::jump_fcontext( m_self, m_saved, 0 );
++        jump( m_self, m_saved, 0 );
+     }
+ 
+     /**
+@@ -111,7 +119,7 @@
+     void Yield( ReturnType& aRetVal )
+     {
+         m_retVal = aRetVal;
+-        boost::context::jump_fcontext( m_self, m_saved, 0 );
++        jump( m_self, m_saved, 0 );
+     }
+ 
+     /**
+@@ -139,12 +145,17 @@ public:
+         void* sp = (void*) ( ( ( (ptrdiff_t) m_stack ) + m_stackSize - 0xf ) & ( ~0x0f ) );
+ 
+         m_args = &aArgs;
++#if BOOST_VERSION >= 105600
++        m_self = new boost::context::fcontext_t();
++        *m_self = boost::context::make_fcontext( sp, m_stackSize, callerStub );
++#else
+         m_self = boost::context::make_fcontext( sp, m_stackSize, callerStub );
++#endif
+         m_saved = new boost::context::fcontext_t();
+ 
+         m_running = true;
+         // off we go!
+-        boost::context::jump_fcontext( m_saved, m_self, reinterpret_cast<intptr_t>( this ) );
++        jump( m_saved, m_self, reinterpret_cast<intptr_t>( this ) );
+         return m_running;
+     }
+ 
+@@ -157,7 +176,7 @@
+      */
+     bool Resume()
+     {
+-        boost::context::jump_fcontext( m_saved, m_self, 0 );
++        jump( m_saved, m_self, 0 );
+ 
+         return m_running;
+     }
+@@ -197,7 +215,18 @@
+         cor->m_running = false;
+ 
+         // go back to wherever we came from.
+-        boost::context::jump_fcontext( cor->m_self, cor->m_saved, 0 );    // reinterpret_cast<intptr_t>( this ));
++        jump( cor->m_self, cor->m_saved, 0 );    // reinterpret_cast<intptr_t>( this ));
++    }
++
++    ///> Wrapper for jump_fcontext to assure compatibility between different boost versions
++    static inline intptr_t jump(boost::context::fcontext_t* aOld, boost::context::fcontext_t* aNew,
++                                intptr_t aP, bool aPreserveFPU = true )
++    {
++#if BOOST_VERSION >= 105600
++        return boost::context::jump_fcontext( aOld, *aNew, aP, aPreserveFPU );
++#else
++        return boost::context::jump_fcontext( aOld, aNew, aP, aPreserveFPU );
++#endif
+     }
+ 
+     template <typename T>
+
diff --git a/kicad.spec b/kicad.spec
index 5b7eb74..2a00991 100644
--- a/kicad.spec
+++ b/kicad.spec
@@ -29,6 +29,7 @@ Patch0:         pcb_calculator-desktop-fix.patch
 Patch1:         kicad-2014.03.13-nostrip.patch
 Patch2:         kicad-2014.03.13-fp-lib.patch
 Patch3:         kicad-2014.03.13-freerouting.patch
+Patch4:         kicad-2014.03.13-boost-context.patch
 
 BuildRequires:  desktop-file-utils
 BuildRequires:  wxGTK-devel
@@ -187,6 +188,7 @@ Documentation and tutorials for Kicad in Chinese
 %patch0 -p1
 %patch1 -p1
 %patch3 -p1
+%patch4 -p0
 
 cd %{name}-libraries-%{version}
 %patch2 -p1
@@ -375,6 +377,8 @@ update-mime-database %{?fedora:-n} %{_datadir}/mime &> /dev/null || :
 %changelog
 * Tue Jan 27 2015 Petr Machata <pmachata at redhat.com> - 2014.03.13-11.rev4744
 - Rebuild for boost 1.57.0
+- Add upstream patch to support new Boost.Context API
+  (kicad-2014.03.13-boost-context.patch)
 
 * Fri Jan 02 2015 Lubomir Rintel <lkundrak at v3.sk> - 2014.03.13-10.rev4744
 - Use local autorouter


More information about the scm-commits mailing list