1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-23 02:04:16 +03:00

meson: tools: modify genxdrstub to work with meson

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>
This commit is contained in:
Pavel Hrdina 2020-05-20 22:48:30 +02:00
parent 851d619f13
commit 9cabfd07ea

View File

@ -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;