Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Oct 2008 17:57:13 +0300 (MSK)
From:      Dmitry Marakasov <amdmi3@amdmi3.ru>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        marcus@FreeBSD.org
Subject:   ports/128482: [PATCH] ports-mgmt/portlint: add some CONFIGURE_ENV/CFLAGS checks
Message-ID:  <20081030145713.1E68217032@hades.panopticon>
Resent-Message-ID: <200810301500.m9UF02V5071859@freefall.freebsd.org>

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

>Number:         128482
>Category:       ports
>Synopsis:       [PATCH] ports-mgmt/portlint: add some CONFIGURE_ENV/CFLAGS 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:   Thu Oct 30 15:00:02 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Dmitry Marakasov
>Release:        FreeBSD 7.0-RELEASE-p1 i386
>Organization:
>Environment:
System: FreeBSD hades.panopticon 7.0-RELEASE-p1 FreeBSD 7.0-RELEASE-p1 #1: Wed Jun 25 15:36:22 MSD 2008
>Description:
Add checks to portlint to mainly catch the following thing:

CONFIGURE_ENV=  CFLAGS=-I${LOCALBASE}/include

as here CFLAGS would be clobbered.

Also warn about using CFLAGS in CONFIGURE_ENV in general (as they're already added to environment in bsd.port.mk) and suggest to pass include patchs via CPPFLAGS in case of GNU configure.

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

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

--- portlint-2.10.1_2.patch begins here ---
Index: Makefile
===================================================================
RCS file: /home/amdmi3/projects/freebsd/FreeBSD.cvs/ports/ports-mgmt/portlint/Makefile,v
retrieving revision 1.127
diff -u -u -r1.127 Makefile
--- Makefile	22 Oct 2008 22:04:37 -0000	1.127
+++ Makefile	30 Oct 2008 14:44:41 -0000
@@ -9,7 +9,7 @@
 
 PORTNAME=	portlint
 PORTVERSION=	2.10.1
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	ports-mgmt
 MASTER_SITES=	# none
 DISTFILES=	# none
Index: src/portlint.pl
===================================================================
RCS file: /home/amdmi3/projects/freebsd/FreeBSD.cvs/ports/ports-mgmt/portlint/src/portlint.pl,v
retrieving revision 1.104
diff -u -u -r1.104 portlint.pl
--- src/portlint.pl	22 Oct 2008 22:04:38 -0000	1.104
+++ src/portlint.pl	30 Oct 2008 14:53:21 -0000
@@ -187,7 +187,7 @@
 	INDEXFILE PKGORIGIN CONFLICTS PKG_VERSION PKGINSTALLVER
 	PLIST_FILES OPTIONS INSTALLS_OMF USE_GETTEXT USE_RC_SUBR
 	DIST_SUBDIR ALLFILES IGNOREFILES CHECKSUM_ALGORITHMS INSTALLS_ICONS
-	GNU_CONFIGURE CONFIGURE_ARGS
+	GNU_CONFIGURE CONFIGURE_ARGS CONFIGURE_ENV
 );
 
 my $cmd = join(' -V ', "make $makeenv MASTER_SITE_BACKUP=''", @varlist);
@@ -1893,6 +1893,46 @@
 	}
 
 	#
+	# whole file: check correct passing/changing of CFLAGS/CXXFLAGS
+	#
+	if ($makevar{CONFIGURE_ENV} =~ /C(XX)?FLAGS/) {
+		my $cflags;
+		my $cxxflags;
+		if ($makevar{CONFIGURE_ENV} =~ /CFLAGS="([^"]+)"/ ||
+			$makevar{CONFIGURE_ENV} =~ /CFLAGS='([^']+)'/ ||
+			$makevar{CONFIGURE_ENV} =~ /CFLAGS=(\S+)/) {
+			$cflags = $1;
+		}
+		if ($makevar{CONFIGURE_ENV} =~ /CXXFLAGS="([^"]+)"/ ||
+			$makevar{CONFIGURE_ENV} =~ /CXXFLAGS='([^']+)'/ ||
+			$makevar{CONFIGURE_ENV} =~ /CXXFLAGS=(\S+)/) {
+			$cxxflags = $1;
+		}
+
+		&perror("WARN", $file, -1, "CFLAGS/CXXFLAGS are not needed in ".
+			"CONFIGURE_ENV as they are already added there in bsd.port.mk.");
+
+		if ($makevar{GNU_CONFIGURE} ne '') {
+			if ((defined $cflags && $cflags =~ /-I/) ||
+				(defined $cxxflags && $cxxflags =~ /-I/)) {
+				&perror("WARN", $file, -1, "Consider passing include paths to configure ".
+					"via CPPFLAGS environment variable (i.e. CPPFLAGS=\"-I...\" in ".
+					"CONFIGURE_ENV)");
+			}
+		}
+
+		if (defined $cflags && $cflags !~ /\$\{CFLAGS/) {
+			&perror("FATAL", $file, -1, "CFLAGS are clobbered in CONFIGURE_ENV. ".
+				"Alter CFLAGS in the Makefile with CFLAGS+= instead");
+		}
+
+		if (defined $cxxflags && $cxxflags !~ /\$\{CXXFLAGS/) {
+			&perror("FATAL", $file, -1, "CXXFLAGS are clobbered in CONFIGURE_ENV. ".
+				"Alter CXXFLAGS in the Makefile with CXXFLAGS+= instead");
+		}
+	}
+
+	#
 	# slave port check
 	#
 	my $masterdir = $makevar{MASTERDIR};
--- portlint-2.10.1_2.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?20081030145713.1E68217032>