Hi,

I recently noticed that portage executes the file bashrc located in
/etc/portage before every ebuild.
This way it can be used to set the -mcpu and -mtune flags correctly.
If you add the following to this file everything goes automatically:

<--- SNIP --->
# Automatically replace -mtune= with -mcpu if not supported by gcc
# and vice versa.
echo "" | gcc -mtune=i386 -E - > /dev/null 2> /dev/null
if [ $? == 0 ]; then
export CFLAGS=`echo $CFLAGS | /bin/sed 's/-mcpu=/-mtune=/'`
export CXXFLAGS=`echo $CXXFLAGS | /bin/sed 's/-mcpu=/-mtune=/'`
else
export CFLAGS=`echo $CFLAGS | /bin/sed 's/-mtune=/-mcpu=/'`
export CXXFLAGS=`echo $CXXFLAGS | /bin/sed 's/-mtune=/-mcpu=/'`
fi
<--- SNIP --->

Maybe someone can give me a feedback if this is good idea or if I missed
something for some exotic situation this will fail.

Why doesn't portage do this automatically by itself? If it encounters an
-mtuneÂ= option in make.conf and gcc doesn't support it it replaces it
with -mcpu=?!

Regards
Philipp Hasse

-- 
gentoo-user@gentoo.org mailing list

Reply via email to