mirror of https://gitee.com/openkylin/libvirt.git
build: refactor generated RPC files
Always generate the rpc files, and require rpcgen during bootstrap. * daemon/Makefile.am: Removed generated files with maintainer-clean target * src/Makefile.am: Removed generated files with maintainer-clean target. Always run 'rpcgen' if generated files are missing
This commit is contained in:
parent
d3c5104dda
commit
fb1e8d9c44
|
@ -169,6 +169,7 @@ gzip -
|
||||||
libtool -
|
libtool -
|
||||||
perl 5.5
|
perl 5.5
|
||||||
pkg-config -
|
pkg-config -
|
||||||
|
rpcgen -
|
||||||
tar -
|
tar -
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|
|
@ -2,21 +2,26 @@
|
||||||
|
|
||||||
CLEANFILES =
|
CLEANFILES =
|
||||||
|
|
||||||
|
DAEMON_GENERATED = \
|
||||||
|
remote_dispatch_prototypes.h \
|
||||||
|
remote_dispatch_table.h \
|
||||||
|
remote_dispatch_args.h \
|
||||||
|
remote_dispatch_ret.h \
|
||||||
|
remote_dispatch_bodies.h \
|
||||||
|
qemu_dispatch_prototypes.h \
|
||||||
|
qemu_dispatch_table.h \
|
||||||
|
qemu_dispatch_args.h \
|
||||||
|
qemu_dispatch_ret.h \
|
||||||
|
qemu_dispatch_bodies.h
|
||||||
|
|
||||||
DAEMON_SOURCES = \
|
DAEMON_SOURCES = \
|
||||||
libvirtd.c libvirtd.h \
|
libvirtd.c libvirtd.h \
|
||||||
remote.c remote.h \
|
remote.c remote.h \
|
||||||
dispatch.c dispatch.h \
|
dispatch.c dispatch.h \
|
||||||
stream.c stream.h \
|
stream.c stream.h \
|
||||||
remote_dispatch_prototypes.h \
|
|
||||||
remote_dispatch_table.h \
|
|
||||||
remote_dispatch_args.h \
|
|
||||||
remote_dispatch_ret.h \
|
|
||||||
qemu_dispatch_prototypes.h \
|
|
||||||
qemu_dispatch_table.h \
|
|
||||||
qemu_dispatch_args.h \
|
|
||||||
qemu_dispatch_ret.h \
|
|
||||||
../src/remote/remote_protocol.c \
|
../src/remote/remote_protocol.c \
|
||||||
../src/remote/qemu_protocol.c
|
../src/remote/qemu_protocol.c \
|
||||||
|
$(DAEMON_GENERATED)
|
||||||
|
|
||||||
AVAHI_SOURCES = \
|
AVAHI_SOURCES = \
|
||||||
mdns.c mdns.h
|
mdns.c mdns.h
|
||||||
|
@ -202,20 +207,8 @@ install-data-polkit::
|
||||||
uninstall-data-polkit::
|
uninstall-data-polkit::
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
remote.c: $(DAEMON_GENERATED)
|
||||||
remote.c: \
|
remote.h: $(DAEMON_GENERATED)
|
||||||
remote_dispatch_prototypes.h \
|
|
||||||
remote_dispatch_table.h \
|
|
||||||
remote_dispatch_bodies.h \
|
|
||||||
qemu_dispatch_prototypes.h \
|
|
||||||
qemu_dispatch_table.h \
|
|
||||||
qemu_dispatch_bodies.h
|
|
||||||
|
|
||||||
remote.h: \
|
|
||||||
remote_dispatch_args.h \
|
|
||||||
remote_dispatch_ret.h \
|
|
||||||
qemu_dispatch_args.h \
|
|
||||||
qemu_dispatch_ret.h
|
|
||||||
|
|
||||||
REMOTE_PROTOCOL = $(top_srcdir)/src/remote/remote_protocol.x
|
REMOTE_PROTOCOL = $(top_srcdir)/src/remote/remote_protocol.x
|
||||||
QEMU_PROTOCOL = $(top_srcdir)/src/remote/qemu_protocol.x
|
QEMU_PROTOCOL = $(top_srcdir)/src/remote/qemu_protocol.x
|
||||||
|
@ -360,4 +353,4 @@ endif
|
||||||
|
|
||||||
CLEANFILES += $(BUILT_SOURCES) $(man8_MANS)
|
CLEANFILES += $(BUILT_SOURCES) $(man8_MANS)
|
||||||
CLEANFILES += *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda
|
CLEANFILES += *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda
|
||||||
MAINTAINERCLEANFILES = $(srcdir)/libvirtd.8.in
|
MAINTAINERCLEANFILES = $(srcdir)/libvirtd.8.in $(DAEMON_GENERATED)
|
||||||
|
|
|
@ -154,27 +154,36 @@ CONF_SOURCES = \
|
||||||
$(CPU_CONF_SOURCES)
|
$(CPU_CONF_SOURCES)
|
||||||
|
|
||||||
# The remote RPC driver, covering domains, storage, networks, etc
|
# The remote RPC driver, covering domains, storage, networks, etc
|
||||||
REMOTE_DRIVER_SOURCES = \
|
REMOTE_DRIVER_GENERATED = \
|
||||||
gnutls_1_0_compat.h \
|
|
||||||
remote/remote_driver.c remote/remote_driver.h \
|
|
||||||
remote/remote_protocol.c \
|
remote/remote_protocol.c \
|
||||||
remote/remote_protocol.h \
|
remote/remote_protocol.h \
|
||||||
|
remote/remote_client_bodies.h \
|
||||||
remote/qemu_protocol.c \
|
remote/qemu_protocol.c \
|
||||||
remote/qemu_protocol.h
|
remote/qemu_protocol.h \
|
||||||
|
remote/qemu_client_bodies.h
|
||||||
remote/remote_driver.c: remote/remote_client_bodies.h remote/qemu_client_bodies.h
|
|
||||||
|
|
||||||
REMOTE_PROTOCOL = $(top_srcdir)/src/remote/remote_protocol.x
|
REMOTE_PROTOCOL = $(top_srcdir)/src/remote/remote_protocol.x
|
||||||
QEMU_PROTOCOL = $(top_srcdir)/src/remote/qemu_protocol.x
|
QEMU_PROTOCOL = $(top_srcdir)/src/remote/qemu_protocol.x
|
||||||
|
REMOTE_DRIVER_PROTOCOL = $(REMOTE_PROTOCOL) $(QEMU_PROTOCOL)
|
||||||
|
|
||||||
remote/remote_client_bodies.h: $(top_srcdir)/daemon/remote_generator.pl $(REMOTE_PROTOCOL)
|
remote/remote_client_bodies.h: $(top_srcdir)/daemon/remote_generator.pl \
|
||||||
$(AM_V_GEN)perl -w $(top_srcdir)/daemon/remote_generator.pl -c -k remote $(REMOTE_PROTOCOL) > $@
|
$(REMOTE_PROTOCOL)
|
||||||
|
$(AM_V_GEN)perl -w $(top_srcdir)/daemon/remote_generator.pl \
|
||||||
|
-c -k remote $(REMOTE_PROTOCOL) > $@
|
||||||
|
|
||||||
remote/qemu_client_bodies.h: $(top_srcdir)/daemon/remote_generator.pl $(QEMU_PROTOCOL)
|
remote/qemu_client_bodies.h: $(top_srcdir)/daemon/remote_generator.pl \
|
||||||
$(AM_V_GEN)perl -w $(top_srcdir)/daemon/remote_generator.pl -k remote $(QEMU_PROTOCOL) > $@
|
$(QEMU_PROTOCOL)
|
||||||
|
$(AM_V_GEN)perl -w $(top_srcdir)/daemon/remote_generator.pl \
|
||||||
|
-k qemu $(QEMU_PROTOCOL) > $@
|
||||||
|
|
||||||
EXTRA_DIST += remote/remote_protocol.x remote/qemu_protocol.x \
|
REMOTE_DRIVER_SOURCES = \
|
||||||
remote/rpcgen_fix.pl remote/remote_client_bodies.h remote/qemu_client_bodies.h
|
gnutls_1_0_compat.h \
|
||||||
|
remote/remote_driver.c remote/remote_driver.h \
|
||||||
|
$(REMOTE_DRIVER_GENERATED)
|
||||||
|
|
||||||
|
EXTRA_DIST += $(REMOTE_DRIVER_PROTOCOL) \
|
||||||
|
$(REMOTE_DRIVER_GENERATED) \
|
||||||
|
remote/rpcgen_fix.pl
|
||||||
|
|
||||||
# Ensure that we don't change the struct or member names or member ordering
|
# Ensure that we don't change the struct or member names or member ordering
|
||||||
# in remote_protocol.x The embedded perl below needs a few comments, and
|
# in remote_protocol.x The embedded perl below needs a few comments, and
|
||||||
|
@ -539,68 +548,17 @@ libvirt_driver_remote_la_LDFLAGS += -module -avoid-version
|
||||||
endif
|
endif
|
||||||
libvirt_driver_remote_la_SOURCES = $(REMOTE_DRIVER_SOURCES)
|
libvirt_driver_remote_la_SOURCES = $(REMOTE_DRIVER_SOURCES)
|
||||||
|
|
||||||
if HAVE_RPCGEN
|
|
||||||
#
|
|
||||||
# Maintainer-only target for re-generating the derived .c/.h source
|
|
||||||
# files, which are actually derived from the .x file.
|
|
||||||
#
|
|
||||||
# For committing protocol changes to GIT, the GLIBC rpcgen *must*
|
|
||||||
# be used.
|
|
||||||
#
|
|
||||||
# Support for non-GLIB rpcgen is here as a convenience for
|
|
||||||
# non-Linux people needing to test changes during dev.
|
|
||||||
#
|
|
||||||
rpcgen-normal:
|
|
||||||
rm -f rp.c-t rp.h-t rp.c-t1 rp.c-t2 rp.h-t1
|
|
||||||
$(RPCGEN) -h -o rp.h-t $(srcdir)/remote/remote_protocol.x
|
|
||||||
$(RPCGEN) -c -o rp.c-t $(srcdir)/remote/remote_protocol.x
|
|
||||||
if HAVE_GLIBC_RPCGEN
|
|
||||||
perl -w $(srcdir)/remote/rpcgen_fix.pl rp.h-t > rp.h-t1
|
|
||||||
perl -w $(srcdir)/remote/rpcgen_fix.pl rp.c-t > rp.c-t1
|
|
||||||
(echo '#include <config.h>'; cat rp.c-t1) > rp.c-t2
|
|
||||||
chmod 0444 rp.c-t2 rp.h-t1
|
|
||||||
mv -f rp.h-t1 $(srcdir)/remote/remote_protocol.h
|
|
||||||
mv -f rp.c-t2 $(srcdir)/remote/remote_protocol.c
|
|
||||||
rm -f rp.c-t rp.h-t rp.c-t1
|
|
||||||
else
|
|
||||||
chmod 0444 rp.c-t rp.h-t
|
|
||||||
mv -f rp.h-t $(srcdir)/remote/remote_protocol.h
|
|
||||||
mv -f rp.c-t $(srcdir)/remote/remote_protocol.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
rpcgen-qemu:
|
remote/remote_driver.c: $(REMOTE_DRIVER_GENERATED)
|
||||||
rm -f rp_qemu.c-t rp_qemu.h-t rp_qemu.c-t1 rp_qemu.c-t2 rp_qemu.h-t1
|
|
||||||
$(RPCGEN) -h -o rp_qemu.h-t $(srcdir)/remote/qemu_protocol.x
|
|
||||||
$(RPCGEN) -c -o rp_qemu.c-t $(srcdir)/remote/qemu_protocol.x
|
|
||||||
if HAVE_GLIBC_RPCGEN
|
|
||||||
perl -w $(srcdir)/remote/rpcgen_fix.pl rp_qemu.h-t > rp_qemu.h-t1
|
|
||||||
perl -w $(srcdir)/remote/rpcgen_fix.pl rp_qemu.c-t > rp_qemu.c-t1
|
|
||||||
(echo '#include <config.h>'; cat rp_qemu.c-t1) > rp_qemu.c-t2
|
|
||||||
chmod 0444 rp_qemu.c-t2 rp_qemu.h-t1
|
|
||||||
mv -f rp_qemu.h-t1 $(srcdir)/remote/qemu_protocol.h
|
|
||||||
mv -f rp_qemu.c-t2 $(srcdir)/remote/qemu_protocol.c
|
|
||||||
rm -f rp_qemu.c-t rp_qemu.h-t rp_qemu.c-t1
|
|
||||||
else
|
|
||||||
chmod 0444 rp_qemu.c-t rp_qemu.h-t
|
|
||||||
mv -f rp_qemu.h-t $(srcdir)/remote/qemu_protocol.h
|
|
||||||
mv -f rp_qemu.c-t $(srcdir)/remote/qemu_protocol.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
#
|
remote/%_protocol.c: remote/%_protocol.x remote/%_protocol.h
|
||||||
# Maintainer-only target for re-generating the derived .c/.h source
|
$(AM_V_GEN)perl -w $(srcdir)/remote/rpcgen_fix.pl $(RPCGEN) -c \
|
||||||
# files, which are actually derived from the .x file.
|
$< $@
|
||||||
#
|
|
||||||
# For committing protocol changes to GIT, the GLIBC rpcgen *must*
|
|
||||||
# be used.
|
|
||||||
#
|
|
||||||
# Support for non-GLIB rpcgen is here as a convenience for
|
|
||||||
# non-Linux people needing to test changes during dev.
|
|
||||||
#
|
|
||||||
rpcgen: rpcgen-normal rpcgen-qemu
|
|
||||||
|
|
||||||
endif
|
remote/%_protocol.h: remote/%_protocol.x
|
||||||
|
$(AM_V_GEN)perl -w $(srcdir)/remote/rpcgen_fix.pl $(RPCGEN) -h \
|
||||||
|
$< $@
|
||||||
|
|
||||||
remote/remote_protocol.c: remote/remote_protocol.h
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if WITH_XEN
|
if WITH_XEN
|
||||||
|
@ -1350,3 +1308,4 @@ endif
|
||||||
|
|
||||||
CLEANFILES = *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda *.i *.s
|
CLEANFILES = *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda *.i *.s
|
||||||
DISTCLEANFILES = $(BUILT_SOURCES)
|
DISTCLEANFILES = $(BUILT_SOURCES)
|
||||||
|
MAINTAINERCLEANFILES = $(REMOTE_DRIVER_GENERATED)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* It was generated using rpcgen.
|
* It was generated using rpcgen.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "remote_protocol.h"
|
#include "remote/remote_protocol.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#ifdef HAVE_XDR_U_INT64_T
|
#ifdef HAVE_XDR_U_INT64_T
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
# Fix XDR code (generated by rpcgen) so that it compiles
|
#
|
||||||
|
# Generate code for an XDR protocol, optionally applying
|
||||||
|
# fixups to the glibc rpcgen code so that it compiles
|
||||||
# with warnings turned on.
|
# with warnings turned on.
|
||||||
#
|
#
|
||||||
# This code is evil. Arguably better would be just to compile
|
# This code is evil. Arguably better would be just to compile
|
||||||
|
@ -6,7 +8,7 @@
|
||||||
# actually fixes for 64 bit, so this file is necessary. Arguably
|
# actually fixes for 64 bit, so this file is necessary. Arguably
|
||||||
# so is the type-punning fix.
|
# so is the type-punning fix.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007 Red Hat, Inc.
|
# Copyright (C) 2007, 2011 Red Hat, Inc.
|
||||||
#
|
#
|
||||||
# See COPYING for the license of this software.
|
# See COPYING for the license of this software.
|
||||||
#
|
#
|
||||||
|
@ -17,10 +19,35 @@ use strict;
|
||||||
my $in_function = 0;
|
my $in_function = 0;
|
||||||
my @function = ();
|
my @function = ();
|
||||||
|
|
||||||
while (<>) {
|
my $rpcgen = shift;
|
||||||
|
my $mode = shift;
|
||||||
|
my $xdrdef = shift;
|
||||||
|
my $target = shift;
|
||||||
|
|
||||||
|
unlink $target;
|
||||||
|
|
||||||
|
open RPCGEN, "-|", $rpcgen, $mode, $xdrdef
|
||||||
|
or die "cannot run $rpcgen $mode $xdrdef: $!";
|
||||||
|
open TARGET, ">$target"
|
||||||
|
or die "cannot create $target: $!";
|
||||||
|
|
||||||
|
my $fixup = $^O eq "linux";
|
||||||
|
|
||||||
|
if ($mode eq "-c") {
|
||||||
|
print TARGET "#include <config.h>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
while (<RPCGEN>) {
|
||||||
|
# We only want to fixup the GLibc rpcgen output
|
||||||
|
# So just print data unchanged, if non-Linux
|
||||||
|
unless ($fixup) {
|
||||||
|
print TARGET;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
if (m/^{/) {
|
if (m/^{/) {
|
||||||
$in_function = 1;
|
$in_function = 1;
|
||||||
print;
|
print TARGET;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,13 +106,21 @@ while (<>) {
|
||||||
map { s/\bXDR_INLINE\b/(int32_t*)XDR_INLINE/; $_ }
|
map { s/\bXDR_INLINE\b/(int32_t*)XDR_INLINE/; $_ }
|
||||||
@function;
|
@function;
|
||||||
|
|
||||||
print (join ("", @function));
|
print TARGET (join ("", @function));
|
||||||
@function = ();
|
@function = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
unless ($in_function) {
|
unless ($in_function) {
|
||||||
print;
|
print TARGET;
|
||||||
} else {
|
} else {
|
||||||
push @function, $_;
|
push @function, $_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
close TARGET
|
||||||
|
or die "cannot save $target: $!";
|
||||||
|
close RPCGEN
|
||||||
|
or die "cannot shutdown $rpcgen: $!";
|
||||||
|
|
||||||
|
chmod 0444, $target
|
||||||
|
or die "cannot set $target readonly: $!";
|
||||||
|
|
Loading…
Reference in New Issue