aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Sadie Powell2025-07-26 11:29:39 +0100
committerGravatar Sadie Powell2025-07-26 11:29:39 +0100
commit9919bbcd0c30f5d59cf00749f741cfd28dd36df7 (patch)
treea1ab41c4329a1670af77f0237b47a9797ceca7e2
parentDon't show an invalid user/group when building portably. (diff)
Make some regex matches more explicit in parse_templates.
-rw-r--r--make/configure.pm25
1 files changed, 13 insertions, 12 deletions
diff --git a/make/configure.pm b/make/configure.pm
index 6e5f2ffbe..0904752fd 100644
--- a/make/configure.pm
+++ b/make/configure.pm
@@ -289,22 +289,23 @@ sub parse_templates($$$) {
}
}
- # Does this line match a directive?
+ # Does this line match a command?
if ($line =~ /^(\s*)%(\w+)\s+(.+)$/) {
- if ($2 eq 'define') {
- if ($settings{$3}) {
- push @lines, "#$1define $3";
+ my ($indent, $name, $value) = ($1, $2, $3);
+ if ($name eq 'define') {
+ if ($settings{$value}) {
+ push @lines, "#${indent}define $value";
} else {
- push @lines, "#$1undef $3";
+ push @lines, "#${indent}undef $value";
}
- } elsif ($2 eq 'mode') {
- $mode = oct $3;
- } elsif ($2 eq 'platform') {
- push @platforms, $3;
- } elsif ($2 eq 'target') {
- push @targets, catfile CONFIGURE_ROOT, $3;
+ } elsif ($name eq 'mode') {
+ $mode = oct $value;
+ } elsif ($name eq 'platform') {
+ push @platforms, $value;
+ } elsif ($name eq 'target') {
+ push @targets, catfile CONFIGURE_ROOT, $value;
} else {
- print_warning "unknown template command '$2' in $template!";
+ print_warning "unknown template command '$name' in $template!";
push @lines, $line;
}
next;