Bug 128482 - [PATCH] ports-mgmt/portlint: add some CONFIGURE_ENV/CFLAGS checks
Summary: [PATCH] ports-mgmt/portlint: add some CONFIGURE_ENV/CFLAGS checks
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Joe Marcus Clarke
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-30 15:00 UTC by Dmitry Marakasov
Modified: 2009-01-18 19:00 UTC (History)
1 user (show)

See Also:


Attachments
portlint-2.10.1_2.patch (2.61 KB, patch)
2008-10-30 15:00 UTC, Dmitry Marakasov
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Marakasov 2008-10-30 15:00:02 UTC
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
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2008-10-30 15:00:23 UTC
Responsible Changed
From-To: freebsd-ports-bugs->marcus

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Dmitry Marakasov 2008-10-30 15:32:06 UTC
A bit uglier patch, but now without false positives on e.g.
PATHREAD_CFLAGS.

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 -r1.104 portlint.pl
--- src/portlint.pl	22 Oct 2008 22:04:38 -0000	1.104
+++ src/portlint.pl	30 Oct 2008 15:29:53 -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,47 @@
 	}
 
 	#
+	# whole file: check correct passing/changing of CFLAGS/CXXFLAGS
+	#
+	my $configure_env_safe = " $makevar{CONFIGURE_ENV}";
+	if ($configure_env_safe =~ /\WC(XX)?FLAGS/) {
+		my $cflags;
+		my $cxxflags;
+		if ($configure_env_safe =~ /\WCFLAGS="([^"]+)"/ ||
+			$configure_env_safe =~ /\WCFLAGS='([^']+)'/ ||
+			$configure_env_safe =~ /\WCFLAGS=(\S+)/) {
+			$cflags = $1;
+		}
+		if ($configure_env_safe =~ /\WCXXFLAGS="([^"]+)"/ ||
+			$configure_env_safe =~ /\WCXXFLAGS='([^']+)'/ ||
+			$configure_env_safe =~ /\WCXXFLAGS=(\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.patch ends here ---

-- 
Dmitry Marakasov   .   55B5 0596 FF1E 8D84 5F56  9510 D35A 80DD F9D2 F77D
amdmi3@amdmi3.ru  ..:  jabber: amdmi3@jabber.ru    http://www.amdmi3.ru
Comment 3 Joe Marcus Clarke freebsd_committer freebsd_triage 2009-01-18 18:50:03 UTC
State Changed
From-To: open->closed

Committed, thanks!
Comment 4 dfilter service freebsd_committer freebsd_triage 2009-01-18 18:50:07 UTC
marcus      2009-01-18 18:49:58 UTC

  FreeBSD ports repository

  Modified files:
    ports-mgmt/portlint  Makefile 
    ports-mgmt/portlint/src portlint.pl 
  Log:
  Update to 2.10.2.
  
  * Loosen the error around USE_ANT and do-build [1]
  * Add a check for CFLAGS and CXXFLAGS in CONFIGURE_ENV [2]
  * Add a check for Fortran flags in CONFIGURE_ENV [3]
  
  PR:             128482 [2]
  Requested by:   Dominic Fandrey <kamikaze@bsdforen.de> [1]
                  gerlad [3]
  Submitted by:   amdmi3 [2]
  
  Revision  Changes    Path
  1.128     +1 -2      ports/ports-mgmt/portlint/Makefile
  1.105     +60 -7     ports/ports-mgmt/portlint/src/portlint.pl
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"