Use make(1) to extract variables from a Makefile, not grep.

PR:		212486
Submitted by:	mat
Approved by:	crees (maintainer)
Sponsored by:	Absolight
This commit is contained in:
Mathieu Arnold 2016-09-08 12:49:02 +00:00
parent dfaa946400
commit 9d7a606915
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=421545

View File

@ -276,14 +276,14 @@ foreach my $thisdir (@dirs) {
$pkgcomment = `cat pkg-descr`;
$pkgcomment .= "\n" if ($autofill != -1);
}
chomp($maintaineraddr = `$make $passenv -V MAINTAINER`);
chomp($portversion = `$make $passenv -V PORTVERSION`);
# Read Makefile to find necessary variables.
open(MAKEFILE, "Makefile") or die("Can't open Makefile for reading: $!");
while(<MAKEFILE>) {
chomp;
die ("Old style Makefile headers detected") if (/^# (?:[Nn]ew )?[Pp]orts collection [Mm]akefile/);
($maintainer) = (m/^# Created by:\s+(\w.*)$/) if (/^# Created by/);
($maintaineraddr) = (m/^MAINTAINER=\s+(\w.*)$/) if (/^MAINTAINER=/);
($portversion) = (m/^PORTVERSION=\s+(\w.*)$/) if (/^PORTVERSION=/);
}
close(MAKEFILE);
$maintainer = $maintaineraddr unless ($maintainer);