Instead of using environment variables pass the values to the script as arguments. Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx> --- tools/wireshark/util/genxdrstub.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/wireshark/util/genxdrstub.pl b/tools/wireshark/util/genxdrstub.pl index cae64b2f49c..8adbebdbab1 100755 --- a/tools/wireshark/util/genxdrstub.pl +++ b/tools/wireshark/util/genxdrstub.pl @@ -30,7 +30,10 @@ use File::Spec; my $DEBUG = 0; # Enable if you want to see debug output sub dbg { print STDERR @_ if $DEBUG } -die "ERROR: No arguments" unless @ARGV; +die "ERROR: No arguments" unless @ARGV >= 3; + +my $libvirt_version = shift; +my $builddir = shift; # Context object referenced from entire this script my $c = Context->new; @@ -559,7 +562,7 @@ sub add_header_file { local $self->{header_contents} = []; $self->print("/* *DO NOT MODIFY* this file directly.\n"); - $self->print(" * This file was generated by $0 from libvirt version $ENV{LIBVIRT_VERSION} */\n"); + $self->print(" * This file was generated by $0 from libvirt version $libvirt_version */\n"); my $ucname = uc $name; $self->print("#ifndef _$ucname\_H_\n"); $self->print("#define _$ucname\_H_\n"); @@ -576,7 +579,7 @@ sub finalize { for my $header (@{ $self->{headers} || [] }) { my ($name, $contents) = @$header; - my $file = File::Spec->catfile($ENV{PWD}, 'libvirt', "$name.h"); + my $file = File::Spec->catfile($builddir, "$name.h"); open my $fh, '>', $file or die "Cannot open file $file: $!"; CORE::print $fh map { ref($_) ? ($_->{refcnt} ? $_->{body} : ()) : $_ } @$contents; -- 2.26.2