]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: tools: modify genxdrstub to work with meson
authorPavel Hrdina <phrdina@redhat.com>
Wed, 20 May 2020 20:48:30 +0000 (22:48 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 3 Aug 2020 07:27:05 +0000 (09:27 +0200)
Instead of using environment variables pass the values to the script
as arguments.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
tools/wireshark/util/genxdrstub.pl

index cae64b2f49c97646d5d764ed5671d1e6c1e201c2..8adbebdbab10b4e4ec499a3292a0333ce5647521 100755 (executable)
@@ -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;