Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
/etc/portage/package.c{,xx}flags features - v1.0_rc1
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3  Next  
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
brihall
Tux's lil' helper
Tux's lil' helper


Joined: 29 Apr 2003
Posts: 86
Location: Colorado, USA

PostPosted: Tue Aug 23, 2005 4:42 pm    Post subject: Reply with quote

I am using the most recent /etc/portage/bashrc script here (is there a download location for this?) that allows a package.ldflags file. It doesn't work for me, what am I doing wrong? (see error msg below)

# cat /etc/portage/package.ldflags
#GLOBALLDFLAGS="-Wl,-O1 -Wl,--enable-new-dtags -Wl,--sort-common -Wl,--as-needed -s"
dev-perl/gtk-perl -Wl,-O1

The other /etc/portage/package.* files are empty, created with touch. Is my syntax wrong? I tried various permutations of the GLOBALLDFLAGS variable, it didn't help whether it was there or not, or what format.

=========================================================

# emerge -uD world
Calculating world dependencies ..... ...done!
>>> emerge (1 of 1) dev-perl/gtk-perl-0.7008-r11 to /
Usage: /bin/sed [OPTION]... {script-only-if-no-other-script} [input-file]...

-n, --quiet, --silent
suppress automatic printing of pattern space
-e script, --expression=script
add the script to the commands to be executed
-f script-file, --file=script-file
add the contents of script-file to the commands to be executed
-i[SUFFIX], --in-place[=SUFFIX]
edit files in place (makes backup if extension supplied)
-l N, --line-length=N
specify the desired line-wrap length for the `l' command
--posix
disable all GNU extensions.
-r, --regexp-extended
use extended regular expressions in the script.
-s, --separate
consider files as separate rather than as a single continuous
long stream.
-u, --unbuffered
load minimal amounts of data from the input files and flush
the output buffers more often
--help display this help and exit
--version output version information and exit

If no -e, --expression, -f, or --file option is given, then the first
non-option argument is taken as the sed script to interpret. All
remaining arguments are names of input files; if no input files are
specified, then the standard input is read.

E-mail bug reports to: bonzini@gnu.org .
Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.
/etc/portage/bashrc: line 59: s/GLOBALLDFLAGS/-Wl,-O1 -Wl,--enable-new-dtags -Wl,--sort-common -Wl,--as-needed -s/g: No such file or directory

=======================================================================================

I hit ctrl-c to stop the emerge from attempting to continue at this point.
My LDFLAGS from make.conf are "-Wl,-O1 -Wl,--enable-new-dtags -Wl,--sort-common -Wl,--as-needed"
Back to top
View user's profile Send private message
SoTired
Apprentice
Apprentice


Joined: 19 May 2004
Posts: 174

PostPosted: Tue Aug 23, 2005 7:28 pm    Post subject: Reply with quote

brihall wrote:
I am using the most recent /etc/portage/bashrc script here (is there a download location for this?) that allows a package.ldflags file. It doesn't work for me, what am I doing wrong?


There isn't really a most recent version, just versions that different people have written (I think). Though if it doesn't work you could always use my version (also on the previous page.) Although it doesn't do the things outlined in smoked's post, the code is simpler - at least there're not any sed expressions for it to get choked up on.

Or... because I was bored, you could try this new fits-the-entire-script-within-a-80x24-console version. Though it's probably more likely to have more bugs:

Code:
setfunc() {
   for n in "$@" ; do
      g=`eval echo '$'$n`
      l=`echo $n | /usr/bin/tr [A-Z] [a-z]`
      [ -r ${ROOT}/etc/portage/package.$l ] || continue
      while read -a target ; do
         if [ "${target}" = "${CATEGORY}" -o "${target}" = "${CATEGORY}/${PN}" ] ; then
            unset var
            target[0]=""
            for i in "${target[@]}" ; do
               if [ -n "`echo "$i" | /bin/grep GLOBAL`" ] ; then i="$g" ; fi
               var="$var $i"
            done
            export `echo $n`="`echo $var`"
         fi
      done < ${ROOT}/etc/portage/package.$l
   done
}
if [ -n "`echo "$0" | /bin/grep '\/ebuild[a-z\-]*\.sh'`" ] ; then
   setfunc "CFLAGS" "CXXFLAGS" "LDFLAGS" "FEATURES"
fi


In addition to the things smoked pointed out, this one also ignores what comes after GLOBAL. So GLOBALLDFLAGS in package.cxxflags will just append the cxxflags from make.conf, not the ldflags.

However, it of course fits within a standard 80x24 console. 8)
Back to top
View user's profile Send private message
iro
n00b
n00b


Joined: 23 Dec 2004
Posts: 59
Location: Modena, Italy

PostPosted: Sun Sep 11, 2005 7:59 pm    Post subject: Reply with quote

Quote:
if [ -n "`echo "$0" | /bin/grep '\/ebuild[a-z\-]*\.sh'`" -a "$1" == "compile" ] ; then
setfunc "CFLAGS" "CXXFLAGS" "LDFLAGS" "FEATURES"
fi


without this modification per package *flags are added 3 times if used with global ones.
Back to top
View user's profile Send private message
SoTired
Apprentice
Apprentice


Joined: 19 May 2004
Posts: 174

PostPosted: Sun Sep 11, 2005 10:43 pm    Post subject: Reply with quote

iro wrote:
Quote:
if [ -n "`echo "$0" | /bin/grep '\/ebuild[a-z\-]*\.sh'`" -a "$1" == "compile" ] ; then
setfunc "CFLAGS" "CXXFLAGS" "LDFLAGS" "FEATURES"
fi


without this modification per package *flags are added 3 times if used with global ones.


That's true, but with that modification it won't fit into a standard 80x24 console, which was the entire point of that version. (I don't care if it's a stupid goal.) It could probably be made better in other ways too (like all the things that smoked's version does.) That, and having the flags thrice doesn't change anything. Right. Someday perhaps a good version that fits within an 80x24 console... one can dream.
Back to top
View user's profile Send private message
brihall
Tux's lil' helper
Tux's lil' helper


Joined: 29 Apr 2003
Posts: 86
Location: Colorado, USA

PostPosted: Tue Sep 13, 2005 11:53 pm    Post subject: Reply with quote

Some ebuilds, such as xmms and nmap, seem to end up using the package.ldflags as part of their CFLAGS. I have this in my /etc/portage/package.ldflags:

net-analyzer/nmap "-W1,-O1"

but nmap fails the configure step during emerge:

(looking thru the config.log)
configure:1711: x86_64-pc-linux-gnu-gcc -Os -march=k8 -fomit-frame-pointer -funit-at-a-time -frename-registers -mtune=athlon64 -fno-ident -pipe "-W1,-O1" conft
est.c >&5
x86_64-pc-linux-gnu-gcc: "-W1,-O1": No such file or directory

To emerge nmap, I have to do the following, since I have the "fully optimized" set of LDFLAGS in /etc/make.conf:

LDFLAGS="" emerge nmap
Back to top
View user's profile Send private message
iro
n00b
n00b


Joined: 23 Dec 2004
Posts: 59
Location: Modena, Italy

PostPosted: Wed Sep 14, 2005 12:06 am    Post subject: Reply with quote

brihall wrote:
net-analyzer/nmap "-W1,-O1"


it's not "-W1," , but "-Wl," (the letter L)
Back to top
View user's profile Send private message
alinv
Guru
Guru


Joined: 19 Nov 2002
Posts: 395
Location: Bucharest

PostPosted: Wed Sep 14, 2005 7:35 am    Post subject: Re: package.features doesnt work for me Reply with quote

gnelson wrote:
package.features does not work for me, this is the line I have in package.features:
gnome-base/gnome-vfs GLOBALFEATURES nostrip noclean


I can't get it to work, either
my package.features:
Code:
app-admin/syslog-ng     GLOBALFEATURES buildpkg

The binary package of syslog-ng doesn't get built.

I put an "echo $FEATURES" at the end of package-features() function and this is what I get at the end of the emerge:
Code:
autoaddcvs autoconfig ccache digest distlocks keepobj sfperms unsermake buildpkg buildpkg buildpkg buildpkg buildpkg buildpkg buildpkg buildpkg buildpkg


Thanks,
Alin
_________________
Ever tried. Ever failed. No matter. Try Again. Fail again. Fail better.
S.B.
Back to top
View user's profile Send private message
brihall
Tux's lil' helper
Tux's lil' helper


Joined: 29 Apr 2003
Posts: 86
Location: Colorado, USA

PostPosted: Wed Sep 14, 2005 2:01 pm    Post subject: Reply with quote

iro wrote:
brihall wrote:
net-analyzer/nmap "-W1,-O1"


it's not "-W1," , but "-Wl," (the letter L)


Thanks, fixed. But the package specific LDFLAGS for nmap still fails in the same way.
Back to top
View user's profile Send private message
96140
Retired Dev
Retired Dev


Joined: 23 Jan 2005
Posts: 1324

PostPosted: Thu Nov 03, 2005 11:20 pm    Post subject: Reply with quote

Nice job on the script!

Note that solar's original packge-specific CFLAGs script is found here:
http://article.gmane.org/gmane.linux.gentoo.hardened/1204.
Back to top
View user's profile Send private message
enderandrew
l33t
l33t


Joined: 25 Oct 2005
Posts: 731

PostPosted: Tue Nov 15, 2005 8:13 am    Post subject: Reply with quote

Would some kind soul share with me their package.* files?

I want to use fairly aggressive flags (see below) and then filter for what breaks. Perhaps someone can save me some heartache and share with me packages that already break? You can post them here, or email me at enderandrew (at) gmail (dot) com

Code:
CFLAGS="-O2 -march=athlon64 -pipe"
CFLAGS="${CFLAGS} -fmove-all-movables"
CFLAGS="${CFLAGS} -freduce-all-givs"
CFLAGS="${CFLAGS} -fno-ident"
CFLAGS="${CFLAGS} -ftracer"
CHOST="x86_64-pc-linux-gnu"
CXXFLAGS="${CFLAGS} -ffriend-injection -fno-enforce-eh-specs -fvisibility-inlines-hidden"
LDFLAGS="-Wl,-O1 -Wl,--sort-common, --as-needed"

_________________
Nihilism makes me smile.
Back to top
View user's profile Send private message
Dancelis
n00b
n00b


Joined: 02 Aug 2005
Posts: 1
Location: Czech republic

PostPosted: Sat Feb 11, 2006 1:29 pm    Post subject: Wicked Reply with quote

Hi, I tried both versions of bashrc and features doesn't work:
Code:
root@amd64 /etc/portage [ r11.35G h34.0G p159M s1035M | 1/100 0.63 ]
[14:27] # cat features
sys-apps/man-pages autoconfig distlocks sandbox sfperms strict

and even that it uses FEATURE noman
Code:
>>> Merging sys-apps/man-pages-2.23 to /
 * Removing /usr/share/man
--- /usr/
--- /usr/share/
--- /usr/share/doc/
--- /usr/share/doc/man-pages-2.23/
>>> /usr/share/doc/man-pages-2.23/README.gz
>>> /usr/share/doc/man-pages-2.23/Changes.old.gz
>>> /usr/share/doc/man-pages-2.23/man-pages-2.23.Announce.gz
>>> /usr/share/doc/man-pages-2.23/Changes.gz

LOL, useful man-pages.
_________________
root@amd64 / [ r11.35G h34.0G p158M s1035M | 2/104 0.41 ]
[14:30] # uname -r
2.6.16-rc2
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9507
Location: beyond the rim

PostPosted: Mon Feb 13, 2006 6:38 am    Post subject: Reply with quote

FYI: anything you change via bashrc files will only ever affect the bash side of portage, not the python side. FOr *FLAGS you can ignore that, but for FEATURES it's a important difference, you can only change some features via bashrc, others will simply be ignored there (e.g. buildpkg or collision-protect).
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Mon Feb 13, 2006 1:43 pm    Post subject: Reply with quote

Genone wrote:
FYI: anything you change via bashrc files will only ever affect the bash side of portage, not the python side. FOr *FLAGS you can ignore that, but for FEATURES it's a important difference, you can only change some features via bashrc, others will simply be ignored there (e.g. buildpkg or collision-protect).


Not only is this true for most FEATURES but even for more basic things like CONFIG_PROTECT (Usually, one would like to delete everything when a package is deleted and not leave config-files lying around, especially, if they had never been modified - however, modifying/exporting CONFIG_PROTECT in /etc/portage/bashrc for "prerm" seems to have no effect).

Does anybody know a clean way to convince portage to "reread" FEATURES (or CONFIG_PROTECT)? In particular, is there e.g. another mechanism like /etc/portage/bashrc which could allow to introduce python code on a "per packet basis"? I only know of the other "hooks" /etc/portage/profile/profile.bashrc and /etc/portage/modules. While the former seems to be rather similar to /etc/portage/bashrc (I have not yet studied portage enough to understand the difference - maybe somebody can explain?), the latter perhaps *might* be used to write some hook in python. So maybe somebody with sufficient insight into the portage code knows a good place where and how to hook?
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9507
Location: beyond the rim

PostPosted: Mon Feb 13, 2006 7:43 pm    Post subject: Reply with quote

mv wrote:
Does anybody know a clean way to convince portage to "reread" FEATURES (or CONFIG_PROTECT)? In particular, is there e.g. another mechanism like /etc/portage/bashrc which could allow to introduce python code on a "per packet basis"? I only know of the other "hooks" /etc/portage/profile/profile.bashrc and /etc/portage/modules. While the former seems to be rather similar to /etc/portage/bashrc (I have not yet studied portage enough to understand the difference - maybe somebody can explain?), the latter perhaps *might* be used to write some hook in python. So maybe somebody with sufficient insight into the portage code knows a good place where and how to hook?

Short answer: there is no way to do this without patching portage.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Mon Feb 13, 2006 8:41 pm    Post subject: Reply with quote

Genone wrote:
Short answer: there is no way to do this without patching portage.


Thanks for the answer. I feared so when looking briefly at the portage code. However, I hoped that there might be another trapdoor: After all, I was very impressed to see what can be done with /etc/portage/module: Like e.g. the cdb or the metadata_overlay http://thread.gmane.org/gmane.linux.gentoo.portage.devel/1602 extensions. But maybe you consider these already as patches.
Back to top
View user's profile Send private message
Enverex
Guru
Guru


Joined: 02 Jul 2003
Posts: 501
Location: Worcester, UK

PostPosted: Sat Feb 25, 2006 2:02 pm    Post subject: Reply with quote

Can someone please explain how do set this up properly? I put the bashrc file in /etc/portage and I created an entry in /etc/portage/package.ldflags but it didn't seem to have any effect. i.e. I have something in my LDFlags that I don't want this particular application to use, so I put the entry in ldflags but didn't put any flags after it (which I assumed would be the same as doing LDFLAGS="" at the console before an emerge) but nothing changed. What am I doing wrong?
Back to top
View user's profile Send private message
RobertDavid
Apprentice
Apprentice


Joined: 08 Aug 2005
Posts: 271
Location: Czech Republic

PostPosted: Wed Apr 05, 2006 8:33 pm    Post subject: Reply with quote

does this work also to overide the package build in cflags?? I mean that some packages dont want to emerge on my CFLAGS but use "safer" CFLAGS.
I use -Os and many packaged doesnt want to compile -Os, instead they compile -O2
For example: WINE, glibc, gcc, and many others... I understand that some packages arent supposed to compile Os due to errors, but not that much,,(why wine??)
_________________
Arch & Fluxbox & 2.6.24-rc-zen!!!!
robertek.brevnov.net
Back to top
View user's profile Send private message
SoTired
Apprentice
Apprentice


Joined: 19 May 2004
Posts: 174

PostPosted: Wed Apr 05, 2006 9:10 pm    Post subject: Reply with quote

RobertDavid wrote:
does this work also to overide the package build in cflags?? I mean that some packages dont want to emerge on my CFLAGS but use "safer" CFLAGS.
I use -Os and many packaged doesnt want to compile -Os, instead they compile -O2
For example: WINE, glibc, gcc, and many others... I understand that some packages arent supposed to compile Os due to errors, but not that much,,(why wine??)


No, if the ebuild strips the flags they will still be stripped. For getting around ebuilds overriding cflags you could always use an overlay, though you may want to be extra careful when overriding the sane defaults for things like glibc.
Back to top
View user's profile Send private message
rojanu
Guru
Guru


Joined: 02 Feb 2004
Posts: 361
Location: London

PostPosted: Fri May 19, 2006 12:43 am    Post subject: Reply with quote

OK now I get
Quote:
This bashrc does not know anything about /usr/lib/portage/bin/misc-functions.sh
any ideas!
_________________
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler,
Linux User: #416714
Back to top
View user's profile Send private message
rojanu
Guru
Guru


Joined: 02 Feb 2004
Posts: 361
Location: London

PostPosted: Tue May 23, 2006 10:28 am    Post subject: Reply with quote

Well if no has anything to say about it and I don't know zilc about, I think I have to switch back to normal bashrc
_________________
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler,
Linux User: #416714
Back to top
View user's profile Send private message
Shadow Skill
Veteran
Veteran


Joined: 04 Dec 2004
Posts: 1023

PostPosted: Wed Jun 14, 2006 4:18 am    Post subject: Reply with quote

How does one ovverride global cflags ysung these bashrc's? Just reading the thread it sounds as though these scripts are not capable of doing that. Am I wrong?
_________________
Ware wa mutekinari.
Wa ga kage waza ni kanau mono nashi.
Wa ga ichigeki wa mutekinari.

"First there was nothing, so the lord gave us light. There was still nothing, but at least you could see it."
Back to top
View user's profile Send private message
SoTired
Apprentice
Apprentice


Joined: 19 May 2004
Posts: 174

PostPosted: Wed Jun 14, 2006 5:50 am    Post subject: Reply with quote

Shadow Skill wrote:
How does one ovverride global cflags ysung these bashrc's? Just reading the thread it sounds as though these scripts are not capable of doing that. Am I wrong?


There's probably something that I'm missing, but if you want to override global cflags (by this I assume you mean cflags for every package) why not just change them in make.conf?
Back to top
View user's profile Send private message
Shadow Skill
Veteran
Veteran


Joined: 04 Dec 2004
Posts: 1023

PostPosted: Wed Jun 14, 2006 3:40 pm    Post subject: Reply with quote

I use -fvisibility-inlines-hidden in make.conf [for kde really] and I would like to leave it in there and be able to turn it off for wxGTK which apparently doesn't play nice with said flag. Besides it would be nice to be able to disable flags for specific items as it is :)
_________________
Ware wa mutekinari.
Wa ga kage waza ni kanau mono nashi.
Wa ga ichigeki wa mutekinari.

"First there was nothing, so the lord gave us light. There was still nothing, but at least you could see it."
Back to top
View user's profile Send private message
thebigslide
l33t
l33t


Joined: 23 Dec 2004
Posts: 792
Location: under a car or on top of a keyboard

PostPosted: Wed Jun 14, 2006 9:11 pm    Post subject: Reply with quote

Shadow Skill wrote:
How does one ovverride global cflags ysung these bashrc's? Just reading the thread it sounds as though these scripts are not capable of doing that. Am I wrong?


If you would like to override globalcflags, just don't add GLOBALCFLAGS to the list of cflags for the particular package.
Back to top
View user's profile Send private message
SoTired
Apprentice
Apprentice


Joined: 19 May 2004
Posts: 174

PostPosted: Wed Jun 14, 2006 9:29 pm    Post subject: Reply with quote

Shadow Skill wrote:
I use -fvisibility-inlines-hidden in make.conf [for kde really] and I would like to leave it in there and be able to turn it off for wxGTK which apparently doesn't play nice with said flag. Besides it would be nice to be able to disable flags for specific items as it is :)


Many flags have anti-flags as well. -fno-visibility-inlines-hidden, if it comes after the -fvisibility-inlines-hidden in the GCC command, will disable -fvisibility-inlines-hidden. Though as thebigslide pointed out you can also leave off GLOBALCFLAGS.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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