Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Per-package CFLAGS support in Portage?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Duplicate Threads
View previous topic :: View next topic  
Author Message
Guenther Brunthaler
Apprentice
Apprentice


Joined: 22 Jul 2006
Posts: 214
Location: Vienna

PostPosted: Tue Sep 19, 2006 6:11 am    Post subject: Per-package CFLAGS support in Portage? Reply with quote

Hi all,

I would like to use different optimization settings for specific packages (ebuilds).

For instance, I want most of the packages in my system to be compiled with -O2 and -mtune.

But a few performance-critical packages (like vlc, mesa/opengl, xorg and gcc itself) I would like to compile with -O3 and -march instead.

I know that it is possible to override the CFLAGS/CXXFLAGS manually for each emerge.

What I want is a way of making those overrides more permanent in the same way as /etc/portage/package.keyword overrides USE flags on a per-package basis.

Is there something like /etc/portage/package.env available for this purpose?

And if not - has someone an idea how Portage could be patched in order to achieve this?

It would be nice if it worked in a way similar like this:

  • In /etc/portage/package.env there is a list very similar to /etc/portage/package.keyword: One DEPEND-atom, followed by a settings key.
  • The settings keys are just filenames of files in a /etc/portage/env.d directory. For instance, a settings key max_speed would refer to file /etc/portage/env.d/max_speed.conf.
  • The files in the /etc/portage/env.d/*.conf have exactly the same syntax as /etc/make.conf, i. e. comment lines and key = value pairs.
  • If a settings key is defined for an ebuild in /etc/portage/package.env, the contents of the corresponding /etc/portage/env.d/*.conf file will be used to override the environment variables from /etc/make.conf when emerging that ebuild.


Example: If /etc/portage/package.env contains
Code:

=media-video/vlc-* max_speed
>=sys-devel/gcc-4 max_speed

and /etc/portage/env.d/max_speed.conf contains
Code:

CFLAGS="-march=pentium4 -O3 -DNDEBUG -pipe -fomit-frame-pointer -fno-stack-check"
CXXFLAGS="-march=pentium4 -O3 -DNDEBUG -pipe -fomit-frame-pointer -fno-stack-check"

then all media-video/vlc ebuilds and all sys-devel/gcc ebuilds of version 4 or better would use the above CFLAGS, while all other ebuilds will use the CFLAGS from /etc/make.conf, which might be:
Code:

...
CFLAGS="-mtune=pentium4 -O2 -DNDEBUG -pipe -fno-stack-check"
CXXFLAGS="-mtune=pentium4 -O2 -DNDEBUG -pipe -fno-stack-check"
...


Once available, this scheme could be used to define different optimization levels and assign them to specific ebuilds.

But it could be used to assign debugging-switches or similar to ebuilds as well.
Back to top
View user's profile Send private message
Lloeki
Guru
Guru


Joined: 14 Jun 2006
Posts: 437
Location: France

PostPosted: Tue Sep 19, 2006 6:55 am    Post subject: Reply with quote

Quote:

What I want is a way of making those overrides more permanent in the same way as /etc/portage/package.keyword overrides USE flags on a per-package basis.

it's package.use ;)

and same goes for VIDEO_CARDS and others...

whatever, it's not there (yet?). from what I recall, there's some portage replacement in C/C++ that has this kind of feature. it's still beta, and I can't remember the name.
_________________
Moved to using Arch Linux
Life is meant to be lived, not given up...
HOLY COW I'M TOTALLY GOING SO FAST OH F*** ;)
Back to top
View user's profile Send private message
erikm
l33t
l33t


Joined: 08 Feb 2005
Posts: 631

PostPosted: Tue Sep 19, 2006 7:10 am    Post subject: Reply with quote

This is requested every once in a while, but is so far not in portage.

Oh, and let's use the search function and continue posting in the dupe threads, lest the mods come banish you to 'Duplicate Threads' land... :wink:
Back to top
View user's profile Send private message
Lloeki
Guru
Guru


Joined: 14 Jun 2006
Posts: 437
Location: France

PostPosted: Tue Sep 19, 2006 8:12 am    Post subject: Reply with quote

for the sake of completeness, this replacement is called paludis
_________________
Moved to using Arch Linux
Life is meant to be lived, not given up...
HOLY COW I'M TOTALLY GOING SO FAST OH F*** ;)
Back to top
View user's profile Send private message
mark_alec
Bodhisattva
Bodhisattva


Joined: 11 Sep 2004
Posts: 6066
Location: Melbourne, Australia

PostPosted: Tue Sep 19, 2006 9:00 am    Post subject: Reply with quote

Moved from Portage & Programming to Duplicate Threads. Banished to the land of the dupes :P
_________________
www.gentoo.org.au || #gentoo-au
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Duplicate Threads All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum