commit:     66ad936a19e0032422bc274f201f7ef8ebb32a83
Author:     Christoph Junghans <junghans <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 20 14:13:29 2020 +0000
Commit:     Christoph Junghans <junghans <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 14:14:31 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=66ad936a

net-misc/grive: fix build with new binutils

Closes: https://bugs.gentoo.org/708008
Package-Manager: Portage-3.0.4, Repoman-3.0.1
Signed-off-by: Christoph Junghans <junghans <AT> gentoo.org>

 net-misc/grive/files/299.patch       | 113 +++++++++++++++++++++++++++++++++++
 net-misc/grive/grive-0.5.1-r1.ebuild |  36 +++++++++++
 2 files changed, 149 insertions(+)

diff --git a/net-misc/grive/files/299.patch b/net-misc/grive/files/299.patch
new file mode 100644
index 00000000000..a5e030f2534
--- /dev/null
+++ b/net-misc/grive/files/299.patch
@@ -0,0 +1,113 @@
+From b4d6ac055f8f16ac735a70036243bc4ea2334039 Mon Sep 17 00:00:00 2001
+From: Giuseppe Corbelli <[email protected]>
+Date: Tue, 14 Jan 2020 11:50:20 +0100
+Subject: [PATCH] [SymbolInfo.cc] Support compilation with binutils >= 2.33.1
+ on Debian.
+
+bfd_get_section_vma macro was removed.
+bfd_section_size changed signature.
+
+See inline comment for details.
+---
+ libgrive/src/bfd/SymbolInfo.cc | 35 ++++++++++++++++++++--------------
+ 1 file changed, 21 insertions(+), 14 deletions(-)
+
+diff --git a/libgrive/src/bfd/SymbolInfo.cc b/libgrive/src/bfd/SymbolInfo.cc
+index 5876cc0..cdb5d7c 100644
+--- a/libgrive/src/bfd/SymbolInfo.cc
++++ b/libgrive/src/bfd/SymbolInfo.cc
+@@ -49,9 +49,9 @@ SymbolInfo::SymbolInfo( )
+       m_impl->m_bfd           = 0 ;
+       m_impl->m_symbols       = 0 ;
+       m_impl->m_symbol_count  = 0 ;
+-      
++
+       bfd_init( ) ;
+-      
++
+       // opening itself
+       bfd *b = bfd_openr( "/proc/self/exe", 0 ) ;
+       if ( b == NULL )
+@@ -60,13 +60,13 @@ SymbolInfo::SymbolInfo( )
+                         << bfd_errmsg( bfd_get_error() ) << std::endl ;
+               return ;
+       }
+-      
++
+       if ( bfd_check_format( b, bfd_archive ) )
+       {
+               bfd_close( b ) ;
+               return ;
+       }
+-      
++
+       char **matching ;
+       if ( !bfd_check_format_matches( b, bfd_object, &matching ) )
+       {
+@@ -78,7 +78,7 @@ SymbolInfo::SymbolInfo( )
+                       std::cerr << bfd_get_filename( b ) << ": Matching 
formats: " ;
+                       for ( char **p = matching ; *p != 0 ; p++ )
+                               std::cerr << " " << *p ;
+-                      
++
+                       std::cerr << std::endl ;
+                       std::free( matching ) ;
+               }
+@@ -107,7 +107,7 @@ struct SymbolInfo::BacktraceInfo
+       const char                      *m_func_name ;
+       unsigned int            m_lineno ;
+       unsigned int            m_is_found ;
+-      
++
+       static void Callback( bfd *abfd, asection *section, void* addr ) ;
+ } ;
+ 
+@@ -117,17 +117,24 @@ void SymbolInfo::BacktraceInfo::Callback( bfd *abfd, 
asection *section,
+       BacktraceInfo *info = (BacktraceInfo *)data ;
+       if ((section->flags & SEC_ALLOC) == 0)
+               return ;
+-      
+-      bfd_vma vma = bfd_get_section_vma(abfd, section);
+-      
++
++      // bfd_get_section_vma works up to 
7b1cfbcf1a27951fb1b3a212995075dd6fdf985b,
++      // removed in 7c13bc8c91abf291f0206b6608b31955c5ea70d8 (binutils 2.33.1 
or so)
++      // so it's substituted by its implementation to avoid checking for 
binutils
++      // version (which at least on Debian SID it's not that easy because the
++      // version.h is not included with the official package)
++      bfd_vma vma = section->vma;
++
+       unsigned long address = (unsigned long)(info->m_addr);
+       if ( address < vma )
+               return;
+-      
+-      bfd_size_type size = bfd_section_size(abfd, section);
++
++      // bfd_section_size changed between the two objects described above,
++      // same rationale applies
++      bfd_size_type size = section->size;
+       if ( address > (vma + size))
+               return ;
+-      
++
+       const SymbolInfo *pthis = info->m_pthis ;
+       info->m_is_found        =  bfd_find_nearest_line( abfd, section,
+                                                     pthis->m_impl->m_symbols,
+@@ -149,7 +156,7 @@ void SymbolInfo::PrintTrace( void *addr, std::ostream& os, 
std::size_t idx )
+       {
+               this, addr, 0, 0, 0, false
+       } ;
+-      
++
+       Dl_info sym ;
+       bfd_map_over_sections( m_impl->m_bfd,
+                                                       
&SymbolInfo::BacktraceInfo::Callback,
+@@ -165,7 +172,7 @@ if ( btinfo.m_is_found )
+                       filename.erase( pos, std::strlen( SRC_DIR ) ) ;
+ #endif
+               os << "#"  << idx << " " << addr << " "
+-                      << filename << ":" << btinfo.m_lineno 
++                      << filename << ":" << btinfo.m_lineno
+                       << " "
+                       << (btinfo.m_func_name != 0 ? 
Demangle(btinfo.m_func_name) : "" )
+                       << std::endl ;

diff --git a/net-misc/grive/grive-0.5.1-r1.ebuild 
b/net-misc/grive/grive-0.5.1-r1.ebuild
new file mode 100644
index 00000000000..323a194002e
--- /dev/null
+++ b/net-misc/grive/grive-0.5.1-r1.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit cmake
+
+if [[ ${PV} = *9999 ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/vitalif/${PN}2.git";
+else
+       inherit vcs-snapshot
+       SRC_URI="https://github.com/vitalif/${PN}2/archive/v${PV}.tar.gz -> 
${P}.tar.gz"
+fi
+
+DESCRIPTION="An open source Linux client for Google Drive"
+HOMEPAGE="https://github.com/vitalif/grive2";
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="
+       dev-libs/boost:=
+       dev-libs/expat
+       >=dev-libs/json-c-0.11-r1:=
+       dev-libs/libgcrypt:0=
+       dev-libs/yajl
+       || ( net-misc/curl[curl_ssl_openssl] net-misc/curl[curl_ssl_gnutls] )
+       sys-libs/binutils-libs:0=
+       sys-libs/glibc
+"
+DEPEND="${RDEPEND}"
+
+PATCHES=( "${FILESDIR}/299.patch" )

Reply via email to