@@ -142,9 +142,21 @@ END
}
sub build () {
- my $xend_opt= $r{enable_xend} =~ m/true/ ? "--enable-xend" : "--disable-xend";
- my $ovmf_opt= $r{enable_ovmf} =~ m/true/ ? "--enable-ovmf" : "--disable-ovmf";
- my $qemutrad_opt = $r{arch} =~ m/amd64|i386/ ? "--enable-qemu-traditional" : "--disable-qemu-traditional";
+ my $enable_opts = ''; # shell script to set "enable_opts" shell var
+ my $enable_disable = sub {
+ my ($subdir, $feat, $enable) = @_;
+ my $opt = "--".($enable ? 'enable' : 'disable')."-$feat";
+ $enable_opts .= <<END;
+ if grep -q -- $opt \\
+ ${subdir}configure ; then
+ enable_opts="\$enable_opts $opt"
+ fi
+END
+ };
+
+ $enable_disable->("tools/", "xend", $r{enable_xend} =~ m/true/);
+ $enable_disable->("tools/", "ovmf", $r{enable_ovmf} =~ m/true/);
+ $enable_disable->("tools/", "qemu-traditional", $r{arch} =~ m/amd64|i386/);
my $configure_prefix = $r{cmdprefix_configure} // '';
my $configure_suffix = $r{cmdsuffix_configure} // '';
@@ -152,17 +164,9 @@ sub build () {
buildcmd_stamped_logged(600, 'xen', 'configure', <<END,<<END,<<END);
if test -f configure; then
- if grep -q -- $xend_opt tools/configure ; then
- xend=$xend_opt
- fi
- if grep -q -- $ovmf_opt tools/configure ; then
- ovmf=$ovmf_opt
- fi
- if grep -q -- $qemutrad_opt tools/configure ; then
- qemutrad=$qemutrad_opt
- fi
+$enable_opts
END
- $configure_prefix ./configure --sysconfdir=/etc \$xend \$ovmf \$qemutrad $configure_suffix @configure_args
+ $configure_prefix ./configure --sysconfdir=/etc \$enable_opts $configure_suffix @configure_args
END
fi
END
Replace the repeated pattern with a function to generate that code. No significant functional change. Signed-off-by: Ian Jackson <iwj@xenproject.org> CC: Juergen Gross <jgross@suse.com> --- ts-xen-build | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-)