1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python{2_7,3_3,3_4} )
8 inherit flag-o-matic eutils python-single-r1
10 export CTARGET=${CTARGET:-${CHOST}}
11 if [[ ${CTARGET} == ${CHOST} ]] ; then
12 if [[ ${CATEGORY} == cross-* ]] ; then
13 export CTARGET=${CATEGORY#cross-}
16 is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
23 SRC_URI="ftp://sourceware.org/pub/gdb/snapshots/current/gdb-weekly-${PV}.tar.bz2"
27 EGIT_REPO_URI="git://sourceware.org/git/binutils-gdb.git"
32 # Normal upstream release
33 SRC_URI="mirror://gnu/gdb/${P}.tar.xz
34 ftp://sourceware.org/pub/gdb/releases/${P}.tar.xz"
39 DESCRIPTION="GNU debugger"
40 HOMEPAGE="http://sourceware.org/gdb/"
41 SRC_URI="${SRC_URI} ${PATCH_VER:+mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz}"
43 LICENSE="GPL-2 LGPL-2"
45 if [[ ${PV} != 9999* ]] ; then
46 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
48 IUSE="+client expat lzma multitarget nls +python +server test vanilla zlib"
49 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
51 RDEPEND="!dev-util/gdbserver
52 >=sys-libs/ncurses-5.2-r2
54 expat? ( dev-libs/expat )
55 lzma? ( app-arch/xz-utils )
56 python? ( ${PYTHON_DEPS} )
57 zlib? ( sys-libs/zlib )"
61 test? ( dev-util/dejagnu )
62 nls? ( sys-devel/gettext )"
64 S=${WORKDIR}/${PN}-${MY_PV}
67 use python && python-single-r1_pkg_setup
71 [[ -n ${RPM} ]] && rpm_spec_epatch "${WORKDIR}"/gdb.spec
72 ! use vanilla && [[ -n ${PATCH_VER} ]] && EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
74 strip-linguas -u bfd/po opcodes/po
78 printf "Gentoo ${PV} "
79 if ! use vanilla && [[ -n ${PATCH_VER} ]] ; then
80 printf "p${PATCH_VER}"
87 strip-unsupported-flags
90 --with-pkgversion="$(gdb_branding)"
91 --with-bugurl='http://bugs.gentoo.org/'
93 # Disable modules that are in a combined binutils/gdb tree. #490566
94 --disable-{binutils,etc,gas,gold,gprof,ld}
96 local sysroot="${EPREFIX}/usr/${CTARGET}"
98 --with-sysroot="${sysroot}"
99 --includedir="${sysroot}/usr/include"
100 --with-gdb-datadir="\${datadir}/gdb/${CTARGET}"
103 if use server && ! use client ; then
104 # just configure+build in the gdbserver subdir to speed things up
106 myconf+=( --program-transform-name='' )
108 # gdbserver only works for native targets (CHOST==CTARGET).
109 # it also doesn't support all targets, so rather than duplicate
110 # the target list (which changes between versions), use the
111 # "auto" value when things are turned on.
113 && myconf+=( --disable-gdbserver ) \
114 || myconf+=( $(use_enable server gdbserver auto) )
117 if ! ( use server && ! use client ) ; then
118 # if we are configuring in the top level, then use all
119 # the additional global options
122 --disable-install-libbfd
123 --disable-install-libiberty
124 # This only disables building in the readline subdir.
125 # For gdb itself, it'll use the system version.
127 --with-system-readline
128 --with-separate-debug-dir="${EPREFIX}"/usr/lib/debug
132 $(use multitarget && echo --enable-targets=all)
133 $(use_with python python "${EPYTHON}")
142 nonfatal emake check || ewarn "tests failed"
146 use server && ! use client && cd gdb/gdbserver
148 use client && find "${ED}"/usr -name libiberty.a -delete
151 # Don't install docs when building a cross-gdb
152 if [[ ${CTARGET} != ${CHOST} ]] ; then
153 rm -r "${ED}"/usr/share/{doc,info,locale}
155 for f in "${ED}"/usr/share/man/*/* ; do
156 if [[ ${f##*/} != ${CTARGET}-* ]] ; then
157 mv "${f}" "${f%/*}/${CTARGET}-${f##*/}" || die
162 # Install it by hand for now:
163 # http://sourceware.org/ml/gdb-patches/2011-12/msg00915.html
164 # Only install if it exists due to the twisted behavior (see
165 # notes in src_configure above).
166 [[ -e gdb/gdbserver/gdbreplay ]] && dobin gdb/gdbserver/gdbreplay
170 dodoc gdb/CONTRIBUTE gdb/README gdb/MAINTAINERS \
171 gdb/NEWS gdb/ChangeLog gdb/PROBLEMS
174 dodoc sim/{ChangeLog,MAINTAINERS,README-HACKING}
177 dodoc gdb/gdbserver/{ChangeLog,README}
180 if [[ -n ${PATCH_VER} ]] ; then
181 dodoc "${WORKDIR}"/extra/gdbinit.sample
184 # Remove shared info pages
185 rm -f "${ED}"/usr/share/info/{annotate,bfd,configure,standards}.info*
189 # portage sucks and doesnt unmerge files in /etc
190 rm -vf "${EROOT}"/etc/skel/.gdbinit
192 if use prefix && [[ ${CHOST} == *-darwin* ]] ; then
193 ewarn "gdb is unable to get a mach task port when installed by Prefix"
194 ewarn "Portage, unprivileged. To make gdb fully functional you'll"
195 ewarn "have to perform the following steps:"
196 ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
197 ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"