Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
UnhardEmerge - script for easy temp switching to vanilla gcc
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
thomasa88
Tux's lil' helper
Tux's lil' helper


Joined: 13 Apr 2005
Posts: 143
Location: Sweden

PostPosted: Sun Feb 05, 2006 1:30 pm    Post subject: UnhardEmerge - script for easy temp switching to vanilla gcc Reply with quote

This script is intended to use when you have gcc hardened but you need to emerge unhardened.
I have tried it with:
ACCEPT_KEYWORDS="~x86"
USE="hardened pic erandom ...."
FEATURES="ccache distcc"
not using hardened profile (masks kernel 2.6 :()

Suggestions and improvements are welcomed! :)
Code:

#!/usr/bin/perl

########################################################
# UnhardEmerge 0.1
# Thomas Axelsson 2006
########################################################

if(!@ARGV || $ARGV[0] eq '--help')
{
   print "Usage: unhardemerge <emerge options>\n";
   print "WARNING! Do not compile something else at the same time as this script switches compiler!\n";
   print "If this script is aborted before finish use gcc-config to switch back profile.\n";
   exit;
}

$currentp=`gcc-config -c`;
$currentp=~/(^.+?)-(\d+\.\d+\.\d+)/;
$pver="$1-$2";
$dir="$1/$2";
$vspecs="/usr/lib/gcc/$dir/vanilla.specs";

if(!-e "/etc/env.d/gcc/$pver")
{
   print "$pver does not exist!\n";
   exit;
}
if(!-e $vspecs)
{
   print "$vspecs does not exist!\n";
   exit;
}
print "Setting profile: $pver-vanilla\n";
`gcc-config $pver-vanilla`;

print "Emerging...\n";
system("GCC_SPECS=\"$vspecs\" FEATURES=\"-distcc\" ".
   "emerge " . join(' ', @ARGV));

print "Setting profile: $currentp\n";
`gcc-config $currentp`;

print "Done.\n";

_________________
- thomasa88
Back to top
View user's profile Send private message
gigs94
n00b
n00b


Joined: 06 Aug 2004
Posts: 52
Location: DC

PostPosted: Fri Feb 10, 2006 10:47 am    Post subject: Reply with quote

This looks like a nice script... but I was thinking that maybe there should be something that supports this inside of portage so that when you:
Code:
emerge --sync
emerge world

it wouldn't trash your vanilla builds.

Any portage developers out there thought of this?
Back to top
View user's profile Send private message
thomasa88
Tux's lil' helper
Tux's lil' helper


Joined: 13 Apr 2005
Posts: 143
Location: Sweden

PostPosted: Fri Feb 10, 2006 4:37 pm    Post subject: Reply with quote

gigs94 wrote:
This looks like a nice script... but I was thinking that maybe there should be something that supports this inside of portage so that when you:
Code:
emerge --sync
emerge world

it wouldn't trash your vanilla builds.

Any portage developers out there thought of this?


yea that would be nice :)

some sort of use-flag or package.ggcopts maybe..

I dont know right now but if you can switch gcc in the active session only my script would work more nice and I could try to implement it into portage (havent done any python before thou :P)
_________________
- thomasa88
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks 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