From abbb97f075c0377c1852056f1e1130239c9d285f Mon Sep 17 00:00:00 2001 From: Thilo Fromm Date: Wed, 18 Nov 2020 14:17:12 +0100 Subject: [PATCH] sys-devel: import upstream gdb-9.2, strace-5.9 Import upstream recipes to enable gcc-9.3.0 builds. Signed-off-by: Thilo Fromm --- .../coreos-overlay/dev-util/strace/Manifest | 1 + .../strace/files/strace-5.5-static.patch | 178 +++++++++++ .../dev-util/strace/strace-5.9.ebuild | 104 +++++++ .../coreos-overlay/sys-devel/gdb/Manifest | 1 + .../sys-devel/gdb/files/gdb-9.1-ia64.patch | 15 + .../files/gdb-9.2-sim-ppc-fno-common.patch | 97 ++++++ .../sys-devel/gdb/gdb-9.2.ebuild | 282 ++++++++++++++++++ 7 files changed, 678 insertions(+) create mode 100644 sdk_container/src/third_party/coreos-overlay/dev-util/strace/files/strace-5.5-static.patch create mode 100644 sdk_container/src/third_party/coreos-overlay/dev-util/strace/strace-5.9.ebuild create mode 100644 sdk_container/src/third_party/coreos-overlay/sys-devel/gdb/files/gdb-9.1-ia64.patch create mode 100644 sdk_container/src/third_party/coreos-overlay/sys-devel/gdb/files/gdb-9.2-sim-ppc-fno-common.patch create mode 100644 sdk_container/src/third_party/coreos-overlay/sys-devel/gdb/gdb-9.2.ebuild diff --git a/sdk_container/src/third_party/coreos-overlay/dev-util/strace/Manifest b/sdk_container/src/third_party/coreos-overlay/dev-util/strace/Manifest index 4731f0b60f..557e3ea79c 100644 --- a/sdk_container/src/third_party/coreos-overlay/dev-util/strace/Manifest +++ b/sdk_container/src/third_party/coreos-overlay/dev-util/strace/Manifest @@ -1 +1,2 @@ DIST strace-5.6.tar.xz 1775292 BLAKE2B 6e674e4a1b70a3ebb28aa0097baa07efc7dce18039a3a7d535b4c8b3fc1b11c59ef1eb79e58bbf4b9e2b9621d0840958ba5785d22d0cdcb4c00fb5fa2a3288c1 SHA512 58c8a250e55a018206bee9468ea057c087d5d5bb523339ea3c01e0a19d8f84c95bd1398d66a6dca6ada45c6535aa44b776713a2bb080eebaa734ffb926ac5b38 +DIST strace-5.9.tar.xz 1847036 BLAKE2B 92d6b5e1a7821086b4e0e535d5db7849158e58ac0604fb9bb667e106b72b1ce17dfadd3960efcf553d7c7dec4622db36833aa5cdd4bc924f8b54ec6168ed82dd SHA512 f28d5dcceccb44557b39ed6f295f3250662804dc3ad79959bfadffcecc9b736e532c7c90dc89ebf9d07eb3e02a5ace231605851148ca09d41c8c60dc1ff68206 diff --git a/sdk_container/src/third_party/coreos-overlay/dev-util/strace/files/strace-5.5-static.patch b/sdk_container/src/third_party/coreos-overlay/dev-util/strace/files/strace-5.5-static.patch new file mode 100644 index 0000000000..da57ee0f93 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/dev-util/strace/files/strace-5.5-static.patch @@ -0,0 +1,178 @@ +--- /Makefile.am ++++ /Makefile.am +@@ -379,7 +379,6 @@ + if USE_LIBDW + strace_SOURCES += unwind-libdw.c + strace_CPPFLAGS += $(libdw_CPPFLAGS) +-strace_CFLAGS += $(libdw_CFLAGS) + strace_LDFLAGS += $(libdw_LDFLAGS) + strace_LDADD += $(libdw_LIBS) + endif +--- /configure.ac ++++ /configure.ac +@@ -48,6 +48,15 @@ + AC_DEFINE([MANPAGE_DATE], "[manpage_date]", [Date]) + AC_SUBST([MANPAGE_DATE], [manpage_date]) + ++AC_ARG_ENABLE([static], ++ [AS_HELP_STRING([--enable-static], ++ [link strace statically])], ++ [], [enable_static=no]) ++if test "$enable_static" = "yes"; then ++ # Add -pthread since strace wants -lrt for timer_create, and -lrt uses -lpthread. ++ LDFLAGS="$LDFLAGS -pthread -static" ++fi ++ + AC_C_BIGENDIAN + + AC_MSG_CHECKING([for supported architecture]) +--- /m4/st_libdw.m4 ++++ /m4/st_libdw.m4 +@@ -8,7 +8,6 @@ + AC_DEFUN([st_ARG_LIBDW], [dnl + + : ${libdw_CPPFLAGS=} +-: ${libdw_CFLAGS=} + : ${libdw_LDFLAGS=} + : ${libdw_LIBS=} + +@@ -34,48 +33,14 @@ + have_libdw= + + AS_IF([test "x$with_libdw" != xno && test "x$use_unwinder" = x], +- [saved_CPPFLAGS="$CPPFLAGS" +- saved_CFLAGS="$CFLAGS" +- CPPFLAGS="$CPPFLAGS $libdw_CPPFLAGS" +- CFLAGS="$CFLAGS $libdw_CFLAGS" +- +- AC_CHECK_HEADERS([elfutils/libdwfl.h], +- [AC_CHECK_LIB([dw], [dwfl_linux_proc_attach], +- [libdw_LIBS="-ldw $libdw_LIBS" +- AC_CACHE_CHECK([for elfutils version], +- [st_cv_ELFUTILS_VERSION], +- [[st_cv_ELFUTILS_VERSION="$(echo _ELFUTILS_VERSION | +- $CPP $CPPFLAGS -P -imacros elfutils/version.h - | +- grep '^[0-9]')" +- test -n "$st_cv_ELFUTILS_VERSION" || +- st_cv_ELFUTILS_VERSION=0 +- ]] +- ) +- AS_IF([test "$st_cv_ELFUTILS_VERSION" -ge 164], +- [have_libdw=yes], +- [AS_IF([test "x$with_libdw" = xyes], +- [AC_MSG_ERROR([elfutils version >= 164 is required for stack tracing support])], +- [AC_MSG_WARN([elfutils version >= 164 is required for stack tracing support])] +- ) +- ] +- ) +- ], +- [AS_IF([test "x$with_libdw" = xyes], +- [AC_MSG_FAILURE([failed to find dwfl_linux_proc_attach in libdw])], +- ) +- ], +- [$libdw_LDFLAGS $libdw_LIBS] +- ) +- ], +- [AS_IF([test "x$with_libdw" = xyes], +- [AC_MSG_FAILURE([failed to find elfutils/libdwfl.h])] +- ) +- ] +- ) +- +- CFLAGS="$saved_CFLAGS" +- CPPFLAGS="$saved_CPPFLAGS" +- ] ++ [if test "$enable_static" = "yes"; then ++ PKG_CHECK_MODULES_STATIC([LIBDW], [libdw >= 0.164]) ++ else ++ PKG_CHECK_MODULES([LIBDW], [libdw >= 0.164]) ++ fi ++ have_libdw=yes ++ libdw_CPPFLAGS="$LIBDW_CFLAGS" ++ libdw_LIBS="$LIBDW_LIBS"] + ) + + AS_IF([test "x$have_libdw" = xyes], +@@ -84,7 +49,6 @@ + [Whether to use libdw for stack tracing] + ) + AC_SUBST(libdw_CPPFLAGS) +- AC_SUBST(libdw_CFLAGS) + AC_SUBST(libdw_LDFLAGS) + AC_SUBST(libdw_LIBS) + ] +--- /m4/st_libunwind.m4 ++++ /m4/st_libunwind.m4 +@@ -28,64 +28,14 @@ + libunwind_LIBS= + + AS_IF([test "x$with_libunwind" != xno && test "x$use_unwinder" = x], +- [saved_CPPFLAGS="$CPPFLAGS" +- CPPFLAGS="$CPPFLAGS $libunwind_CPPFLAGS" +- +- AC_CHECK_HEADERS([libunwind-ptrace.h], +- [saved_LDFLAGS="$LDFLAGS" +- LDFLAGS="$LDFLAGS $libunwind_LDFLAGS" +- +- AC_CHECK_LIB([unwind], [backtrace], +- [libunwind_LIBS="-lunwind $libunwind_LIBS" +- +- AC_MSG_CHECKING([for unw_create_addr_space in libunwind-generic]) +- saved_LIBS="$LIBS" +- LIBS="-lunwind-generic $libunwind_LIBS $LIBS" +- +- AC_LINK_IFELSE( +- [AC_LANG_PROGRAM([[#include ]], +- [[return !unw_create_addr_space(0, 0)]]) +- ], +- [AC_MSG_RESULT([yes]) +- libunwind_LIBS="-lunwind-generic $libunwind_LIBS" +- +- AC_CHECK_LIB([unwind-ptrace], [_UPT_create], +- [libunwind_LIBS="-lunwind-ptrace $libunwind_LIBS" +- use_unwinder=libunwind +- ], +- [if test "x$with_libunwind" != xcheck; then +- AC_MSG_FAILURE([failed to find _UPT_create in libunwind-ptrace]) +- fi +- ], +- [$libunwind_LIBS] +- ) +- ], +- [AC_MSG_RESULT([no]) +- if test "x$with_libunwind" != xcheck; then +- AC_MSG_FAILURE([failed to find unw_create_addr_space in libunwind-generic]) +- fi +- ] +- ) +- +- LIBS="$saved_LIBS" +- ], +- [if test "x$with_libunwind" != xcheck; then +- AC_MSG_FAILURE([failed to find libunwind]) +- fi +- ], +- [$libunwind_LIBS] +- ) +- +- LDFLAGS="$saved_LDFLAGS" +- ], +- [if test "x$with_libunwind" != xcheck; then +- AC_MSG_FAILURE([failed to find libunwind-ptrace.h]) +- fi +- ] +- ) +- +- CPPFLAGS="$saved_CPPFLAGS" +- ] ++ [if test "$enable_static" = "yes"; then ++ PKG_CHECK_MODULES_STATIC([LIBUNWIND], [libunwind libunwind-generic libunwind-ptrace]) ++ else ++ PKG_CHECK_MODULES([LIBUNWIND], [libunwind libunwind-generic libunwind-ptrace]) ++ fi ++ use_unwinder="libunwind" ++ libunwind_CPPFLAGS="$LIBUNWIND_CFLAGS" ++ libunwind_LIBS="$LIBUNWIND_LIBS"] + ) + + if test "x$use_unwinder" = xlibunwind; then diff --git a/sdk_container/src/third_party/coreos-overlay/dev-util/strace/strace-5.9.ebuild b/sdk_container/src/third_party/coreos-overlay/dev-util/strace/strace-5.9.ebuild new file mode 100644 index 0000000000..c08dbf18c0 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/dev-util/strace/strace-5.9.ebuild @@ -0,0 +1,104 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit autotools flag-o-matic toolchain-funcs + +if [[ ${PV} == "9999" ]] ; then + EGIT_REPO_URI="https://github.com/strace/strace.git" + inherit git-r3 autotools +else + SRC_URI="https://github.com/${PN}/${PN}/releases/download/v${PV}/${P}.tar.xz" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux" +fi + +DESCRIPTION="A useful diagnostic, instructional, and debugging tool" +HOMEPAGE="https://strace.io/" + +LICENSE="BSD" +SLOT="0" +IUSE="aio perl static unwind elfutils" + +REQUIRED_USE="?? ( unwind elfutils )" + +BDEPEND=" + virtual/pkgconfig +" +LIB_DEPEND=" + unwind? ( sys-libs/libunwind[static-libs(+)] ) + elfutils? ( dev-libs/elfutils[static-libs(+)] ) +" +# strace only uses the header from libaio to decode structs +DEPEND=" + static? ( ${LIB_DEPEND} ) + aio? ( >=dev-libs/libaio-0.3.106 ) + sys-kernel/linux-headers +" +RDEPEND=" + !static? ( ${LIB_DEPEND//\[static-libs(+)]} ) + perl? ( dev-lang/perl ) +" + +PATCHES=( + "${FILESDIR}/${PN}-5.5-static.patch" +) + +src_prepare() { + default + + eautoreconf + + if [[ ! -e configure ]] ; then + # git generation + sed /autoreconf/d -i bootstrap || die + ./bootstrap || die + eautoreconf + [[ ! -e CREDITS ]] && cp CREDITS{.in,} + fi + + filter-lfs-flags # configure handles this sanely + + export ac_cv_header_libaio_h=$(usex aio) + use elibc_musl && export ac_cv_header_stdc=no + + # Stub out the -k test since it's known to be flaky. #545812 + sed -i '1iexit 77' tests*/strace-k.test || die +} + +src_configure() { + # Set up the default build settings, and then use the names strace expects. + tc-export_build_env BUILD_{CC,CPP} + local v bv + for v in CC CPP {C,CPP,LD}FLAGS ; do + bv="BUILD_${v}" + export "${v}_FOR_BUILD=${!bv}" + done + + # Don't require mpers support on non-multilib systems. #649560 + local myeconfargs=( + --disable-gcc-Werror + --enable-mpers=check + $(use_enable static) + $(use_with unwind libunwind) + $(use_with elfutils libdw) + ) + econf "${myeconfargs[@]}" +} + +src_test() { + if has usersandbox ${FEATURES} ; then + ewarn "Test suite is known to fail with FEATURES=usersandbox -- skipping ..." #643044 + return 0 + fi + + default +} + +src_install() { + default + if ! use perl ; then + rm "${ED}"/usr/bin/strace-graph || die + fi + dodoc CREDITS +} diff --git a/sdk_container/src/third_party/coreos-overlay/sys-devel/gdb/Manifest b/sdk_container/src/third_party/coreos-overlay/sys-devel/gdb/Manifest index 5c3fc0f0d8..48f7572853 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-devel/gdb/Manifest +++ b/sdk_container/src/third_party/coreos-overlay/sys-devel/gdb/Manifest @@ -1 +1,2 @@ DIST gdb-9.1.tar.xz 20980824 BLAKE2B b84b1dc627d7ba697dfd76ba7c0f4f88f1725e1e1b83134d08cf53bf867ebfa07e1d01eff2acd9a57d22a779077bf6ed95d6098e8a58c4d86eaed034ca62ac30 SHA512 84cdd408d80a3fc5779de459c5b26154d31b329ebde7e3aa78799fb1eb245d8b64b8c8ee7242382a1dbd95b4e6f9d84fef41d12a0646aa75d3dee4709ea1f6e7 +DIST gdb-9.2.tar.xz 20979436 BLAKE2B e83468f2d2fdcf4a7eb2943564750c7e9e9fa19b00bd832a9c149ad06b199cc7d6e7b8808d552e5f0e9e4f701a9262faf6b0b46ed4e0b4ecd3a0303d873d6d9a SHA512 73635f00f343117aa5e2436f1e1597099e2bfb31ef7bb162b273fa1ea282c3fa9b0f52762e70bfc7ad0334addb8d159e9ac7cbe5998ca4f755ea8cf90714d274 diff --git a/sdk_container/src/third_party/coreos-overlay/sys-devel/gdb/files/gdb-9.1-ia64.patch b/sdk_container/src/third_party/coreos-overlay/sys-devel/gdb/files/gdb-9.1-ia64.patch new file mode 100644 index 0000000000..49a21e4cdd --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/sys-devel/gdb/files/gdb-9.1-ia64.patch @@ -0,0 +1,15 @@ +https://sourceware.org/pipermail/gdb-patches/2020-May/168808.html + +--- a/gdb/ia64-linux-nat.c ++++ b/gdb/ia64-linux-nat.c +@@ -21,6 +21,7 @@ + #include "defs.h" + #include "inferior.h" + #include "target.h" ++#include "gdbarch.h" + #include "gdbcore.h" + #include "regcache.h" + #include "ia64-tdep.h" +-- +2.26.2 + diff --git a/sdk_container/src/third_party/coreos-overlay/sys-devel/gdb/files/gdb-9.2-sim-ppc-fno-common.patch b/sdk_container/src/third_party/coreos-overlay/sys-devel/gdb/files/gdb-9.2-sim-ppc-fno-common.patch new file mode 100644 index 0000000000..76b29649ad --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/sys-devel/gdb/files/gdb-9.2-sim-ppc-fno-common.patch @@ -0,0 +1,97 @@ +https://bugs.gentoo.org/738272 +https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=ad8464f799a4c96c7ab8bdfec3f95846cf54f9b0 + +From ad8464f799a4c96c7ab8bdfec3f95846cf54f9b0 Mon Sep 17 00:00:00 2001 +From: Sebastian Huber +Date: Wed, 1 Jul 2020 19:29:55 +0200 +Subject: [PATCH] sim/ppc: Fix linker error with -fno-common + +GCC 10 enables -fno-common by default. This resulted in a multiple +definition linker error since global variables were declared and defined +in a header file: + + ld: ld-insn.o:sim/ppc/ld-insn.h:221: multiple definition of + `max_model_fields_len'; igen.o:sim/ppc/ld-insn.h:221: first defined here + +sim/ppc + + * ld-insn.h (last_model, last_model_data, last_model_function, + last_model_internal, last_model_macro, last_model_static): + Delete. + (max_model_fields_len, model_data, model_functions, + model_internal, model_macros, model_static, models): Declare, but do not + define. + * ld-insn.c (last_model, last_model_data, last_model_function, + last_model_internal, last_model_macro, last_model_static, + max_model_fields_len, model_data, model_functions, + model_internal, model_macros, model_static, models): Define. +--- + sim/ppc/ld-insn.c | 18 ++++++++++++++++++ + sim/ppc/ld-insn.h | 24 +++++++----------------- + 3 files changed, 38 insertions(+), 17 deletions(-) + +--- a/sim/ppc/ld-insn.c ++++ b/sim/ppc/ld-insn.c +@@ -28,6 +28,24 @@ + + #include "igen.h" + ++static model *last_model; ++ ++static insn *last_model_macro; ++static insn *last_model_function; ++static insn *last_model_internal; ++static insn *last_model_static; ++static insn *last_model_data; ++ ++model *models; ++ ++insn *model_macros; ++insn *model_functions; ++insn *model_internal; ++insn *model_static; ++insn *model_data; ++ ++int max_model_fields_len; ++ + static void + update_depth(insn_table *entry, + lf *file, +--- a/sim/ppc/ld-insn.h ++++ b/sim/ppc/ld-insn.h +@@ -200,25 +200,15 @@ extern insn_table *load_insn_table + table_include *includes, + cache_table **cache_rules); + +-model *models; +-model *last_model; ++extern model *models; + +-insn *model_macros; +-insn *last_model_macro; ++extern insn *model_macros; ++extern insn *model_functions; ++extern insn *model_internal; ++extern insn *model_static; ++extern insn *model_data; + +-insn *model_functions; +-insn *last_model_function; +- +-insn *model_internal; +-insn *last_model_internal; +- +-insn *model_static; +-insn *last_model_static; +- +-insn *model_data; +-insn *last_model_data; +- +-int max_model_fields_len; ++extern int max_model_fields_len; + + extern void insn_table_insert_insn + (insn_table *table, +-- +2.28.0 + diff --git a/sdk_container/src/third_party/coreos-overlay/sys-devel/gdb/gdb-9.2.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-devel/gdb/gdb-9.2.ebuild new file mode 100644 index 0000000000..cb10cf1b5d --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/sys-devel/gdb/gdb-9.2.ebuild @@ -0,0 +1,282 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +PYTHON_COMPAT=( python3_{6,7,8,9} ) + +inherit eutils flag-o-matic python-single-r1 toolchain-funcs + +export CTARGET=${CTARGET:-${CHOST}} +if [[ ${CTARGET} == ${CHOST} ]] ; then + if [[ ${CATEGORY} == cross-* ]] ; then + export CTARGET=${CATEGORY#cross-} + fi +fi +is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; } + +case ${PV} in +9999*) + # live git tree + EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git" + inherit git-r3 + SRC_URI="" + ;; +*.*.50.2???????) + # weekly snapshots + SRC_URI="ftp://sourceware.org/pub/gdb/snapshots/current/gdb-weekly-${PV}.tar.xz" + ;; +*) + # Normal upstream release + SRC_URI="mirror://gnu/gdb/${P}.tar.xz + ftp://sourceware.org/pub/gdb/releases/${P}.tar.xz" + ;; +esac + +PATCH_VER="" +PATCH_DEV="" +DESCRIPTION="GNU debugger" +HOMEPAGE="https://sourceware.org/gdb/" +SRC_URI="${SRC_URI} + ${PATCH_DEV:+https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz} + ${PATCH_VER:+mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz} +" + +LICENSE="GPL-2 LGPL-2" +SLOT="0" +if [[ ${PV} != 9999* ]] ; then + KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +fi +IUSE="+client lzma multitarget nls +python +server source-highlight test vanilla xml xxhash" +REQUIRED_USE=" + python? ( ${PYTHON_REQUIRED_USE} ) + || ( client server ) +" + +# ia64 kernel crashes when gdb testsuite is running +# hppa kernel crashes when gdb testsuite is running +RESTRICT=" + hppa? ( test ) + ia64? ( test ) + + !test? ( test ) +" + +RDEPEND=" + client? ( + dev-libs/mpfr:0= + >=sys-libs/ncurses-5.2-r2:0= + >=sys-libs/readline-7:0= + lzma? ( app-arch/xz-utils ) + python? ( ${PYTHON_DEPS} ) + xml? ( dev-libs/expat ) + sys-libs/zlib + ) + source-highlight? ( + dev-util/source-highlight + ) + xxhash? ( + dev-libs/xxhash + ) +" +DEPEND="${RDEPEND}" +BDEPEND=" + app-arch/xz-utils + sys-apps/texinfo + client? ( + virtual/yacc + test? ( dev-util/dejagnu ) + nls? ( sys-devel/gettext ) + )" + +PATCHES=( + "${FILESDIR}"/${PN}-8.3.1-verbose-build.patch + "${FILESDIR}"/${PN}-9.1-ia64.patch + "${FILESDIR}"/${P}-sim-ppc-fno-common.patch +) + +GDB_BUILD_DIR="${WORKDIR}"/${P}-build + +pkg_setup() { + use python && python-single-r1_pkg_setup +} + +src_prepare() { + default + + strip-linguas -u bfd/po opcodes/po +} + +gdb_branding() { + printf "Gentoo ${PV} " + if ! use vanilla && [[ -n ${PATCH_VER} ]] ; then + printf "p${PATCH_VER}" + else + printf "vanilla" + fi + [[ -n ${EGIT_COMMIT} ]] && printf " ${EGIT_COMMIT}" +} + +src_configure() { + strip-unsupported-flags + + local myconf=( + # portage's econf() does not detect presence of --d-d-t + # because it greps only top-level ./configure. But not + # gnulib's or gdb's configure. + --disable-dependency-tracking + + --with-pkgversion="$(gdb_branding)" + --with-bugurl='https://bugs.gentoo.org/' + --disable-werror + # Disable modules that are in a combined binutils/gdb tree. #490566 + --disable-{binutils,etc,gas,gold,gprof,ld} + ) + local sysroot="${EPREFIX}/usr/${CTARGET}" + is_cross && myconf+=( + --with-sysroot="${sysroot}" + --includedir="${sysroot}/usr/include" + --with-gdb-datadir="\${datadir}/gdb/${CTARGET}" + ) + + if use server && ! use client ; then + # just configure+build in the gdbserver subdir to speed things up + cd gdb/gdbserver + myconf+=( --program-transform-name='' ) + else + # gdbserver only works for native targets (CHOST==CTARGET). + # it also doesn't support all targets, so rather than duplicate + # the target list (which changes between versions), use the + # "auto" value when things are turned on. + is_cross \ + && myconf+=( --disable-gdbserver ) \ + || myconf+=( $(use_enable server gdbserver auto) ) + fi + + if ! ( use server && ! use client ) ; then + # if we are configuring in the top level, then use all + # the additional global options + myconf+=( + --enable-64-bit-bfd + --disable-install-libbfd + --disable-install-libiberty + # Disable guile for now as it requires guile-2.x #562902 + --without-guile + # This only disables building in the readline subdir. + # For gdb itself, it'll use the system version. + --disable-readline + --with-system-readline + # This only disables building in the zlib subdir. + # For gdb itself, it'll use the system version. + --without-zlib + --with-system-zlib + --with-separate-debug-dir="${EPREFIX}"/usr/lib/debug + $(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}") + $(use_with xxhash) + ) + fi + if use sparc-solaris || use x86-solaris ; then + # disable largefile support + # https://sourceware.org/ml/gdb-patches/2014-12/msg00058.html + myconf+=( --disable-largefile ) + fi + + # source-highlight is detected with pkg-config: bug #716558 + export ac_cv_path_pkg_config_prog_path="$(tc-getPKG_CONFIG)" + + mkdir "${GDB_BUILD_DIR}" || die + pushd "${GDB_BUILD_DIR}" || die + ECONF_SOURCE=${S} + econf "${myconf[@]}" + popd +} + +src_compile() { + emake -C "${GDB_BUILD_DIR}" +} + +src_test() { + emake -C "${GDB_BUILD_DIR}" check +} + +src_install() { + if use server && ! use client; then + emake -C "${GDB_BUILD_DIR}"/gdb/gdbserver DESTDIR="${D}" install + else + emake -C "${GDB_BUILD_DIR}" DESTDIR="${D}" install + fi + + if use client; then + find "${ED}"/usr -name libiberty.a -delete || die + fi + + # Delete translations that conflict with binutils-libs. #528088 + # Note: Should figure out how to store these in an internal gdb dir. + if use nls ; then + find "${ED}" \ + -regextype posix-extended -regex '.*/(bfd|opcodes)[.]g?mo$' \ + -delete || die + fi + + # Don't install docs when building a cross-gdb + if [[ ${CTARGET} != ${CHOST} ]] ; then + rm -rf "${ED}"/usr/share/{doc,info,locale} || die + local f + for f in "${ED}"/usr/share/man/*/* ; do + if [[ ${f##*/} != ${CTARGET}-* ]] ; then + mv "${f}" "${f%/*}/${CTARGET}-${f##*/}" || die + fi + done + return 0 + fi + # Install it by hand for now: + # https://sourceware.org/ml/gdb-patches/2011-12/msg00915.html + # Only install if it exists due to the twisted behavior (see + # notes in src_configure above). + [[ -e "${GDB_BUILD_DIR}"/gdb/gdbserver/gdbreplay ]] && dobin "${GDB_BUILD_DIR}"/gdb/gdbserver/gdbreplay + + if use client ; then + docinto gdb + dodoc gdb/CONTRIBUTE gdb/README gdb/MAINTAINERS \ + gdb/NEWS gdb/ChangeLog gdb/PROBLEMS + fi + docinto sim + dodoc sim/{ChangeLog,MAINTAINERS,README-HACKING} + if use server ; then + docinto gdbserver + dodoc gdb/gdbserver/{ChangeLog,README} + fi + + if [[ -n ${PATCH_VER} ]] ; then + dodoc "${WORKDIR}"/extra/gdbinit.sample + fi + + # Remove shared info pages + rm -f "${ED}"/usr/share/info/{annotate,bfd,configure,standards}.info* + + # gcore is part of ubin on freebsd + if [[ ${CHOST} == *-freebsd* ]]; then + rm "${ED}"/usr/bin/gcore || die + fi + + if use python; then + python_optimize "${ED}"/usr/share/gdb/python/gdb + fi +} + +pkg_postinst() { + # portage sucks and doesnt unmerge files in /etc + rm -vf "${EROOT}"/etc/skel/.gdbinit + + if use prefix && [[ ${CHOST} == *-darwin* ]] ; then + ewarn "gdb is unable to get a mach task port when installed by Prefix" + ewarn "Portage, unprivileged. To make gdb fully functional you'll" + ewarn "have to perform the following steps:" + ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb" + ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb" + fi +}