From 339659a4e0557e1c06d22f6acba6ec1abd57bab6 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sun, 27 Jul 2008 17:11:36 +0200 Subject: [PATCH] Build: Let genconf expand variables recursively. This is useful for example when filling in installation paths in configuration files. --- build/genconf | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build/genconf b/build/genconf index eaf2d1c7..30e8896c 100755 --- a/build/genconf +++ b/build/genconf @@ -66,10 +66,13 @@ while () { die "Piped command '$cmd' failed" if $?; print OUT `$1`; } else { - sub repl ($) { + sub repl($); + sub repl($) { my $v = shift @_; exists $vars{$v} or die "Cannot substitute $v: variable not set"; - return $vars{$v}; + my $x = $vars{$v}; + while ($x =~ s/\$\((\w+)\)/repl($1)/ge) { } + return $x; } s/@(\w+)@/repl($1)/ge; print OUT; -- 2.39.2