]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
rpc: generalize solution for VPATH builds
authorEric Blake <eblake@redhat.com>
Tue, 6 Mar 2012 20:49:53 +0000 (13:49 -0700)
committerEric Blake <eblake@redhat.com>
Thu, 8 Mar 2012 15:49:38 +0000 (08:49 -0700)
Commit 5d4b0c4c80 tried to fix certain classes of VPATH builds,
but was too limited.  In particular, Guannan Ren reported:

>    For example: The libvirt source code resides in /home/testuser,
>                 I make dist in /tmp/buildvpath, the XDR routine .c file will
>                 include full path of the header file like:
>
>                 #include "/home/testuser/src/rpc/virnetprotocol.h"
>                 #include "internal.h"
>                 #include <arpa/inet.h>
>
>    If we distribute the tarball to another machine to compile,
>    it will report error as follows:
>
>    rpc/virnetprotocol.c:7:59: fatal error:
>    /home/testuser/src/rpc/virnetprotocol.h: No such file or directory

* src/rpc/genprotocol.pl: Fix more include lines.

src/rpc/genprotocol.pl

index 48383255d982067ae36099fbcee72feb54c84c4f..f8e68f5f6bf450566344c4a93bba6e31bcbfd271 100755 (executable)
@@ -8,7 +8,7 @@
 # actually fixes for 64 bit, so this file is necessary.  Arguably
 # so is the type-punning fix.
 #
-# Copyright (C) 2007, 2011 Red Hat, Inc.
+# Copyright (C) 2007, 2011-2012 Red Hat, Inc.
 #
 # See COPYING for the license of this software.
 #
@@ -53,13 +53,15 @@ while (<RPCGEN>) {
 
     s/\t/        /g;
 
+    # Fix VPATH builds
+    s,#include ".*/([^/]+)protocol\.h",#include "${1}protocol.h",;
+
     # Portability for Solaris RPC
     s/u_quad_t/uint64_t/g;
     s/quad_t/int64_t/g;
     s/xdr_u_quad_t/xdr_uint64_t/g;
     s/xdr_quad_t/xdr_int64_t/g;
     s/(?<!IXDR_GET_INT32 )IXDR_GET_LONG/IXDR_GET_INT32/g;
-    s,#include ".*remote/remote_protocol\.h",#include "remote_protocol.h",;
 
     if (m/^}/) {
        $in_function = 0;