Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Sep 2011 03:24:06 +0400 (MSD)
From:      Dmitry Marakasov <amdmi3@amdmi3.ru>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        marcus@FreeBSD.org
Subject:   ports/160959: [PATCH] ports-mgmt/portlint: add *FLAGS checks
Message-ID:  <20110923232406.DE87EB825@hades.panopticon>
Resent-Message-ID: <201109232330.p8NNUBSZ008116@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         160959
>Category:       ports
>Synopsis:       [PATCH] ports-mgmt/portlint: add *FLAGS checks
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 23 23:30:10 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Dmitry Marakasov
>Release:        FreeBSD 8.2-RELEASE i386
>Organization:
>Environment:
System: FreeBSD hades.panopticon 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Tue Mar  8 09:48:52 MSK
>Description:
- Mark using LDFLAGS in CONFIGURE_ENV and error, just like using CPPFLAGS is (LDFLAGS support was just committed to ports)
- Suggest to modify values of CPPFLAGS and LDFLAGS with += instead of =, to make them user-customizable just like C/CXXFLAGS
- Additionally check for overriding any of *FLAGS and suggest to append or alter them instead

Port maintainer (marcus@FreeBSD.org) is cc'd.

Generated with FreeBSD Port Tools 0.99
>How-To-Repeat:
>Fix:

--- portlint-2.13.7.patch begins here ---
Index: src/portlint.pl
===================================================================
RCS file: /home/amdmi3/projects/freebsd/FreeBSD.cvs/ports/ports-mgmt/portlint/src/portlint.pl,v
retrieving revision 1.124
diff -u -u -r1.124 portlint.pl
--- src/portlint.pl	21 Aug 2011 23:35:27 -0000	1.124
+++ src/portlint.pl	23 Sep 2011 23:17:33 -0000
@@ -2104,7 +2104,7 @@
 				(defined($cxxflags) && $cxxflags =~ /-I/)) {
 				&perror("WARN", $file, -1, "Consider passing include paths ".
 					"to configure via the CPPFLAGS macro ".
-					"(i.e. CPPFLAGS=-I...)");
+					"(i.e. CPPFLAGS+=-I...)");
 			}
 		}
 
@@ -2133,7 +2133,26 @@
 			&perror("FATAL", $file, -1, "$1 is already ".
 				"passed in CONFIGURE_ENV via bsd.port.mk.  If you need to ".
 				"override the default value, alter $1 in the Makefile ".
-				"instead with $1=...");
+				"instead with $1+=...");
+		}
+
+		if ($configure_env =~ /(LDFLAGS)=/) {
+			&perror("FATAL", $file, -1, "$1 is already ".
+				"passed in CONFIGURE_ENV via bsd.port.mk.  If you need to ".
+				"override the default value, alter $1 in the Makefile ".
+				"instead with $1+=...");
+		}
+	}
+
+	#
+	# whole file: *FLAGS
+	#
+	foreach my $f (qw(CFLAGS CXXFLAGS CPPFLAGS LDFLAGS)) {
+		if ($whole =~ /^$f=/m) {
+			&perror("WARN", $file, -1, "$f is overriden in the Makefile ".
+				"clobbering a value possibly set by a user.  Consider ".
+				"using $f+=... if you want to add or $f:=\${$f:C/...//} ".
+				"if you want to remove specific flags");
 		}
 	}
 
--- portlint-2.13.7.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110923232406.DE87EB825>