sys-devel/gdb: add source-highlight depend, bug #680238

Found and diagnosed by Jeroen Roovers. Patch proposed upstream as:
https://sourceware.org/ml/gdb-patches/2019-03/msg00285.html

Reported-by: Jeroen Roovers
Closes: https://bugs.gentoo.org/680238
Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
This commit is contained in:
Sergei Trofimovich
2019-03-13 22:10:48 +00:00
parent 9aaf480d38
commit f8a6fa80e0
4 changed files with 155 additions and 4 deletions

View File

@@ -0,0 +1,136 @@
From d46304c605ff119bc6bae38b7841d64e7568b691 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyfox@gentoo.org>
Date: Wed, 13 Mar 2019 21:15:13 +0000
Subject: [PATCH] gdb/configure.ac: add --enable-source-highlight
Allow disabling source-highlight dependency autodetection even
it exists in the system. More details on problem of automatic
dependencies:
https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Automagic_dependencies
Noticed by Jeroen Roovers in https://bugs.gentoo.org/680238
--- a/gdb/configure
+++ b/gdb/configure
@@ -879,6 +879,7 @@ with_mpfr
with_libmpfr_prefix
with_python
with_guile
+enable_source_highlight
enable_libmcheck
with_intel_pt
with_libipt_prefix
@@ -1554,6 +1555,8 @@ Optional Features:
--enable-profiling enable profiling of GDB
--enable-codesign=CERT sign gdb with 'codesign -s CERT'
--disable-rpath do not hardcode runtime library paths
+ --enable-source-highlight
+ enable source-highlight for source listings
--enable-libmcheck Try linking with -lmcheck if available
--enable-werror treat compile warnings as errors
--enable-build-warnings enable build-time compiler warnings if gcc is used
@@ -11393,13 +11396,30 @@ fi
SRCHIGH_LIBS=
SRCHIGH_CFLAGS=
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the source-highlight library" >&5
+
+# Check whether --enable-source-highlight was given.
+if test "${enable_source_highlight+set}" = set; then :
+ enableval=$enable_source_highlight; case "${enableval}" in
+ yes) enable_source_highlight=yes ;;
+ no) enable_source_highlight=no ;;
+ *) as_fn_error $? "bad value ${enableval} for source-highlight option" "$LINENO" 5 ;;
+esac
+else
+ enable_source_highlight=auto
+fi
+
+
+if test "${enable_source_highlight}" != "no"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the source-highlight library" >&5
$as_echo_n "checking for the source-highlight library... " >&6; }
-if test "${pkg_config_prog_path}" = "missing"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no - pkg-config not found" >&5
+ if test "${pkg_config_prog_path}" = "missing"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no - pkg-config not found" >&5
$as_echo "no - pkg-config not found" >&6; }
-else
- if ${pkg_config_prog_path} --exists source-highlight; then
+ if test "${enable_source_highlight}" = "yes"; then
+ as_fn_error $? "pkg-config was not found in your system" "$LINENO" 5
+ fi
+ else
+ if ${pkg_config_prog_path} --exists source-highlight; then
SRCHIGH_CFLAGS=`${pkg_config_prog_path} --cflags source-highlight`
SRCHIGH_LIBS=`${pkg_config_prog_path} --libs source-highlight`
@@ -11407,10 +11427,14 @@ $as_echo "#define HAVE_SOURCE_HIGHLIGHT 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- else
+ else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- fi
+ if test "${enable_source_highlight}" = "yes"; then
+ as_fn_error $? "source-highlight was not found in your system" "$LINENO" 5
+ fi
+ fi
+ fi
fi
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 8ddd0fda61..1318c8d008 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1220,19 +1220,38 @@ AM_CONDITIONAL(HAVE_GUILE, test "${have_libguile}" != no)
SRCHIGH_LIBS=
SRCHIGH_CFLAGS=
-AC_MSG_CHECKING([for the source-highlight library])
-if test "${pkg_config_prog_path}" = "missing"; then
- AC_MSG_RESULT([no - pkg-config not found])
-else
- if ${pkg_config_prog_path} --exists source-highlight; then
+
+AC_ARG_ENABLE(source-highlight,
+ AS_HELP_STRING([--enable-source-highlight],
+ [enable source-highlight for source listings]),
+ [case "${enableval}" in
+ yes) enable_source_highlight=yes ;;
+ no) enable_source_highlight=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for source-highlight option) ;;
+esac],
+[enable_source_highlight=auto])
+
+if test "${enable_source_highlight}" != "no"; then
+ AC_MSG_CHECKING([for the source-highlight library])
+ if test "${pkg_config_prog_path}" = "missing"; then
+ AC_MSG_RESULT([no - pkg-config not found])
+ if test "${enable_source_highlight}" = "yes"; then
+ AC_MSG_ERROR([pkg-config was not found in your system])
+ fi
+ else
+ if ${pkg_config_prog_path} --exists source-highlight; then
SRCHIGH_CFLAGS=`${pkg_config_prog_path} --cflags source-highlight`
SRCHIGH_LIBS=`${pkg_config_prog_path} --libs source-highlight`
AC_DEFINE([HAVE_SOURCE_HIGHLIGHT], 1,
[Define to 1 if the source-highlight library is available])
AC_MSG_RESULT([yes])
- else
+ else
AC_MSG_RESULT([no])
- fi
+ if test "${enable_source_highlight}" = "yes"; then
+ AC_MSG_ERROR([source-highlight was not found in your system])
+ fi
+ fi
+ fi
fi
AC_SUBST(SRCHIGH_LIBS)
AC_SUBST(SRCHIGH_CFLAGS)
--
2.21.0

View File

@@ -62,7 +62,7 @@ SLOT="0"
if [[ ${PV} != 9999* ]] ; then
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
fi
IUSE="+client lzma multitarget nls +python +server test vanilla xml"
IUSE="+client lzma multitarget nls +python +server source-highlight test vanilla xml"
REQUIRED_USE="
python? ( ${PYTHON_REQUIRED_USE} )
|| ( client server )
@@ -78,7 +78,11 @@ RDEPEND="
python? ( ${PYTHON_DEPS} )
xml? ( dev-libs/expat )
sys-libs/zlib
)"
)
source-highlight? (
dev-util/source-highlight
)
"
DEPEND="${RDEPEND}"
BDEPEND="
app-arch/xz-utils
@@ -89,6 +93,10 @@ BDEPEND="
nls? ( sys-devel/gettext )
)"
PATCHES=(
"${FILESDIR}"/${P}-source-highlight.patch
)
S=${WORKDIR}/${PN}-${MY_PV}
pkg_setup() {
@@ -165,6 +173,7 @@ src_configure() {
$(use_with xml expat)
$(use_with lzma)
$(use_enable nls)
$(use_enable source-highlight)
$(use multitarget && echo --enable-targets=all)
$(use_with python python "${EPYTHON}")
)

View File

@@ -62,7 +62,7 @@ SLOT="0"
if [[ ${PV} != 9999* ]] ; then
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
fi
IUSE="+client lzma multitarget nls +python +server test vanilla xml"
IUSE="+client lzma multitarget nls +python +server source-highlight test vanilla xml"
REQUIRED_USE="
python? ( ${PYTHON_REQUIRED_USE} )
|| ( client server )
@@ -78,7 +78,11 @@ RDEPEND="
python? ( ${PYTHON_DEPS} )
xml? ( dev-libs/expat )
sys-libs/zlib
)"
)
source-highlight? (
dev-util/source-highlight
)
"
DEPEND="${RDEPEND}"
BDEPEND="
app-arch/xz-utils
@@ -165,6 +169,7 @@ src_configure() {
$(use_with xml expat)
$(use_with lzma)
$(use_enable nls)
$(use_enable source-highlight)
$(use multitarget && echo --enable-targets=all)
$(use_with python python "${EPYTHON}")
)

View File

@@ -11,6 +11,7 @@
<flag name="multitarget">Support all known targets in one gdb binary</flag>
<flag name="python">Enable support for the new internal scripting language, as well as extended pretty printers</flag>
<flag name="server">Install the "gdbserver" program (useful for embedded/remote targets)</flag>
<flag name="source-highlight">Enable listing highlighting via <pkg>dev-util/source-highlight</pkg></flag>
<flag name="xml">Support parsing XML data files needed (at least) for cpu features, memory maps, and syscall tracing</flag>
</use>
<upstream>