File colormake-gpp.patch of Package colormake

From 454817a9ba46c9cc0922dc9bf40b581dccffafdc Mon Sep 17 00:00:00 2001
From: "John S. Peterson" <john.s.peterson@live.com>
Date: Wed, 17 Jul 2013 02:51:29 +0200
Subject: [PATCH] Removing termination of "gcc" section for a `mv` that's run
 by `g++`

because

* the `g++` output should be colored
---
 colormake.pl | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/colormake.pl b/colormake.pl
index 72b20f2..a1970c8 100755
--- a/colormake.pl
+++ b/colormake.pl
@@ -69,6 +69,7 @@
 
 $in = 'unknown';
 $| = 1;
+$skip = 0;
 while (<>)
 {
 	$orgline = $thisline = $_;
@@ -76,6 +77,13 @@
 	# Remove multiple spaces
 	$thisline =~ s/  \+/ /g;
 
+	# skip lines
+	$skip--;
+	if ($skip < 0)
+	{
+		$skip = 0;
+	}
+
 	# Truncate lines.
 	# I suppose this is bad, but it's better than what less does!
 	if ($cols >= 0)
@@ -91,16 +99,23 @@
 	elsif ($thisline =~ s/^(\s*(libtool:\s*)?((compile|link):\s*)?(([[:ascii:]]+-)?g?(cc|\+\+)|(g|c)\+\+|clang).*)$/$col_gcc$1$col_norm/)
 	{
 		$in = 'gcc';
+
+		if ($thisline =~ /\W-MF\W/)
+		{
+			$skip = 2;
+		}
 	}
 	elsif ($thisline =~ s/^\#/$col_comment#$1/x)
 	{
 		$in = 'comment';
 	}
-	elsif ($thisline =~ /^(\s*\(|\[|a(r|wk)|c(p|d|h(mod|own))|do(ne)?|e(cho|lse)|f(ind|or)|i(f|nstall)|mv|perl|r(anlib|m(dir)?)|s(e(d|t)|trip)|tar)\s+/)
+	elsif (!$skip && $thisline =~ /^(\s*\(|\[|a(r|wk)|c(p|d|h(mod|own))|do(ne)?|e(cho|lse)|f(ind|or)|i(f|nstall)|mv|perl|r(anlib|m(dir)?)|s(e(d|t)|trip)|tar)\s+/)
 	{
 		$in = $1;
 	}
-	elsif ($in eq 'gcc')
+	elsif ($in eq 'gcc'
+		&& $thisline !~ /^mv\W/
+		)
 	{
 		# Do interesting things if make is compiling something.
 
-- 
1.9.3

openSUSE Build Service is sponsored by