Skip to content

Commit

Permalink
dev-cpp/glog: Bump to EAPI 6 and add GCC 5 patch
Browse files Browse the repository at this point in the history
Gentoo-bug: 555030

Package-Manager: Portage-2.3.3, Repoman-2.3.1
  • Loading branch information
SoapGentoo committed Jan 22, 2017
1 parent 989b0bb commit 55f695f
Show file tree
Hide file tree
Showing 3 changed files with 249 additions and 0 deletions.
142 changes: 142 additions & 0 deletions dev-cpp/glog/files/glog-0.3.4-fix-build-system.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
--- a/configure.ac
+++ b/configure.ac
@@ -11,7 +11,7 @@
AC_CONFIG_SRCDIR(README)
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE
-AM_CONFIG_HEADER(src/config.h)
+AC_CONFIG_HEADERS([src/config.h])

AC_LANG(C++)

@@ -21,7 +21,7 @@
AC_PROG_CXX
AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc

-AC_PROG_LIBTOOL
+LT_INIT
AC_SUBST(LIBTOOL_DEPS)

# Check whether some low-level functions/files are available
@@ -128,32 +128,48 @@
fi

# Check if there is google-gflags library installed.
-SAVE_CFLAGS="$CFLAGS"
-SAVE_LIBS="$LIBS"
-AC_ARG_WITH(gflags, AS_HELP_STRING[--with-gflags=GFLAGS_DIR],
- GFLAGS_CFLAGS="-I${with_gflags}/include"
- GFLAGS_LIBS="-L${with_gflags}/lib -lgflags"
- CFLAGS="$CFLAGS $GFLAGS_CFLAGS"
- LIBS="$LIBS $GFLAGS_LIBS"
-)
-AC_CHECK_LIB(gflags, main, ac_cv_have_libgflags=1, ac_cv_have_libgflags=0)
-if test x"$ac_cv_have_libgflags" = x"1"; then
- AC_DEFINE(HAVE_LIB_GFLAGS, 1, [define if you have google gflags library])
- if test x"$GFLAGS_LIBS" = x""; then
- GFLAGS_LIBS="-lgflags"
- fi
-else
- GFLAGS_CFLAGS=
- GFLAGS_LIBS=
-fi
-CFLAGS="$SAVE_CFLAGS"
-LIBS="$SAVE_LIBS"
+AC_ARG_ENABLE([gflags],
+ AS_HELP_STRING([--enable-gflags], [Enable google-gflags]))
+
+ac_cv_have_libgflags=0
+AS_IF([test "x$enable_gflags" != "xno"], [
+ SAVE_CFLAGS="$CFLAGS"
+ SAVE_LIBS="$LIBS"
+ AC_ARG_WITH([gflags], AS_HELP_STRING([--with-gflags=GFLAGS_DIR]),[
+ GFLAGS_CFLAGS="-I${with_gflags}/include"
+ GFLAGS_LIBS="-L${with_gflags}/lib -lgflags"
+ CFLAGS="$CFLAGS $GFLAGS_CFLAGS"
+ LIBS="$LIBS $GFLAGS_LIBS"
+ ])
+
+ AC_CHECK_LIB(gflags, main, ac_cv_have_libgflags=1, ac_cv_have_libgflags=0)
+ CFLAGS="$SAVE_CFLAGS"
+ LIBS="$SAVE_LIBS"
+])
+
+AS_IF([test "x$ac_cv_have_libgflags" = "x1"], [
+ AC_DEFINE([HAVE_LIB_GFLAGS], [1], [define if you have google gflags library])
+ AS_IF([test "x$GFLAGS_LIBS" = "x"], [
+ GFLAGS_LIBS="-lgflags"
+ ])
+], [
+ GFLAGS_CFLAGS=
+ GFLAGS_LIBS=
+])

# TODO(hamaji): Use official m4 macros provided by testing libraries
# once the m4 macro of Google Mocking becomes ready.
# Check if there is Google Test library installed.
-AC_CHECK_PROG(GTEST_CONFIG, gtest-config, "yes")
-AC_CHECK_LIB(gtest, main, have_gtest_lib="yes")
+AC_ARG_ENABLE([gtest-config],
+ AS_HELP_STRING([--enable-gtest-config], [Enable looking for gtest-config]))
+
+AS_IF([test "x$enable_gtest_config" != "xno"], [
+ AC_CHECK_PROG(GTEST_CONFIG, gtest-config, "yes")
+ AC_CHECK_LIB(gtest, main, have_gtest_lib="yes")
+], [
+ have_gtest_lib="no"
+])
+
if test x"$GTEST_CONFIG" = "xyes" -a x"$have_gtest_lib" = "xyes"; then
GTEST_CFLAGS=`gtest-config --cppflags --cxxflags`
GTEST_LIBS=`gtest-config --ldflags --libs`
@@ -178,17 +194,13 @@
AM_CONDITIONAL(HAVE_GMOCK, test x"$GMOCK_CONFIG" = "xyes")

# We want to link in libunwind if it exists
-UNWIND_LIBS=
-# Unfortunately, we need to check the header file in addition to the
-# lib file to check if libunwind is available since libunwind-0.98
-# doesn't install all necessary header files.
-if test x"$ac_cv_have_libunwind_h" = x"1"; then
- AC_CHECK_LIB(unwind, backtrace, UNWIND_LIBS=-lunwind)
-fi
-AC_SUBST(UNWIND_LIBS)
-if test x"$UNWIND_LIBS" != x""; then
- AC_DEFINE(HAVE_LIB_UNWIND, 1, [define if you have libunwind])
-fi
+AC_ARG_ENABLE([unwind],
+ AS_HELP_STRING([--enable-unwind], [Enable libunwind]))
+
+AS_IF([test "x$enable_unwind" != "xno"], [
+ PKG_CHECK_MODULES([UNWIND], [libunwind > 0.98])
+ AC_DEFINE([HAVE_LIB_UNWIND], [1], [define if you have libunwind])
+])

# We'd like to use read/write locks in several places in the code.
# See if our pthreads support extends to that. Note: for linux, it
--- a/Makefile.am
+++ b/Makefile.am
@@ -40,12 +40,11 @@
nodist_gloginclude_HEADERS = src/glog/logging.h src/glog/raw_logging.h src/glog/vlog_is_on.h src/glog/stl_logging.h
noinst_HEADERS = src/glog/logging.h.in src/glog/raw_logging.h.in src/glog/vlog_is_on.h.in src/glog/stl_logging.h.in

-docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION)
## This is for HTML and other documentation you want to install.
## Add your documentation files (in doc/) in addition to these
## top-level boilerplate files. Also add a TODO file if you have one.
-dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README README.windows \
- doc/designstyle.css doc/glog.html
+dist_doc_DATA = AUTHORS ChangeLog INSTALL NEWS README
+dist_html_DATA = doc/designstyle.css doc/glog.html

## The libraries (.so's) you want to install
lib_LTLIBRARIES =
@@ -215,7 +214,7 @@

## This should always include $(TESTS), but may also include other
## binaries that you compile but don't want automatically installed.
-noinst_PROGRAMS = $(TESTS) $(TEST_BINARIES)
+check_PROGRAMS = $(TESTS) $(TEST_BINARIES)

rpm: dist-gzip packages/rpm.sh packages/rpm/rpm.spec
@cd packages && ./rpm.sh ${PACKAGE} ${VERSION}
56 changes: 56 additions & 0 deletions dev-cpp/glog/files/glog-0.3.4-fix-gcc5-demangling.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
From b1639e3014996fbc7635870e013559c54e7e3b2f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Mart=C3=ADnez=20Moreno?= <[email protected]>
Date: Thu, 13 Aug 2015 09:31:26 -0700
Subject: [PATCH] Fix ABI demangling for the GCC 5.x case.

When glog is compiled with gcc-5.2 in cxx11 ABI mode, it barfs about unmangled symbols. This patches it getting inspiration from binutils and demangle.cc itself, although it may be totally wrong or maybe have to use ParseAbiTag in more places. I haven't read the spec for the symbols, though.

This patch makes the demangle unit test pass correctly.
---
src/demangle.cc | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

diff --git a/src/demangle.cc b/src/demangle.cc
index e858181..0f0c831 100644
--- a/src/demangle.cc
+++ b/src/demangle.cc
@@ -439,6 +439,7 @@ static bool ParseExprPrimary(State *state);
static bool ParseLocalName(State *state);
static bool ParseDiscriminator(State *state);
static bool ParseSubstitution(State *state);
+static bool ParseAbiTag(State *state);

// Implementation note: the following code is a straightforward
// translation of the Itanium C++ ABI defined in BNF with a couple of
@@ -567,6 +568,8 @@ static bool ParseNestedName(State *state) {
static bool ParsePrefix(State *state) {
bool has_something = false;
while (true) {
+ if (ParseAbiTag(state))
+ continue;
MaybeAppendSeparator(state);
if (ParseTemplateParam(state) ||
ParseSubstitution(state) ||
@@ -585,6 +588,22 @@ static bool ParsePrefix(State *state) {
return true;
}

+// <abi-tag> ::= B <source-name>
+static bool ParseAbiTag(State *state) {
+ State copy = *state;
+
+ Append(state, "[", 1);
+ if (ParseOneCharToken(state, 'B') &&
+ ParseSourceName(state))
+ {
+ Append(state, "]", 1);
+ return true;
+ }
+
+ *state = copy;
+ return false;
+}
+
// <unqualified-name> ::= <operator-name>
// ::= <ctor-dtor-name>
// ::= <source-name>
51 changes: 51 additions & 0 deletions dev-cpp/glog/glog-0.3.4-r1.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=6

inherit autotools multilib-minimal

DESCRIPTION="Google's C++ logging library"
HOMEPAGE="https://github.com/google/glog"
SRC_URI="https://github.com/google/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux"
IUSE="gflags static-libs test unwind"

RDEPEND="
gflags? ( >=dev-cpp/gflags-2.0-r1[${MULTILIB_USEDEP}] )
unwind? ( sys-libs/libunwind[${MULTILIB_USEDEP}] )"
DEPEND="${RDEPEND}
test? (
>=dev-cpp/gmock-1.7.0-r1[${MULTILIB_USEDEP}]
>=dev-cpp/gtest-1.6.0-r2[${MULTILIB_USEDEP}]
)"

PATCHES=(
"${FILESDIR}"/${PN}-0.3.2-avoid-inline-asm.patch
"${FILESDIR}"/${PN}-0.3.4-fix-build-system.patch
"${FILESDIR}"/${PN}-0.3.4-fix-gcc5-demangling.patch
)

src_prepare() {
default
eautoreconf
}

multilib_src_configure() {
ECONF_SOURCE="${S}" econf \
$(use_enable gflags) \
$(use_enable static-libs static) \
$(use_enable test gtest-config) \
$(use_enable unwind)
}

multilib_src_install_all() {
einstalldocs

# package provides .pc files
find "${D}" -name '*.la' -delete || die
}

0 comments on commit 55f695f

Please sign in to comment.