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

Bug 51061

Summary: DOC: Assign of specific CFLAGS per ebuild
Product: Portage Development Reporter: Florian Evers <florian-evers>
Component: DocumentationAssignee: Portage team <dev-portage>
Status: RESOLVED DUPLICATE    
Severity: enhancement CC: alan.schmitt, deathwing00, ed, kanelxake, langthang, robmoss, schmitt, swegener
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://forums.gentoo.org/viewtopic.php?t=173377
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 51095    
Bug Blocks:    

Description Florian Evers 2004-05-14 08:53:22 UTC
Details at:
http://forums.gentoo.org/viewtopic.php?t=173377
I wanted to assign a specific set of CFLAGS to a package.
Sometimes, a package must not be compiled with some aggressive
CFLAGS. You have to

CFLAGS="new flags" emerge package

but the next update will break again.
It would be great to add this possibility via
/etc/portage/package.cflags.
A similar mechanism is available to assign
specific USE flags to packages
-> /etc/portage/package.use (?)

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Ciaran McCreesh 2004-05-14 09:01:33 UTC
What about CXXFLAGS? What about MAKEOPTS? What about LINGUAS?
Comment 2 Ioannis Aslanidis (RETIRED) gentoo-dev 2004-05-14 09:03:34 UTC
I'd like to support and, if necessary, implement the request.
Comment 3 Sven Wegener gentoo-dev 2004-05-14 10:01:57 UTC
good feature, but i don't think that many people really need this. if you
really need this you can do it de following way:

from man 5 portage:

/etc/portage/                                                                                bashrc
    If needed this file can be  used  to  setup  a  different
    environment  for ebuilds than the root environment.  Syn-
    tax is the same as any other bash script.

if you put something like this in /etc/portage/                                               bashrc

for MY_ENV in ${PN} ${P} ${PF}; do
   if [ -f /etc/portage/env.d/${CATEGORY}/${MY_ENV} ]; then
      . /etc/portage/env.d/${CATEGORY}/${MY_ENV}
   fi
done

you'll be able to set variables via /etc/portage/env.d that influences
the ebuild. files will be sourced in this order, taken openoffice as a example:

1. /etc/portage/env.d/app-office/openoffice
2. /etc/portage/env.d/app-office/openoffice-1.1.0
3. /etc/portage/env.d/app-office/openoffice-1.1.0-r2

you can put for example

LANGUAGE=<language code e.g. GER>

in /etc/portage/env.d/app-office/openoffice and openoffice will alway be built
in that language. that's what i'm already doing for several months. :)

some variable won't work, e.g. LINGUAS because it is expanded to use flags
before /etc/portage/bashrc will be sourced.

sven
Comment 4 Ed Catmur 2004-05-14 15:17:53 UTC
However /etc/profile.env overrides some settings including (in my case) LANGUAGE.

See the linked bug 51095 for the obvious solution.
Comment 5 Nicholas Jones (RETIRED) gentoo-dev 2004-05-19 16:02:02 UTC
We should probably have a tips and tricks section for environment vars.
Comment #3 should go in it.
Comment 6 SpanKY gentoo-dev 2004-05-19 23:28:03 UTC
i dont think users should have to learn bash and/or jump through hoops to accomplish this (which comment #3 requires ... not a bad idea, i just dont think it's for everyone)
Comment 7 Sven Wegener gentoo-dev 2004-05-20 04:04:18 UTC
Nicholas, could you modify portage so that /etc/portage/bashrc is sourced
before environment variables e.g. LINGUAS are be expanded to USE flags?

Also I'm thinking about a feature like I proposed in bug 51370 comment 7.
This would clean out /etc/env.d which is sometimes used for the wrong
purpose in my opinion.
Comment 8 Brian Harring (RETIRED) gentoo-dev 2004-09-13 00:39:19 UTC
*** Bug 63861 has been marked as a duplicate of this bug. ***
Comment 9 Brian Harring (RETIRED) gentoo-dev 2004-09-13 00:39:53 UTC
Solar's bashrc accomplishes this nicely...
http://dev.gentoo.org/~solar/portage_misc/bashrc
Comment 10 Pedro Algarvio 2005-05-07 00:02:29 UTC
Why isn't solar's bashrc feature for package.cflags buit-in portage?
It's been a year since this was proposed in this bug ticket...
Comment 11 Jason Stubbs (RETIRED) gentoo-dev 2005-07-28 07:24:41 UTC
Putting a hold on feature requests for portage as they are drowning out the 
bugs. Most of these features should be available in the next major version of 
portage. But for the time being, they are just drowning out the major bugs and 
delaying the next version's progress. 
 
Any bugs that contain patches and any bugs for etc-update or dispatch-conf can 
be reopened. Sorry, I'm just not good enough with bugzilla. ;) 
Comment 12 Jakub Moc (RETIRED) gentoo-dev 2005-12-01 01:34:57 UTC
*** Bug 114112 has been marked as a duplicate of this bug. ***
Comment 13 Jason Stubbs (RETIRED) gentoo-dev 2005-12-01 04:29:34 UTC
Duping. 
Comment 14 Jason Stubbs (RETIRED) gentoo-dev 2005-12-01 04:29:52 UTC

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