Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 200257 - Backtrace docs: mention /etc/portage/env
Summary: Backtrace docs: mention /etc/portage/env
Status: RESOLVED WONTFIX
Alias: None
Product: Documentation
Classification: Unclassified
Component: Project-specific documentation (show other bugs)
Hardware: All Linux
: High normal
Assignee: Gentoo Quality Assurance Team
URL: http://www.gentoo.org/proj/en/qa/back...
Whiteboard:
Keywords:
: 200254 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-11-25 05:59 UTC by virdiq
Modified: 2009-09-06 09:24 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description virdiq 2007-11-25 05:59:44 UTC
The backtrace/debugging documentation (see URL for this bug) currently doesn't refer to changing
FEATURES/CFLAGS per-package via /etc/portage/env.

I think it'd be very handy to have this information in the document to make it
easier for people to build debug versions of a particular package (rather than
having them build it separately without using portage).

An example of expanded documentation may include the requirement to install
"debugedit", the "installsources" FEATURE and how to change the CFLAGS/FEATURES
from within /etc/portage/env.

An example of an entry in /etc/portage/env (zmedico kindly helped me out with
this example for glibc):
<zmedico> cat /etc/portage/env/sys-libs/glibc
<zmedico> if [[ ${EBUILD_PHASE} != depend ]] && ! hasq splitdebug ${FEATURES} ;
then
<zmedico>         einfo "bashrc is enabling splitdebug for glibc"
<zmedico>         export FEATURES="${FEATURES} installsources splitdebug"
<zmedico>         export CFLAGS="${CFLAGS} -ggdb"
<zmedico> fi

The reason I ask for these changes is that I couldn't find much information on
this topic when searching with Google and it would make the backtrace
documentation far easier for people to understand and put into practice.
Comment 1 virdiq 2007-11-25 05:59:59 UTC
*** Bug 200254 has been marked as a duplicate of this bug. ***
Comment 2 nm (RETIRED) gentoo-dev 2007-11-25 07:23:24 UTC
Setting per-package CFLAGS and FEATURES is not in any way officially supported, so I don't think it should be suggested in any of our documentation. This has come up before on the forums, and I had to put it into the compilation doc (http://www.gentoo.org/doc/en/gcc-optimization.xml#doc_chap3_sect5) because of it.

See http://forums.gentoo.org/viewtopic-t-613247.html; it's an internal Portage feature, not something that users should be setting. (http://forums.gentoo.org/viewtopic-p-3832057.html#3832057)
Comment 3 Diego Elio Pettenò (RETIRED) gentoo-dev 2007-11-25 10:26:11 UTC
I agree with nightmorph. The day that we can do this more easily, without having to deal with EBUILD_PHASE, I'll see to add it. As it is, it's too much an hack to document it in proper documents.
Comment 4 Bo Ørsted Andresen (RETIRED) gentoo-dev 2007-11-26 05:52:22 UTC
(In reply to comment #3)
> I agree with nightmorph. The day that we can do this more easily, without
> having to deal with EBUILD_PHASE, I'll see to add it. As it is, it's too much
> an hack to document it in proper documents.

Why would you need to deal with EBUILD_PHASE?
Comment 5 Steve L 2007-11-28 10:56:08 UTC
I got this from solar for /etc/portage/bashrc (modded a bit for efficiency since it's run unconditionally):

if [[ $EBUILD_PHASE = setup && " $FEATURES " = *' debug '* ]]; then 
     DEBUG=yes 
     RESTRICT+=' nostrip' 
     export CFLAGS="${CFLAGS/-fomit-frame-pointer/} -g3" 
     export CXXFLAGS="${CXXFLAGS/-fomit-frame-pointer/} -g3" 
     export LDFLAGS="${LDFLAGS} -ggdb" 
fi

Posted here for other users: http://forums.gentoo.org/viewtopic-p-4554194.html#4554194

This works, but apparently we should be doing this with pre/post hooks, so it's not a definitive solution.
Comment 6 Zac Medico gentoo-dev 2007-12-14 01:35:37 UTC
In sys-apps/portage-2.1.4_rc10 there is an "Ebuild Phase Hooks" section in chapter 1 of the documentation that is installed at /usr/share/doc/portage-2.1.4_rc10/html/index.html when the "doc" USE flag is enabled. See DOC_SYMLINKS_DIR in `man make.conf` if you want bookmarkable symlinks for installed html docs like these.

Here's how I enable a debug build for glibc now, without any EBUILD_PHASE references:

$ cat /etc/portage/env/sys-libs/glibc
pre_pkg_setup() {
	local x
	for x in installsources splitdebug ; do
		if ! hasq ${x} ${FEATURES} ; then
			elog "bashrc is adding ${x} to FEATURES for ${PN}"
			FEATURES="${FEATURES} ${x}"
		fi
	done

	if ! hasq -ggdb ${CFLAGS} ; then
		elog "bashrc is adding \"-ggdb\" to CFLAGS for ${PN}"
		CFLAGS="${CFLAGS} -ggdb"
	fi
}