Sophie

Sophie

distrib > Mageia > 5 > i586 > by-pkgid > 82bbe2f6a96ddca05c0f6c96b0a9d5ce > files > 4

gcc3.3-3.3.6-11.mga5.src.rpm

--- colorgcc-1.3.2/colorgcc.mdkconf	2003-02-16 23:29:58.000000000 +0100
+++ colorgcc-1.3.2/colorgcc	2003-02-17 12:18:06.000000000 +0100
@@ -93,10 +93,13 @@ use IPC::Open3;
 
 sub initDefaults
 {
-   $compilerPaths{"gcc"} = "/usr/local/bin/gcc";
-   $compilerPaths{"g++"} = "/usr/local/bin/g++";
-   $compilerPaths{"cc"}  = "/usr/bin/cc";
-   $compilerPaths{"c++"} = "/usr/local/bin/c++";
+   $compilerPaths{"gcc"} = "/usr/bin/gcc-GCC_VERSION";
+   $compilerPaths{"g++"} = "/usr/bin/g++-GCC_VERSION";
+   $compilerPaths{"cc"}  = "/usr/bin/gcc-GCC_VERSION";
+   $compilerPaths{"c++"} = "/usr/bin/g++-GCC_VERSION";
+   $compilerPaths{"g77"} = "/usr/bin/g77-GCC_VERSION";
+   $compilerPaths{"f77"} = "/usr/bin/g77-GCC_VERSION";
+   $compilerPaths{"gcj"} = "/usr/bin/gcj-GCC_VERSION";
 
    $nocolor{"dumb"} = "true";
 
@@ -120,6 +122,9 @@ sub loadPreferences
 
    open(PREFS, "<$filename") || return;
 
+   my $gccVersion;
+   my $overrideCompilerPaths = 0;
+
    while(<PREFS>)
    {
       next if (m/^\#.*/);          # It's a comment.
@@ -128,10 +133,15 @@ sub loadPreferences
       $option = $1;
       $value = $2;
 
-      if ($option =~ m/cc|c\+\+|gcc|g\+\+/)
+      if ($option =~ m/\A(cc|c\+\+|gcc|g\+\+|g77|f77|gcj)\Z/)
       {
-	 $compilerPaths{$option} = $value;
+		  $compilerPaths{$option} = $value;
+		  $overrideCompilerPaths  = 1;
       }
+	  elsif ($option eq "gccVersion")
+	  {
+		  $gccVersion = $value;
+	  }
       elsif ($option eq "nocolor")
       {
 	 # The nocolor option lists terminal types, separated by
@@ -147,6 +157,11 @@ sub loadPreferences
       }
    }
    close(PREFS);
+
+   # Append "-<gccVersion>" to user-defined compilerPaths
+   if ($overrideCompilerPaths && $gccVersion) {
+	   $compilerPaths{$_} .= "-$gccVersion" foreach (keys %compilerPaths);
+   }
 }
 
 sub srcscan
@@ -181,10 +196,13 @@ initDefaults();
 
 # Read the configuration file, if there is one.
 $configFile = $ENV{"HOME"} . "/.colorgccrc";
+$default_configFile = "/etc/colorgccrc";
 if (-f $configFile)
 {
    loadPreferences($configFile);
-}
+} elsif (-f $default_configFile ) {
+	loadPreferences($default_configFile)
+	}
 
 # Figure out which compiler to invoke based on our program name.
 $0 =~ m%.*/(.*)$%;
@@ -192,6 +210,10 @@ $progName = $1 || $0;
 
 $compiler = $compilerPaths{$progName} || $compilerPaths{"gcc"};
 
+# Check that we don't reference self
+die "$compiler is self-referencing"
+	if ( -l $compiler and (stat $compiler)[1] == (stat $0)[1] );
+
 # Get the terminal type. 
 $terminal = $ENV{"TERM"} || "dumb";
 
--- colorgcc-1.3.2/colorgccrc.mdkconf	2003-02-16 23:29:58.000000000 +0100
+++ colorgcc-1.3.2/colorgccrc	2003-02-17 12:05:57.000000000 +0100
@@ -20,16 +20,23 @@
 # For example, srcColor: bold cyan on_yellow
 #
 
+# gccVersion: if defined, append "-<gccVersion>" to the compiler paths
+# defined hereunder. Otherwise, those paths remains as is set
+# gccVersion: GCC_VERSION
+
 # Define the paths to the actual location of the various compilers.
-# (Currently, colorgcc only understands these: g++ gcc c++ cc)
-g++: /usr/local/bin/g++
-gcc: /usr/local/bin/gcc
-c++: /usr/local/bin/c++
-cc:  /usr/bin/cc
+# (Currently, colorgcc only understands these: g++ gcc c++ cc g77 f77 gcj)
+# g++: /usr/bin/g++
+# gcc: /usr/bin/gcc
+# c++: /usr/bin/g++
+# cc:  /usr/bin/gcc
+# g77: /usr/bin/g77
+# f77: /usr/bin/g77
+# gcj: /usr/bin/gcj
 
 # Don't do color if our terminal type ($TERM) is one of these.
 # (List all terminal types on one line, seperated by whitespace.)
-nocolor: dumb
+nocolor: dumb emacs
 
 # Text between ` and ' is usually source code.
 srcColor: bold cyan