Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 105199

Summary: Fine grained CFLAGS control.
Product: Portage Development Reporter: Jose Ildefonso Camargo Tolosa <ildefonso_camargo>
Component: Enhancement/Feature RequestsAssignee: Portage team <dev-portage>
Status: RESOLVED DUPLICATE    
Severity: normal CC: solar
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Jose Ildefonso Camargo Tolosa 2005-09-07 17:37:11 UTC
Hi!

Call me a "control freak", but I would like to be able to specify the CFLAGS on
a "per-package" basis.  Let me explain my reasons:

+ There are some packages that can break if you compile them with a aggressive
optimizations (ie, -O3, I think octave is one of them), and there are others
wich have their own optimizations by default (mplayer, I think), wich varies
from file-to-file in the compilation, so for these would be better to "undef"
CFLAGS and CXXFLAGS completely.
+ There are packages that can be compiled with a more aggressive mode, and
others don't, so I would like to be able to use -O3 for some packages, and -O2
for others, and even -O0 for some, and for others no CFLAGS at all.

I know I can do this by emerging a package, and changing make.conf, and then
emerge the next one, and so on.... or I can set the CFLAGS in the command line,
but it means that I have to change it every time I emerge the package..... that
wouldn't be a problem if I only needed to do it once, but I have to do it every
time the package is updated.....

At the moment we can control the "dependecies" (aka, USE) in a per-packages
basis, but I think that CFLAGS and CXXFLAGS would be nice too.

What do you think?

Ildefonso Camargo
Comment 1 Brian Harring (RETIRED) gentoo-dev 2005-09-07 17:48:51 UTC
I think I don't like it, personally.
Oft requested feature, rewrite will allow for it to be added; won't be added to
stable though (imo).

meanwhile
echo $'
if [ "${CATEGORY}/${PN}" == "dev-util/diffball" ]; then
    export CFLAGS="the-cflags"
    export CXXFLAGS=${CFLAGS}
fi
' >> /etc/portage/bashrc

Will accomplish what you want.
Personally, I'd suggest hunting for solar's bashrc; it's hella cleaner then the
trick I mentioned above, gives you a fair amount more control (using bashrc as
effectively indirection to load up custom bashrc's dependant on the cat/pkg).
Comment 2 solar (RETIRED) gentoo-dev 2005-09-08 06:42:43 UTC
http://dev.gentoo.org/~solar/portage_misc/bashrc

Example usage of CAT and CAT/PN (atoms are not supported)
http://dev.gentoo.org/~solar/portage_misc/package.cflags

Comment out the bashrc.autopatch at the end of the bashrc or snag the 
http://dev.gentoo.org/~solar/portage_misc/bashrc.autopatch
Comment 3 Marius Mauch (RETIRED) gentoo-dev 2007-01-12 06:23:39 UTC
Reopening for duping.
Comment 4 Marius Mauch (RETIRED) gentoo-dev 2007-01-12 06:23:58 UTC

*** This bug has been marked as a duplicate of bug 44796 ***