* [gentoo-dev] Automatically replace -mtune= with -mcpu= if not supported by gcc?!
@ 2005-04-17 13:50 Philipp Hasse
2005-04-17 22:05 ` Mike Frysinger
2005-04-19 19:42 ` Paul de Vrieze
0 siblings, 2 replies; 4+ messages in thread
From: Philipp Hasse @ 2005-04-17 13:50 UTC (permalink / raw
To: gentoo-user, gentoo-dev
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-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gentoo-dev] Automatically replace -mtune= with -mcpu= if not supported by gcc?!
2005-04-17 13:50 [gentoo-dev] Automatically replace -mtune= with -mcpu= if not supported by gcc?! Philipp Hasse
@ 2005-04-17 22:05 ` Mike Frysinger
2005-04-17 22:24 ` Alec Warner
2005-04-19 19:42 ` Paul de Vrieze
1 sibling, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2005-04-17 22:05 UTC (permalink / raw
To: gentoo-dev
On Sunday 17 April 2005 09:50 am, Philipp Hasse wrote:
> This way it can be used to set the -mcpu and -mtune flags correctly.
not worth the added crap imho
-mike
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gentoo-dev] Automatically replace -mtune= with -mcpu= if not supported by gcc?!
2005-04-17 22:05 ` Mike Frysinger
@ 2005-04-17 22:24 ` Alec Warner
0 siblings, 0 replies; 4+ messages in thread
From: Alec Warner @ 2005-04-17 22:24 UTC (permalink / raw
To: gentoo-dev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Mike Frysinger wrote:
> On Sunday 17 April 2005 09:50 am, Philipp Hasse wrote:
>
>>This way it can be used to set the -mcpu and -mtune flags correctly.
>
>
> not worth the added crap imho
> -mike
Better to have it fail and have the users fix their build-env themselves.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iQIVAwUBQmLiA2zglR5RwbyYAQKtxhAAj75Fcnr/eEtdaJs6bg9IGpR6bVwQG0EU
n698FfVxeZrTyCuEoKgZZ3QpayAQB3QwjH+NuYn0DrgNaFFc0RRUBn21eNMe5P/q
ygm7u97N1ROk9142vj/HCj12AkqEMIE1eEIOAe2OEKtWCR0OlBmLF3lJLtb/TZ1M
XrdzU+hTf01NE0hjksBkm5V6cEvcxEHOmAXbijSzv2iabedidbFW1oNGqyniHbVb
NNpgfqY67JiielA8UkDSDHg/FNXxL47R76b0KK/CUc+wY/t7KdR7B7g/z1iLpM/N
vOrPbRtLw21xF0gKPsIIKKybE8f5N+gnCVjVIwoWvse6kCbpzWHff1E5HLzVDtyc
HeERmqH36PcCF3IcthBi4rSV2dIl4K5IFNTOpX1y64Nv7McAkX73Hx5TU7+1YlPf
LNF7+ZVK/32zf9VUFGmpWEu4ofULb1wmh4xy+dOIKnoDVUO3yKFitZ+3zArTapSB
d6IaiEglhkYPHx9GBdtgwxADqBsgn1ASidWDaYmiuKGVsthKJY671gVZdIyphwSK
lf7uG1rgatDyfigg2U5YExN5TRupz1fj/NwVX8htvYGpFuZwCo+eQx9+N1gEiCrj
2FNr6IlEosqEiS5Ki7HGcb7VvH4Bbn+PRK2u1gd9r0DpGY+zfJxtTru+fYzG9+nR
rn+6NNPEpWQ=
=Z9eL
-----END PGP SIGNATURE-----
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gentoo-dev] Automatically replace -mtune= with -mcpu= if not supported by gcc?!
2005-04-17 13:50 [gentoo-dev] Automatically replace -mtune= with -mcpu= if not supported by gcc?! Philipp Hasse
2005-04-17 22:05 ` Mike Frysinger
@ 2005-04-19 19:42 ` Paul de Vrieze
1 sibling, 0 replies; 4+ messages in thread
From: Paul de Vrieze @ 2005-04-19 19:42 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 1611 bytes --]
On Sunday 17 April 2005 15:50, Philipp Hasse wrote:
> 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=?!
It actually does (or did) the -mcpu to -mtune for newer gcc versions. This
creates all kinds of havoc if you want to compile a 3.3 gcc by a 3.4 gcc
(this works when not specifying -mcpu). It is so agressive that if you do try
to reverse this in your bashrc, it gets reversed again to -mtune. As it's
only necessary for compiling \<gcc-3.3 I just let it strip out -mtune
completely.
Paul
--
Paul de Vrieze
Gentoo Developer
Mail: pauldv@gentoo.org
Homepage: http://www.devrieze.net
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-04-19 19:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-17 13:50 [gentoo-dev] Automatically replace -mtune= with -mcpu= if not supported by gcc?! Philipp Hasse
2005-04-17 22:05 ` Mike Frysinger
2005-04-17 22:24 ` Alec Warner
2005-04-19 19:42 ` Paul de Vrieze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox