mirror of
https://abf.rosa.ru/djam/kicad.git
synced 2025-02-23 10:12:48 +00:00
Add patch to fix build with new boost
This commit is contained in:
parent
a452bae88a
commit
a526808be4
2 changed files with 405 additions and 32 deletions
372
kicad-2015.03.21-boost-1.61.patch
Normal file
372
kicad-2015.03.21-boost-1.61.patch
Normal file
|
@ -0,0 +1,372 @@
|
|||
diff -urN kicad-2015.03.21/common/tool/tool_manager.cpp kicad-2015.03.21-patched/common/tool/tool_manager.cpp
|
||||
--- kicad-2015.03.21/common/tool/tool_manager.cpp 2015-03-21 23:21:48.000000000 +1000
|
||||
+++ kicad-2015.03.21-patched/common/tool/tool_manager.cpp 2016-12-06 22:29:28.103774738 +1000
|
||||
@@ -513,11 +513,11 @@
|
||||
if( st->cofunc )
|
||||
st->Push();
|
||||
|
||||
+ st->cofunc = new COROUTINE<int, const TOOL_EVENT&>( tr.second );
|
||||
+
|
||||
// as the state changes, the transition table has to be set up again
|
||||
st->transitions.clear();
|
||||
|
||||
- st->cofunc = new COROUTINE<int, const TOOL_EVENT&>( tr.second );
|
||||
-
|
||||
// got match? Run the handler.
|
||||
st->cofunc->Call( aEvent );
|
||||
|
||||
diff -urN kicad-2015.03.21/include/tool/coroutine.h kicad-2015.03.21-patched/include/tool/coroutine.h
|
||||
--- kicad-2015.03.21/include/tool/coroutine.h 2015-03-21 23:21:48.000000000 +1000
|
||||
+++ kicad-2015.03.21-patched/include/tool/coroutine.h 2016-12-06 22:29:28.105774738 +1000
|
||||
@@ -3,6 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -27,10 +28,15 @@
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
-#include <boost/context/fcontext.hpp>
|
||||
#include <boost/version.hpp>
|
||||
+#include <type_traits>
|
||||
|
||||
-#include "delegate.h"
|
||||
+#if BOOST_VERSION <= 106000
|
||||
+#include <boost/context/fcontext.hpp>
|
||||
+#else
|
||||
+#include <boost/context/execution_context.hpp>
|
||||
+#include <boost/context/protected_fixedsize_stack.hpp>
|
||||
+#endif
|
||||
|
||||
/**
|
||||
* Class COROUNTINE.
|
||||
@@ -53,13 +59,12 @@
|
||||
* See coroutine_example.cpp for sample code.
|
||||
*/
|
||||
|
||||
-template <class ReturnType, class ArgType>
|
||||
+template <typename ReturnType, typename ArgType>
|
||||
class COROUTINE
|
||||
{
|
||||
public:
|
||||
COROUTINE() :
|
||||
- m_saved( NULL ), m_self( NULL ), m_stack( NULL ), m_stackSize( c_defaultStackSize ),
|
||||
- m_running( false )
|
||||
+ COROUTINE( nullptr )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -69,8 +74,7 @@
|
||||
*/
|
||||
template <class T>
|
||||
COROUTINE( T* object, ReturnType(T::* ptr)( ArgType ) ) :
|
||||
- m_func( object, ptr ), m_self( NULL ), m_saved( NULL ), m_stack( NULL ),
|
||||
- m_stackSize( c_defaultStackSize ), m_running( false )
|
||||
+ COROUTINE( std::bind( ptr, object, std::placeholders::_1 ) )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -78,26 +82,40 @@
|
||||
* Constructor
|
||||
* Creates a coroutine from a delegate object
|
||||
*/
|
||||
- COROUTINE( DELEGATE<ReturnType, ArgType> aEntry ) :
|
||||
- m_func( aEntry ), m_saved( NULL ), m_self( NULL ), m_stack( NULL ),
|
||||
- m_stackSize( c_defaultStackSize ), m_running( false )
|
||||
+ COROUTINE( std::function<ReturnType(ArgType)> aEntry ) :
|
||||
+ m_func( std::move( aEntry ) ),
|
||||
+ m_running( false ),
|
||||
+#if BOOST_VERSION <= 106000
|
||||
+ m_stack( nullptr ),
|
||||
+ m_stackSize( c_defaultStackSize ),
|
||||
+#endif
|
||||
+ m_caller( nullptr ),
|
||||
+ m_callee( nullptr )
|
||||
{
|
||||
}
|
||||
|
||||
~COROUTINE()
|
||||
{
|
||||
- if( m_saved )
|
||||
- delete m_saved;
|
||||
-
|
||||
#if BOOST_VERSION >= 105600
|
||||
- if( m_self )
|
||||
- delete m_self;
|
||||
+ delete m_callee;
|
||||
#endif
|
||||
|
||||
+#if BOOST_VERSION <= 106000
|
||||
+ delete m_caller;
|
||||
+
|
||||
if( m_stack )
|
||||
free( m_stack );
|
||||
+#endif
|
||||
}
|
||||
|
||||
+private:
|
||||
+#if BOOST_VERSION <= 106000
|
||||
+ using context_type = boost::context::fcontext_t;
|
||||
+#else
|
||||
+ using context_type = boost::context::execution_context<COROUTINE*>;
|
||||
+#endif
|
||||
+
|
||||
+public:
|
||||
/**
|
||||
* Function Yield()
|
||||
*
|
||||
@@ -107,7 +125,12 @@
|
||||
*/
|
||||
void Yield()
|
||||
{
|
||||
- jump( m_self, m_saved, 0 );
|
||||
+#if BOOST_VERSION <= 106000
|
||||
+ jump( m_callee, m_caller, false );
|
||||
+#else
|
||||
+ auto result = (*m_caller)( this );
|
||||
+ *m_caller = std::move( std::get<0>( result ) );
|
||||
+#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,7 +142,11 @@
|
||||
void Yield( ReturnType& aRetVal )
|
||||
{
|
||||
m_retVal = aRetVal;
|
||||
- jump( m_self, m_saved, 0 );
|
||||
+#if BOOST_VERSION <= 106000
|
||||
+ jump( m_callee, m_caller, false );
|
||||
+#else
|
||||
+ m_caller( this );
|
||||
+#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,9 +154,9 @@
|
||||
*
|
||||
* Defines the entry point for the coroutine, if not set in the constructor.
|
||||
*/
|
||||
- void SetEntry( DELEGATE<ReturnType, ArgType> aEntry )
|
||||
+ void SetEntry( std::function<ReturnType(ArgType)> aEntry )
|
||||
{
|
||||
- m_func = aEntry;
|
||||
+ m_func = std::move( aEntry );
|
||||
}
|
||||
|
||||
/* Function Call()
|
||||
@@ -140,6 +167,10 @@
|
||||
*/
|
||||
bool Call( ArgType aArgs )
|
||||
{
|
||||
+ assert( m_callee == NULL );
|
||||
+ assert( m_caller == NULL );
|
||||
+
|
||||
+#if BOOST_VERSION <= 106000
|
||||
// fixme: Clean up stack stuff. Add a guard
|
||||
m_stack = malloc( c_defaultStackSize );
|
||||
|
||||
@@ -148,22 +179,32 @@
|
||||
|
||||
// correct the stack size
|
||||
m_stackSize -= ( (size_t) m_stack + m_stackSize - (size_t) sp );
|
||||
-
|
||||
- assert( m_self == NULL );
|
||||
- assert( m_saved == NULL );
|
||||
+#endif
|
||||
|
||||
m_args = &aArgs;
|
||||
-#if BOOST_VERSION >= 105600
|
||||
- m_self = new boost::context::fcontext_t();
|
||||
- *m_self = boost::context::make_fcontext( sp, m_stackSize, callerStub );
|
||||
+
|
||||
+#if BOOST_VERSION < 105600
|
||||
+ m_callee = boost::context::make_fcontext( sp, m_stackSize, callerStub );
|
||||
+#elif BOOST_VERSION <= 106000
|
||||
+ m_callee = new context_type( boost::context::make_fcontext( sp, m_stackSize, callerStub ) );
|
||||
#else
|
||||
- m_self = boost::context::make_fcontext( sp, m_stackSize, callerStub );
|
||||
+ m_callee = new context_type( std::allocator_arg_t(),
|
||||
+ boost::context::protected_fixedsize_stack( c_defaultStackSize ), &COROUTINE::callerStub );
|
||||
+#endif
|
||||
+
|
||||
+#if BOOST_VERSION <= 106000
|
||||
+ m_caller = new context_type();
|
||||
#endif
|
||||
- m_saved = new boost::context::fcontext_t();
|
||||
|
||||
m_running = true;
|
||||
+
|
||||
// off we go!
|
||||
- jump( m_saved, m_self, reinterpret_cast<intptr_t>( this ) );
|
||||
+#if BOOST_VERSION <= 106000
|
||||
+ jump( m_caller, m_callee, reinterpret_cast<intptr_t>( this ) );
|
||||
+#else
|
||||
+ auto result = (*m_callee)( this );
|
||||
+ *m_callee = std::move( std::get<0>( result ) );
|
||||
+#endif
|
||||
return m_running;
|
||||
}
|
||||
|
||||
@@ -176,7 +217,12 @@
|
||||
*/
|
||||
bool Resume()
|
||||
{
|
||||
- jump( m_saved, m_self, 0 );
|
||||
+#if BOOST_VERSION <= 106000
|
||||
+ jump( m_caller, m_callee, false );
|
||||
+#else
|
||||
+ auto result = (*m_callee)( this );
|
||||
+ *m_callee = std::move( std::get<0>( result ) );
|
||||
+#endif
|
||||
|
||||
return m_running;
|
||||
}
|
||||
@@ -205,61 +251,66 @@
|
||||
static const int c_defaultStackSize = 2000000; // fixme: make configurable
|
||||
|
||||
/* real entry point of the coroutine */
|
||||
+#if BOOST_VERSION <= 106000
|
||||
static void callerStub( intptr_t aData )
|
||||
+#else
|
||||
+ static context_type callerStub( context_type caller, COROUTINE* cor )
|
||||
+#endif
|
||||
{
|
||||
// get pointer to self
|
||||
+#if BOOST_VERSION <= 106000
|
||||
COROUTINE<ReturnType, ArgType>* cor = reinterpret_cast<COROUTINE<ReturnType, ArgType>*>( aData );
|
||||
+#else
|
||||
+ cor->m_caller = &caller;
|
||||
+#endif
|
||||
|
||||
// call the coroutine method
|
||||
- cor->m_retVal = cor->m_func( *cor->m_args );
|
||||
+ cor->m_retVal = cor->m_func( *( cor->m_args ) );
|
||||
cor->m_running = false;
|
||||
|
||||
// go back to wherever we came from.
|
||||
- jump( cor->m_self, cor->m_saved, 0 ); // reinterpret_cast<intptr_t>( this ));
|
||||
+#if BOOST_VERSION <= 106000
|
||||
+ jump( cor->m_callee, cor->m_caller, 0 );
|
||||
+#else
|
||||
+ return caller;
|
||||
+#endif
|
||||
}
|
||||
|
||||
///> 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,
|
||||
+#if BOOST_VERSION <= 106000
|
||||
+ static inline intptr_t jump( context_type* aOld, context_type* aNew,
|
||||
intptr_t aP, bool aPreserveFPU = true )
|
||||
{
|
||||
-#if BOOST_VERSION >= 105600
|
||||
- return boost::context::jump_fcontext( aOld, *aNew, aP, aPreserveFPU );
|
||||
-#else
|
||||
+#if BOOST_VERSION < 105600
|
||||
return boost::context::jump_fcontext( aOld, aNew, aP, aPreserveFPU );
|
||||
+#else
|
||||
+ return boost::context::jump_fcontext( aOld, *aNew, aP, aPreserveFPU );
|
||||
#endif
|
||||
}
|
||||
+#endif
|
||||
|
||||
- template <typename T>
|
||||
- struct strip_ref
|
||||
- {
|
||||
- typedef T result;
|
||||
- };
|
||||
+ std::function<ReturnType(ArgType)> m_func;
|
||||
|
||||
- template <typename T>
|
||||
- struct strip_ref<T&>
|
||||
- {
|
||||
- typedef T result;
|
||||
- };
|
||||
+ bool m_running;
|
||||
|
||||
- DELEGATE<ReturnType, ArgType> m_func;
|
||||
+#if BOOST_VERSION <= 106000
|
||||
+ ///< coroutine stack
|
||||
+ void* m_stack;
|
||||
+
|
||||
+ size_t m_stackSize;
|
||||
+#endif
|
||||
|
||||
///< pointer to coroutine entry arguments. Stripped of references
|
||||
///< to avoid compiler errors.
|
||||
- typename strip_ref<ArgType>::result* m_args;
|
||||
+ typename std::remove_reference<ArgType>::type* m_args;
|
||||
+
|
||||
ReturnType m_retVal;
|
||||
|
||||
///< saved caller context
|
||||
- boost::context::fcontext_t* m_saved;
|
||||
+ context_type* m_caller;
|
||||
|
||||
///< saved coroutine context
|
||||
- boost::context::fcontext_t* m_self;
|
||||
-
|
||||
- ///< coroutine stack
|
||||
- void* m_stack;
|
||||
-
|
||||
- size_t m_stackSize;
|
||||
-
|
||||
- bool m_running;
|
||||
+ context_type* m_callee;
|
||||
};
|
||||
|
||||
#endif
|
||||
diff -urN kicad-2015.03.21/include/tool/tool_base.h kicad-2015.03.21-patched/include/tool/tool_base.h
|
||||
--- kicad-2015.03.21/include/tool/tool_base.h 2015-03-21 23:21:48.000000000 +1000
|
||||
+++ kicad-2015.03.21-patched/include/tool/tool_base.h 2016-12-06 22:30:28.474774500 +1000
|
||||
@@ -3,6 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -29,7 +30,7 @@
|
||||
#include <base_struct.h> // for KICAD_T
|
||||
|
||||
#include <tool/tool_event.h>
|
||||
-#include <tool/delegate.h>
|
||||
+#include <functional>
|
||||
|
||||
class EDA_ITEM;
|
||||
class TOOL_MANAGER;
|
||||
@@ -51,7 +52,9 @@
|
||||
|
||||
/// Unique identifier for tools
|
||||
typedef int TOOL_ID;
|
||||
-typedef DELEGATE<int, const TOOL_EVENT&> TOOL_STATE_FUNC;
|
||||
+
|
||||
+using TOOL_STATE_FUNC = std::function<int(const TOOL_EVENT&)>;
|
||||
+
|
||||
|
||||
/**
|
||||
* Class TOOL_BASE
|
||||
diff -urN kicad-2015.03.21/include/tool/tool_interactive.h kicad-2015.03.21-patched/include/tool/tool_interactive.h
|
||||
--- kicad-2015.03.21/include/tool/tool_interactive.h 2015-03-21 23:21:48.000000000 +1000
|
||||
+++ kicad-2015.03.21-patched/include/tool/tool_interactive.h 2016-12-06 22:29:28.106774738 +1000
|
||||
@@ -3,6 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
+ * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -113,7 +114,7 @@
|
||||
void TOOL_INTERACTIVE::Go( int (T::* aStateFunc)( const TOOL_EVENT& ),
|
||||
const TOOL_EVENT_LIST& aConditions )
|
||||
{
|
||||
- TOOL_STATE_FUNC sptr( static_cast<T*>( this ), aStateFunc );
|
||||
+ TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
|
||||
|
||||
goInternal( sptr, aConditions );
|
||||
}
|
23
kicad.spec
23
kicad.spec
|
@ -1,12 +1,12 @@
|
|||
%define revision 5528
|
||||
|
||||
Summary: EDA software suite for creation of schematic diagrams and PCBs
|
||||
Name: kicad
|
||||
Version: 2015.03.21
|
||||
Release: 0.rev%{revision}.2
|
||||
Release: 0.rev%{revision}.3
|
||||
Epoch: 1
|
||||
Summary: EDA software suite for creation of schematic diagrams and PCBs
|
||||
Group: Sciences/Computer science
|
||||
License: GPLv2+
|
||||
Group: Sciences/Computer science
|
||||
Url: http://www.kicad-pcb.org
|
||||
# URL2: https://launchpad.net/kicad
|
||||
# URL3: http://orson.net.pl/pub/kicad/
|
||||
|
@ -19,22 +19,23 @@ Url: http://www.kicad-pcb.org
|
|||
# kicad-export.sh ... export BZR repositories and create tarballs
|
||||
# kicad-walter-libs.sh ... download, unpack and prepare tarball with walter libs
|
||||
|
||||
Source: %{name}-%{version}.tar.xz
|
||||
Source0: %{name}-%{version}.tar.xz
|
||||
Source1: %{name}-doc-%{version}.tar.xz
|
||||
Source2: %{name}-libraries-%{version}.tar.xz
|
||||
Source3: %{name}-footprints-%{version}.tar.xz
|
||||
Source7: Epcos-MKT-1.0.tar.bz2
|
||||
Source8: %{name}-walter-libraries-%{version}.tar.xz
|
||||
Patch0: kicad-2015.03.21-boost-1.61.patch
|
||||
Patch1: kicad-2015.01.02-nostrip.patch
|
||||
Patch2: kicad-2015.01.02-freerouting.patch
|
||||
|
||||
BuildRequires: desktop-file-utils
|
||||
BuildRequires: wxgtku3.0-devel
|
||||
BuildRequires: boost-devel
|
||||
BuildRequires: cmake
|
||||
BuildRequires: desktop-file-utils
|
||||
BuildRequires: doxygen
|
||||
BuildRequires: glew-devel
|
||||
BuildRequires: openssl-devel
|
||||
BuildRequires: boost-devel
|
||||
BuildRequires: wxgtku3.0-devel
|
||||
BuildRequires: pkgconfig(glew)
|
||||
BuildRequires: pkgconfig(openssl)
|
||||
|
||||
Requires: electronics-menu
|
||||
Requires: freerouting
|
||||
|
@ -266,6 +267,7 @@ Documentation and tutorials for KiCad in Chinese
|
|||
%prep
|
||||
%setup -q -a 1 -a 2 -a 3 -a 7 -a 8
|
||||
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
|
||||
|
@ -275,13 +277,12 @@ iconv -f iso8859-1 -t utf-8 AUTHORS.txt > AUTHORS.conv && mv -f AUTHORS.conv AUT
|
|||
|
||||
#multilibs
|
||||
%ifarch x86_64 sparc64 ppc64 amd64 s390x
|
||||
%{__sed} -i "s|KICAD_PLUGINS lib/kicad/plugins|KICAD_PLUGINS lib64/kicad/plugins|" CMakeLists.txt
|
||||
se} -i "s|KICAD_PLUGINS lib/kicad/plugins|KICAD_PLUGINS lib64/kicad/plugins|" CMakeLists.txt
|
||||
#%{__sed} -i "s|/usr/lib/kicad|/usr/lib64/kicad|" %{SOURCE3}
|
||||
%endif
|
||||
|
||||
|
||||
%build
|
||||
|
||||
# Add Epcos library
|
||||
cd Epcos-MKT-1.0
|
||||
cp -pR library ../%{name}-libraries-%{version}/
|
||||
|
|
Loading…
Add table
Reference in a new issue