Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 105199 - Fine grained CFLAGS control.
Summary: Fine grained CFLAGS control.
Status: RESOLVED DUPLICATE of bug 44796
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Enhancement/Feature Requests (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
Depends on:
Reported: 2005-09-07 17:37 UTC by Jose Ildefonso Camargo Tolosa
Modified: 2007-01-12 06:23 UTC (History)
1 user (show)

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


Note You need to log in before you can comment on or make changes to this bug.
Description Jose Ildefonso Camargo Tolosa 2005-09-07 17:37:11 UTC

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).

echo $'
if [ "${CATEGORY}/${PN}" == "dev-util/diffball" ]; then
    export CFLAGS="the-cflags"
    export CXXFLAGS=${CFLAGS}
' >> /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

Example usage of CAT and CAT/PN (atoms are not supported)

Comment out the bashrc.autopatch at the end of the bashrc or snag the
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 ***