[PATCH 1/2] gdb: Install local source-highlight data directory
Stephanos Ioannidis
root@stephanos.io
Tue Jun 2 06:53:21 GMT 2020
The source-highlight data directory, which contains the input language
and output format definition files, is required for source code syntax
highlighting feature to work properly.
This patch adds the installation targets necessary to copy the required
files under the automatically detected source-highlight data directory
to the gdb data directory.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
---
gdb/configure | 21 ++++++++++
gdb/configure.ac | 7 ++++
gdb/data-directory/Makefile.in | 72 +++++++++++++++++++++++++++++++---
3 files changed, 95 insertions(+), 5 deletions(-)
diff --git a/gdb/configure b/gdb/configure
index f659a4772b..5d6f48edcf 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -711,8 +711,11 @@ ALLOCA
LTLIBIPT
LIBIPT
HAVE_LIBIPT
+HAVE_SOURCE_HIGHLIGHT_FALSE
+HAVE_SOURCE_HIGHLIGHT_TRUE
SRCHIGH_CFLAGS
SRCHIGH_LIBS
+SRCHIGH_PREFIX
HAVE_GUILE_FALSE
HAVE_GUILE_TRUE
GUILE_LIBS
@@ -11319,6 +11322,7 @@ fi
# Check for source highlight. #
# ---------------------------- #
+SRCHIGH_PREFIX=
SRCHIGH_LIBS=
SRCHIGH_CFLAGS=
@@ -11334,6 +11338,8 @@ else
fi
+have_libsource_highlight=no
+
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; }
@@ -11345,8 +11351,10 @@ $as_echo "no - pkg-config not found" >&6; }
fi
else
if ${pkg_config_prog_path} --exists source-highlight; then
+ SRCHIGH_PREFIX=`${pkg_config_prog_path} --variable=prefix source-highlight`
SRCHIGH_CFLAGS=`${pkg_config_prog_path} --cflags source-highlight`
SRCHIGH_LIBS=`${pkg_config_prog_path} --libs source-highlight`
+ have_libsource_highlight=yes
$as_echo "#define HAVE_SOURCE_HIGHLIGHT 1" >>confdefs.h
@@ -11364,6 +11372,15 @@ fi
+ if test "${have_libsource_highlight}" != no; then
+ HAVE_SOURCE_HIGHLIGHT_TRUE=
+ HAVE_SOURCE_HIGHLIGHT_FALSE='#'
+else
+ HAVE_SOURCE_HIGHLIGHT_TRUE='#'
+ HAVE_SOURCE_HIGHLIGHT_FALSE=
+fi
+
+
# Check whether --with-intel_pt was given.
if test "${with_intel_pt+set}" = set; then :
@@ -19122,6 +19139,10 @@ if test -z "${HAVE_GUILE_TRUE}" && test -z "${HAVE_GUILE_FALSE}"; then
as_fn_error $? "conditional \"HAVE_GUILE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${HAVE_SOURCE_HIGHLIGHT_TRUE}" && test -z "${HAVE_SOURCE_HIGHLIGHT_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_SOURCE_HIGHLIGHT\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 6d5526a516..589c725370 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1158,6 +1158,7 @@ AM_CONDITIONAL(HAVE_GUILE, test "${have_libguile}" != no)
# Check for source highlight. #
# ---------------------------- #
+SRCHIGH_PREFIX=
SRCHIGH_LIBS=
SRCHIGH_CFLAGS=
@@ -1171,6 +1172,8 @@ AC_ARG_ENABLE(source-highlight,
esac],
[enable_source_highlight=auto])
+have_libsource_highlight=no
+
if test "${enable_source_highlight}" != "no"; then
AC_MSG_CHECKING([for the source-highlight library])
if test "${pkg_config_prog_path}" = "missing"; then
@@ -1180,8 +1183,10 @@ if test "${enable_source_highlight}" != "no"; then
fi
else
if ${pkg_config_prog_path} --exists source-highlight; then
+ SRCHIGH_PREFIX=`${pkg_config_prog_path} --variable=prefix source-highlight`
SRCHIGH_CFLAGS=`${pkg_config_prog_path} --cflags source-highlight`
SRCHIGH_LIBS=`${pkg_config_prog_path} --libs source-highlight`
+ have_libsource_highlight=yes
AC_DEFINE([HAVE_SOURCE_HIGHLIGHT], 1,
[Define to 1 if the source-highlight library is available])
AC_MSG_RESULT([yes])
@@ -1193,8 +1198,10 @@ if test "${enable_source_highlight}" != "no"; then
fi
fi
fi
+AC_SUBST(SRCHIGH_PREFIX)
AC_SUBST(SRCHIGH_LIBS)
AC_SUBST(SRCHIGH_CFLAGS)
+AM_CONDITIONAL(HAVE_SOURCE_HIGHLIGHT, test "${have_libsource_highlight}" != no)
AC_ARG_WITH(intel_pt,
AS_HELP_STRING([--with-intel-pt], [include Intel Processor Trace support (auto/yes/no)]),
diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in
index 68b794a353..0dd0625af3 100644
--- a/gdb/data-directory/Makefile.in
+++ b/gdb/data-directory/Makefile.in
@@ -23,8 +23,9 @@ srcdir = @srcdir@
SYSCALLS_SRCDIR = $(srcdir)/../syscalls
PYTHON_SRCDIR = $(srcdir)/../python/lib
GUILE_SRCDIR = $(srcdir)/../guile/lib
+SOURCE_HIGHLIGHT_SRCDIR = @SRCHIGH_PREFIX@/share/source-highlight
SYSTEM_GDBINIT_SRCDIR = $(srcdir)/../system-gdbinit
-VPATH = $(srcdir):$(SYSCALLS_SRCDIR):$(PYTHON_SRCDIR):$(GUILE_SRCDIR):$(SYSTEM_GDBINIT_SRCDIR)
+VPATH = $(srcdir):$(SYSCALLS_SRCDIR):$(PYTHON_SRCDIR):$(GUILE_SRCDIR):$(SOURCE_HIGHLIGHT_SRCDIR):$(SYSTEM_GDBINIT_SRCDIR)
XSLTPROC = @XSLTPROC@
top_srcdir = @top_srcdir@
@@ -133,6 +134,24 @@ GUILD_COMPILE_FLAGS = \
-Warity-mismatch -Wformat -Wunused-toplevel \
-L .
+SOURCE_HIGHLIGHT_DIR = source-highlight
+SOURCE_HIGHLIGHT_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(SOURCE_HIGHLIGHT_DIR)
+
+SOURCE_HIGHLIGHT_FILE_LIST = \
+ lang.map \
+ outlang.map \
+ style.defaults \
+ *.lang \
+ *.outlang \
+ *.style
+
+SOURCE_HIGHLIGHT_FILE_LIST_EXPANDED = \
+ $(patsubst $(SOURCE_HIGHLIGHT_SRCDIR)/%,%,$(wildcard $(addprefix \
+ $(SOURCE_HIGHLIGHT_SRCDIR)/,$(SOURCE_HIGHLIGHT_FILE_LIST))))
+
+@HAVE_SOURCE_HIGHLIGHT_TRUE@SOURCE_HIGHLIGHT_FILES = $(SOURCE_HIGHLIGHT_FILE_LIST_EXPANDED)
+@HAVE_SOURCE_HIGHLIGHT_FALSE@SOURCE_HIGHLIGHT_FILES =
+
SYSTEM_GDBINIT_DIR = system-gdbinit
SYSTEM_GDBINIT_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(SYSTEM_GDBINIT_DIR)
SYSTEM_GDBINIT_FILES = \
@@ -172,7 +191,8 @@ FLAGS_TO_PASS = \
"RUNTESTFLAGS=$(RUNTESTFLAGS)"
.PHONY: all
-all: stamp-syscalls stamp-python stamp-guile stamp-system-gdbinit
+all: stamp-syscalls stamp-python stamp-guile stamp-source-highlight \
+ stamp-system-gdbinit
%.xml: @MAINTAINER_MODE_TRUE@ %.xml.in apply-defaults.xsl linux-defaults.xml.in
$(XSLTPROC) -o $(SYSCALLS_SRCDIR)/$@ $(SYSCALLS_SRCDIR)/apply-defaults.xsl\
@@ -327,6 +347,47 @@ uninstall-guile:
done ; \
fi
+stamp-source-highlight: Makefile $(SOURCE_HIGHLIGHT_FILES)
+ rm -rf ./$(SOURCE_HIGHLIGHT_DIR)
+ mkdir ./$(SOURCE_HIGHLIGHT_DIR)
+ files='$(SOURCE_HIGHLIGHT_FILES)' ; \
+ for file in $$files ; do \
+ f=$(SOURCE_HIGHLIGHT_SRCDIR)/$$file ; \
+ if test -f $$f ; then \
+ $(INSTALL_DATA) $$f ./$(SOURCE_HIGHLIGHT_DIR) ; \
+ fi ; \
+ done
+ touch $@
+
+.PHONY: clean-source-highlight
+clean-source-highlight:
+ rm -rf $(SOURCE_HIGHLIGHT_DIR)
+ rm -f stamp-source-highlight
+
+.PHONY: install-source-highlight
+install-source-highlight:
+ $(INSTALL_DIR) $(SOURCE_HIGHLIGHT_INSTALL_DIR)
+ files='$(SOURCE_HIGHLIGHT_FILES)' ; \
+ for file in $$files; do \
+ f=$(SOURCE_HIGHLIGHT_SRCDIR)/$$file ; \
+ if test -f $$f ; then \
+ $(INSTALL_DATA) $$f $(SOURCE_HIGHLIGHT_INSTALL_DIR) ; \
+ fi ; \
+ done
+
+.PHONY: uninstall-source-highlight
+uninstall-source-highlight:
+ files='$(SOURCE_HIGHLIGHT_FILES)' ; \
+ for file in $$files ; do \
+ slashdir=`echo "/$$file" | sed 's,/[^/]*$$,,'` ; \
+ rm -f $(SOURCE_HIGHLIGHT_INSTALL_DIR)/$$file ; \
+ while test "x$$file" != "x$$slashdir" ; do \
+ rmdir 2>/dev/null "$(SOURCE_HIGHLIGHT_INSTALL_DIR)$$slashdir" ; \
+ file="$$slashdir" ; \
+ slashdir=`echo "$$file" | sed 's,/[^/]*$$,,'` ; \
+ done \
+ done
+
stamp-system-gdbinit: Makefile $(SYSTEM_GDBINIT_FILES)
rm -rf ./$(SYSTEM_GDBINIT_DIR)
mkdir ./$(SYSTEM_GDBINIT_DIR)
@@ -379,14 +440,15 @@ install: all
.PHONY: install-only
install-only: install-syscalls install-python install-guile \
- install-system-gdbinit
+ install-source-highlight install-system-gdbinit
.PHONY: uninstall
uninstall: uninstall-syscalls uninstall-python uninstall-guile \
- uninstall-system-gdbinit
+ uninstall-source-highlight uninstall-system-gdbinit
.PHONY: clean
-clean: clean-syscalls clean-python clean-guile clean-system-gdbinit
+clean: clean-syscalls clean-python clean-guile clean-source-highlight \
+ clean-system-gdbinit
.PHONY: maintainer-clean realclean distclean
maintainer-clean realclean distclean: clean
--
2.26.2
More information about the Gdb-patches
mailing list