From ca9b08b16b8bccf05b294e5fba84c3e052d137c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Thu, 6 Jul 2017 11:03:56 +0200 Subject: [PATCH] libcmis: fix build for gcc7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andreas Müller --- .../libcmis/files/0002-drop-prefix.patch | 250 ++++++++++++++++++ .../0003-do-not-reinvent-the-wheel.patch | 127 +++++++++ ...04-fix-build-error-with-gcc-std-c-98.patch | 39 +++ recipes-support/libcmis/libcmis_0.5.1.bb | 4 + 4 files changed, 420 insertions(+) create mode 100644 recipes-support/libcmis/files/0002-drop-prefix.patch create mode 100644 recipes-support/libcmis/files/0003-do-not-reinvent-the-wheel.patch create mode 100644 recipes-support/libcmis/files/0004-fix-build-error-with-gcc-std-c-98.patch diff --git a/recipes-support/libcmis/files/0002-drop-prefix.patch b/recipes-support/libcmis/files/0002-drop-prefix.patch new file mode 100644 index 0000000..8ec6ad6 --- /dev/null +++ b/recipes-support/libcmis/files/0002-drop-prefix.patch @@ -0,0 +1,250 @@ +From 8b401fdea3f621101876f31f21aa98ffd60f5e91 Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Tue, 16 May 2017 10:02:19 +0200 +Subject: [PATCH 1/3] drop :: prefix + +--- + src/cmis-client.cxx | 2 +- + src/libcmis/atom-object.cxx | 2 +- + src/libcmis/document.hxx | 2 +- + src/libcmis/folder.hxx | 8 ++++---- + src/libcmis/gdrive-folder.cxx | 2 +- + src/libcmis/json-utils.cxx | 2 +- + src/libcmis/oauth2-data.hxx | 2 +- + src/libcmis/object-type.hxx | 2 +- + src/libcmis/object.hxx | 2 +- + src/libcmis/property-type.hxx | 2 +- + src/libcmis/property.hxx | 2 +- + src/libcmis/rendition.hxx | 2 +- + src/libcmis/repository.hxx | 2 +- + src/libcmis/session-factory.hxx | 4 ++-- + src/libcmis/xml-utils.cxx | 2 +- + 15 files changed, 19 insertions(+), 19 deletions(-) + +diff --git a/src/cmis-client.cxx b/src/cmis-client.cxx +index 73c1b8e..d5c01e4 100644 +--- a/src/cmis-client.cxx ++++ b/src/cmis-client.cxx +@@ -40,7 +40,7 @@ + #include + + using namespace std; +-using namespace ::boost::program_options; ++using namespace boost::program_options; + using libcmis::PropertyPtrMap; + + namespace +diff --git a/src/libcmis/atom-object.cxx b/src/libcmis/atom-object.cxx +index 1eb33fa..01454a4 100644 +--- a/src/libcmis/atom-object.cxx ++++ b/src/libcmis/atom-object.cxx +@@ -59,7 +59,7 @@ namespace + // Some implementations (xcmis) put extra spaces into the type attribute + // (e.g. "application/atom+xml; type=feed" instead of "application/atom+xml;type=feed") + string linkType = link.getType( ); +- linkType.erase( remove_if( linkType.begin(), linkType.end(), ::isspace ), linkType.end() ); ++ linkType.erase( remove_if( linkType.begin(), linkType.end(), isspace ), linkType.end() ); + + // Some implementation (SharePoint) are omitting the type attribute + bool matchesType = m_type.empty( ) || linkType.empty() || ( linkType == m_type ); +diff --git a/src/libcmis/document.hxx b/src/libcmis/document.hxx +index 0473012..a6736d7 100644 +--- a/src/libcmis/document.hxx ++++ b/src/libcmis/document.hxx +@@ -140,7 +140,7 @@ namespace libcmis + + virtual std::string toString( ); + }; +- typedef ::boost::shared_ptr< Document > DocumentPtr; ++ typedef boost::shared_ptr< Document > DocumentPtr; + } + + #endif +diff --git a/src/libcmis/folder.hxx b/src/libcmis/folder.hxx +index e001541..b9d7c57 100644 +--- a/src/libcmis/folder.hxx ++++ b/src/libcmis/folder.hxx +@@ -59,16 +59,16 @@ namespace libcmis + + virtual std::vector< std::string > getPaths( ); + +- virtual ::boost::shared_ptr< Folder > getFolderParent( ) throw ( Exception ); ++ virtual boost::shared_ptr< Folder > getFolderParent( ) throw ( Exception ); + virtual std::vector< ObjectPtr > getChildren( ) throw ( Exception ) = 0; + virtual std::string getParentId( ); + virtual std::string getPath( ); + + virtual bool isRootFolder( ); + +- virtual ::boost::shared_ptr< Folder > createFolder( const std::map< std::string, PropertyPtr >& properties ) ++ virtual boost::shared_ptr< Folder > createFolder( const std::map< std::string, PropertyPtr >& properties ) + throw ( libcmis::Exception ) = 0; +- virtual ::boost::shared_ptr< Document > createDocument( const std::map< std::string, PropertyPtr >& properties, ++ virtual boost::shared_ptr< Document > createDocument( const std::map< std::string, PropertyPtr >& properties, + boost::shared_ptr< std::ostream > os, std::string contentType, std::string fileName ) throw ( Exception ) = 0; + + virtual std::vector< std::string > removeTree( bool allVersion = true, UnfileObjects::Type unfile = UnfileObjects::Delete, +@@ -76,7 +76,7 @@ namespace libcmis + + virtual std::string toString( ); + }; +- typedef ::boost::shared_ptr< Folder > FolderPtr; ++ typedef boost::shared_ptr< Folder > FolderPtr; + + } + +diff --git a/src/libcmis/gdrive-folder.cxx b/src/libcmis/gdrive-folder.cxx +index e5e14af..840539e 100644 +--- a/src/libcmis/gdrive-folder.cxx ++++ b/src/libcmis/gdrive-folder.cxx +@@ -159,7 +159,7 @@ libcmis::DocumentPtr GDriveFolder::createDocument( + // parse the document + Json jsonRes = Json::parse( res ); + +- ::boost::shared_ptr< GDriveDocument > ++ boost::shared_ptr< GDriveDocument > + gDocument( new GDriveDocument( getSession( ), jsonRes ) ); + + // Upload stream +diff --git a/src/libcmis/json-utils.cxx b/src/libcmis/json-utils.cxx +index b4e037d..de78574 100644 +--- a/src/libcmis/json-utils.cxx ++++ b/src/libcmis/json-utils.cxx +@@ -188,7 +188,7 @@ Json Json::parse( const string& str ) throw ( libcmis:: Exception ) + { + try + { +- ::property_tree::json_parser::read_json( ss, pTree ); ++ property_tree::json_parser::read_json( ss, pTree ); + } + catch ( boost::exception const& ) + { +diff --git a/src/libcmis/oauth2-data.hxx b/src/libcmis/oauth2-data.hxx +index 000f939..dc8fb77 100644 +--- a/src/libcmis/oauth2-data.hxx ++++ b/src/libcmis/oauth2-data.hxx +@@ -69,7 +69,7 @@ namespace libcmis + const std::string& getScope() { return m_scope; } + const std::string& getRedirectUri() { return m_redirectUri; } + }; +- typedef ::boost::shared_ptr< OAuth2Data > OAuth2DataPtr; ++ typedef boost::shared_ptr< OAuth2Data > OAuth2DataPtr; + } + + #endif //_LIBCMIS_OAUTH2_DATA_HXX_ +diff --git a/src/libcmis/object-type.hxx b/src/libcmis/object-type.hxx +index 629663c..bfebc59 100644 +--- a/src/libcmis/object-type.hxx ++++ b/src/libcmis/object-type.hxx +@@ -137,7 +137,7 @@ namespace libcmis + virtual std::string toString( ); + }; + +- typedef ::boost::shared_ptr< ObjectType > ObjectTypePtr; ++ typedef boost::shared_ptr< ObjectType > ObjectTypePtr; + } + + #endif +diff --git a/src/libcmis/object.hxx b/src/libcmis/object.hxx +index d7d3603..932bc60 100644 +--- a/src/libcmis/object.hxx ++++ b/src/libcmis/object.hxx +@@ -214,7 +214,7 @@ namespace libcmis + void toXml( xmlTextWriterPtr writer ); + }; + +- typedef ::boost::shared_ptr< Object > ObjectPtr; ++ typedef boost::shared_ptr< Object > ObjectPtr; + } + + #endif +diff --git a/src/libcmis/property-type.hxx b/src/libcmis/property-type.hxx +index 56be223..0fb490e 100644 +--- a/src/libcmis/property-type.hxx ++++ b/src/libcmis/property-type.hxx +@@ -119,7 +119,7 @@ namespace libcmis + + void update( std::vector< ObjectTypePtr > typesDefs ); + }; +- typedef ::boost::shared_ptr< PropertyType > PropertyTypePtr; ++ typedef boost::shared_ptr< PropertyType > PropertyTypePtr; + } + + #endif +diff --git a/src/libcmis/property.hxx b/src/libcmis/property.hxx +index aa65605..567cefb 100644 +--- a/src/libcmis/property.hxx ++++ b/src/libcmis/property.hxx +@@ -79,7 +79,7 @@ namespace libcmis + + std::string toString( ); + }; +- typedef ::boost::shared_ptr< Property > PropertyPtr; ++ typedef boost::shared_ptr< Property > PropertyPtr; + typedef std::map< std::string, libcmis::PropertyPtr > PropertyPtrMap; + + PropertyPtr parseProperty( xmlNodePtr node, boost::shared_ptr< ObjectType > objectType ); +diff --git a/src/libcmis/rendition.hxx b/src/libcmis/rendition.hxx +index 2e38651..f8c23b4 100644 +--- a/src/libcmis/rendition.hxx ++++ b/src/libcmis/rendition.hxx +@@ -81,7 +81,7 @@ namespace libcmis + std::string toString( ); + }; + +- typedef ::boost::shared_ptr< Rendition > RenditionPtr; ++ typedef boost::shared_ptr< Rendition > RenditionPtr; + } + + #endif +diff --git a/src/libcmis/repository.hxx b/src/libcmis/repository.hxx +index a4435d8..320cbb4 100644 +--- a/src/libcmis/repository.hxx ++++ b/src/libcmis/repository.hxx +@@ -111,7 +111,7 @@ namespace libcmis + static std::map< Capability, std::string > parseCapabilities( xmlNodePtr node ); + }; + +- typedef ::boost::shared_ptr< Repository > RepositoryPtr; ++ typedef boost::shared_ptr< Repository > RepositoryPtr; + } + + #endif +diff --git a/src/libcmis/session-factory.hxx b/src/libcmis/session-factory.hxx +index 9349b1c..8cc1f26 100644 +--- a/src/libcmis/session-factory.hxx ++++ b/src/libcmis/session-factory.hxx +@@ -57,7 +57,7 @@ namespace libcmis + */ + virtual bool authenticationQuery( std::string& username, std::string& password ) = 0; + }; +- typedef ::boost::shared_ptr< AuthProvider > AuthProviderPtr; ++ typedef boost::shared_ptr< AuthProvider > AuthProviderPtr; + + /** Handler class used to request user input when an invalid SSL certificate is encountered. + */ +@@ -77,7 +77,7 @@ namespace libcmis + */ + virtual bool validateCertificate( std::vector< std::string > certificatesChain ) = 0; + }; +- typedef ::boost::shared_ptr< CertValidationHandler > CertValidationHandlerPtr; ++ typedef boost::shared_ptr< CertValidationHandler > CertValidationHandlerPtr; + + class SessionFactory + { +diff --git a/src/libcmis/xml-utils.cxx b/src/libcmis/xml-utils.cxx +index 7070067..599edf2 100644 +--- a/src/libcmis/xml-utils.cxx ++++ b/src/libcmis/xml-utils.cxx +@@ -551,7 +551,7 @@ namespace libcmis + string lower( sText ); + for ( size_t i = 0; i < sText.size(); ++i ) + { +- lower[i] = ::tolower( sText[i] ); ++ lower[i] = tolower( sText[i] ); + } + return lower; + } +-- +2.9.4 + diff --git a/recipes-support/libcmis/files/0003-do-not-reinvent-the-wheel.patch b/recipes-support/libcmis/files/0003-do-not-reinvent-the-wheel.patch new file mode 100644 index 0000000..c63b2cc --- /dev/null +++ b/recipes-support/libcmis/files/0003-do-not-reinvent-the-wheel.patch @@ -0,0 +1,127 @@ +From ca381ff4586c9fc1190d285137ba8f67b102d600 Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Tue, 16 May 2017 11:52:43 +0200 +Subject: [PATCH 2/3] do not reinvent the wheel + +--- + configure.ac | 1 + + src/libcmis/atom-session.cxx | 3 ++- + src/libcmis/property.cxx | 4 +++- + src/libcmis/ws-relatedmultipart.cxx | 2 +- + src/libcmis/xml-utils.cxx | 11 ----------- + src/libcmis/xml-utils.hxx | 2 -- + 6 files changed, 7 insertions(+), 16 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 41b7a62..ae1eddb 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -167,6 +167,7 @@ m4_pattern_allow([^BOOST_]) + BOOST_REQUIRE([1.36]) + BOOST_DATE_TIME + BOOST_SMART_PTR ++BOOST_STRING_ALGO + BOOST_UUID + + AS_IF([test "x$enable_client" != "xno"], [ +diff --git a/src/libcmis/atom-session.cxx b/src/libcmis/atom-session.cxx +index 5772efc..c263f58 100644 +--- a/src/libcmis/atom-session.cxx ++++ b/src/libcmis/atom-session.cxx +@@ -27,6 +27,7 @@ + */ + #include + ++#include + #include + + #include +@@ -127,7 +128,7 @@ void AtomPubSession::parseServiceDocument( const string& buf ) throw ( libcmis:: + m_repositoryId = ws->getId( ); + + // SharePoint is case insensitive for the id... +- if ( libcmis::tolower( ws->getId( ) ) == libcmis::tolower( m_repositoryId ) ) ++ if ( boost::to_lower_copy( ws->getId( ) ) == boost::to_lower_copy( m_repositoryId ) ) + m_repository = ws; + + m_repositories.push_back( ws ); +diff --git a/src/libcmis/property.cxx b/src/libcmis/property.cxx +index e0249a5..b303fe5 100644 +--- a/src/libcmis/property.cxx ++++ b/src/libcmis/property.cxx +@@ -26,6 +26,8 @@ + * instead of those above. + */ + ++#include ++ + #include "object-type.hxx" + #include "property.hxx" + #include "xml-utils.hxx" +@@ -191,7 +193,7 @@ namespace libcmis + size_t pos = xmlType.find( propStr ); + if ( pos == 0 ) { + xmlType = xmlType.substr( propStr.length( ) ); +- xmlType = libcmis::tolower( xmlType ); ++ boost::to_lower( xmlType ); + } + + propType.reset( new PropertyType( xmlType, propDefinitionId, +diff --git a/src/libcmis/ws-relatedmultipart.cxx b/src/libcmis/ws-relatedmultipart.cxx +index df2471a..3b31634 100644 +--- a/src/libcmis/ws-relatedmultipart.cxx ++++ b/src/libcmis/ws-relatedmultipart.cxx +@@ -179,7 +179,7 @@ RelatedMultipart::RelatedMultipart( const string& body, const string& contentTyp + size_t colonPos = line.find( ":" ); + string headerName = line.substr( 0, colonPos ); + string headerValue = line.substr( colonPos + 1 ); +- if ( libcmis::tolower( headerName ) == libcmis::tolower( "Content-Id" ) ) ++ if ( boost::to_lower_copy( headerName ) == "content-id" ) + { + cid = libcmis::trim( headerValue ); + // Remove the '<' '>' around the id if any +diff --git a/src/libcmis/xml-utils.cxx b/src/libcmis/xml-utils.cxx +index 599edf2..d20ff47 100644 +--- a/src/libcmis/xml-utils.cxx ++++ b/src/libcmis/xml-utils.cxx +@@ -26,7 +26,6 @@ + * instead of those above. + */ + +-#include + #include + #include + #include +@@ -546,16 +545,6 @@ namespace libcmis + return out.str(); + } + +- string tolower( string sText ) +- { +- string lower( sText ); +- for ( size_t i = 0; i < sText.size(); ++i ) +- { +- lower[i] = tolower( sText[i] ); +- } +- return lower; +- } +- + int stringstream_write_callback( void * context, const char * s, int len ) + { + stringstream * ss=static_cast< stringstream * >( context ); +diff --git a/src/libcmis/xml-utils.hxx b/src/libcmis/xml-utils.hxx +index 58e9e8d..3bb21bb 100644 +--- a/src/libcmis/xml-utils.hxx ++++ b/src/libcmis/xml-utils.hxx +@@ -156,8 +156,6 @@ namespace libcmis + + std::string sha1( const std::string& str ); + +- std::string tolower( std::string sText ); +- + int stringstream_write_callback(void * context, const char * s, int len); + + std::string escape( std::string str ); +-- +2.9.4 + diff --git a/recipes-support/libcmis/files/0004-fix-build-error-with-gcc-std-c-98.patch b/recipes-support/libcmis/files/0004-fix-build-error-with-gcc-std-c-98.patch new file mode 100644 index 0000000..1cc18e6 --- /dev/null +++ b/recipes-support/libcmis/files/0004-fix-build-error-with-gcc-std-c-98.patch @@ -0,0 +1,39 @@ +From 86a50d6bad2ba44a8107ddb379d2ec6b84537a48 Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Tue, 16 May 2017 11:58:12 +0200 +Subject: [PATCH 3/3] fix build error with gcc -std=c++98 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +atom-object.cxx: In member function ‘bool {anonymous}::MatchLink::operator()(AtomLink)’: +atom-object.cxx:63:91: error: no matching function for call to ‘remove_if(std::__cxx11::basic_string::iterator, std::__cxx11::basic_string::iterator, )’ + linkType.erase( remove_if( linkType.begin(), linkType.end(), std::isspace ), linkType.end() ); +--- + src/libcmis/atom-object.cxx | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/libcmis/atom-object.cxx b/src/libcmis/atom-object.cxx +index 01454a4..510f013 100644 +--- a/src/libcmis/atom-object.cxx ++++ b/src/libcmis/atom-object.cxx +@@ -30,6 +30,7 @@ + #include + #include + ++#include + #include + + #include "atom-document.hxx" +@@ -59,7 +60,7 @@ namespace + // Some implementations (xcmis) put extra spaces into the type attribute + // (e.g. "application/atom+xml; type=feed" instead of "application/atom+xml;type=feed") + string linkType = link.getType( ); +- linkType.erase( remove_if( linkType.begin(), linkType.end(), isspace ), linkType.end() ); ++ linkType.erase( remove_if( linkType.begin(), linkType.end(), boost::is_space() ), linkType.end() ); + + // Some implementation (SharePoint) are omitting the type attribute + bool matchesType = m_type.empty( ) || linkType.empty() || ( linkType == m_type ); +-- +2.9.4 + diff --git a/recipes-support/libcmis/libcmis_0.5.1.bb b/recipes-support/libcmis/libcmis_0.5.1.bb index 948af7c..c88e046 100644 --- a/recipes-support/libcmis/libcmis_0.5.1.bb +++ b/recipes-support/libcmis/libcmis_0.5.1.bb @@ -10,6 +10,9 @@ LIC_FILES_CHKSUM = " \ SRC_URI = " \ https://github.com/tdf/libcmis/releases/download/v${PV}/${BPN}-${PV}.tar.gz \ file://0001-Avoid-cross-compile-unsafe-paths.patch \ + file://0002-drop-prefix.patch \ + file://0003-do-not-reinvent-the-wheel.patch \ + file://0004-fix-build-error-with-gcc-std-c-98.patch \ " SRC_URI[md5sum] = "3270154f0f40d86fce849b161f914101" @@ -21,6 +24,7 @@ DEPENDS = "curl libxml2 cppunit boost" EXTRA_OECONF = " \ --without-man \ + --disable-werror \ " do_configure_prepend() {