[Spice-commits] 3 commits - common/Makefile.am python_modules/demarshal.py python_modules/marshal.py spice_codegen.py

Christophe Fergau teuf at kemper.freedesktop.org
Wed Apr 16 07:49:55 PDT 2014


 common/Makefile.am          |   33 +++++++++++++++++----------------
 python_modules/demarshal.py |    2 +-
 python_modules/marshal.py   |    4 ++--
 spice_codegen.py            |    4 ++--
 4 files changed, 22 insertions(+), 21 deletions(-)

New commits:
commit b3a00f4411962e0c06c7ad89a9936df388aa0023
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Tue Mar 25 16:32:16 2014 +0100

    marshaller: Use #include <> for headers in $srcdir/common
    
    Since the (de)marshallers are now generated in $builddir and not in
    $srcdir, when these generated files include a file located in
    $srcdir/common, the compiler will find them thanks to a -I directive, so it
    makes more sense to use <> rather than "" when including them.

diff --git a/python_modules/demarshal.py b/python_modules/demarshal.py
index 794cd25..b7e51dc 100644
--- a/python_modules/demarshal.py
+++ b/python_modules/demarshal.py
@@ -1250,7 +1250,7 @@ def write_includes(writer):
     writer.writeln("#include <stdio.h>")
     writer.writeln("#include <spice/protocol.h>")
     writer.writeln("#include <spice/macros.h>")
-    writer.writeln('#include "common/mem.h"')
+    writer.writeln('#include <common/mem.h>')
     writer.newline()
     writer.writeln("#ifdef _MSC_VER")
     writer.writeln("#pragma warning(disable:4101)")
diff --git a/spice_codegen.py b/spice_codegen.py
index d35d949..c8376cc 100755
--- a/spice_codegen.py
+++ b/spice_codegen.py
@@ -209,8 +209,8 @@ if options.print_error:
 
 if options.includes:
     for i in options.includes:
-        writer.header.writeln('#include "%s"' % i)
-        writer.writeln('#include "%s"' % i)
+        writer.header.writeln('#include <%s>' % i)
+        writer.writeln('#include <%s>' % i)
 
 if options.generate_enums or options.generate_dissector:
     write_enums(writer, options.generate_dissector)
commit 90a1240f274b55ae0b406e8f1edaadaa87748bec
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed Mar 19 15:41:07 2014 +0100

    Use #include "common/..." in (de)marshallers
    
    Now that they are created in $builddir, their includes will need to refer
    to files in $srcdir, which can be different. It's cleaner to add
    -I $(top_srcdir)/spice-common/ to modules using spice-common rather than
    having -I $(top_srcdir)/spice-common/common which would could create header
    collisions.

diff --git a/common/Makefile.am b/common/Makefile.am
index f985057..435d448 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -81,6 +81,7 @@ libspice_common_la_SOURCES +=		\
 endif
 
 AM_CPPFLAGS =				\
+	-I$(top_srcdir)			\
 	$(GL_CFLAGS)			\
 	$(PIXMAN_CFLAGS)		\
 	$(CELT051_CFLAGS)		\
@@ -109,26 +110,26 @@ MARSHALLERS_DEPS =					\
 # Note despite being autogenerated these are not part of CLEANFILES, they are
 # actually a part of EXTRA_DIST, to avoid the need for pyparser by end users
 generated_client_demarshallers.c: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS)
-	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --client --include messages.h $< $@ >/dev/null
+	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --client --include common/messages.h $< $@ >/dev/null
 
 generated_client_demarshallers1.c: $(top_srcdir)/spice1.proto $(MARSHALLERS_DEPS)
-	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --client --include messages.h --prefix 1 --ptrsize 8 $< $@ >/dev/null
+	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --client --include common/messages.h --prefix 1 --ptrsize 8 $< $@ >/dev/null
 
 generated_client_marshallers.c: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS)
-	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers -P --include messages.h --include client_marshallers.h --client $< $@ >/dev/null
+	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers -P --include common/messages.h --include client_marshallers.h --client $< $@ >/dev/null
 
 generated_client_marshallers1.c: $(top_srcdir)/spice1.proto $(MARSHALLERS_DEPS)
-	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers -P --include messages.h --include client_marshallers.h --client --prefix 1 --ptrsize 8 $< $@ >/dev/null
+	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers -P --include common/messages.h --include client_marshallers.h --client --prefix 1 --ptrsize 8 $< $@ >/dev/null
 
 generated_server_demarshallers.c: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS)
-	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --server --include messages.h $< $@ >/dev/null
+	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --server --include common/messages.h $< $@ >/dev/null
 
 STRUCTS = -M String -M Rect -M Point -M DisplayBase -M Fill -M Opaque -M Copy -M Blend -M Blackness -M Whiteness -M Invers -M Rop3 -M Stroke -M Text -M Transparent -M AlphaBlend -M Composite
 generated_server_marshallers.c: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS)
-	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers $(STRUCTS) --server --include messages.h $< $@ >/dev/null
+	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers $(STRUCTS) --server --include common/messages.h $< $@ >/dev/null
 
 generated_server_marshallers.h: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS)
-	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers $(STRUCTS) --server --include messages.h -H $< $@ >/dev/null
+	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers $(STRUCTS) --server --include common/messages.h -H $< $@ >/dev/null
 
 # this is going to upset automake distcheck, since we try to write to
 # readonly srcdir. To limit the fail chances, rebuild automatically
diff --git a/python_modules/demarshal.py b/python_modules/demarshal.py
index cf48d74..794cd25 100644
--- a/python_modules/demarshal.py
+++ b/python_modules/demarshal.py
@@ -1250,7 +1250,7 @@ def write_includes(writer):
     writer.writeln("#include <stdio.h>")
     writer.writeln("#include <spice/protocol.h>")
     writer.writeln("#include <spice/macros.h>")
-    writer.writeln('#include "mem.h"')
+    writer.writeln('#include "common/mem.h"')
     writer.newline()
     writer.writeln("#ifdef _MSC_VER")
     writer.writeln("#pragma warning(disable:4101)")
diff --git a/python_modules/marshal.py b/python_modules/marshal.py
index 4020799..ae5fe31 100644
--- a/python_modules/marshal.py
+++ b/python_modules/marshal.py
@@ -4,7 +4,7 @@ import codegen
 
 def write_includes(writer):
     writer.header.writeln("#include <spice/protocol.h>")
-    writer.header.writeln('#include "marshaller.h"')
+    writer.header.writeln('#include "common/marshaller.h"')
     writer.header.newline()
     writer.header.writeln("#ifndef _GENERATED_HEADERS_H")
     writer.header.writeln("#define _GENERATED_HEADERS_H")
@@ -15,7 +15,7 @@ def write_includes(writer):
     writer.writeln("#include <stdio.h>")
     writer.writeln("#include <spice/protocol.h>")
     writer.writeln("#include <spice/macros.h>")
-    writer.writeln('#include "marshaller.h"')
+    writer.writeln('#include "common/marshaller.h"')
     writer.newline()
     writer.writeln("#ifdef _MSC_VER")
     writer.writeln("#pragma warning(disable:4101)")
commit 7ea1cc54b1cdc105e086c154cc15b2541937c7b7
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed Mar 19 13:50:52 2014 +0100

    Fix generation of marshallers in VPATH builds
    
    The rules to generate the .c/.h (de)marshalling files have targets based in
    $builddir, but the CLIENT_MARSHALLERS/SERVER_MARSHALLERS list refer to
    files in $srcdir.
    When using a $srcdir != $builddir, these $srcdir files will not exist, and
    it will not be possible to generate them, which causes the build to fail.
    
    When using $srcdir == $builddir from git or from tarballs, this will not
    make a difference. When building from git, if $srcdir and $builddir are the
    same, then the files will be found regardless of if we look for them in
    $srcdir or $builddir as they are the same.
    In tarballs, the files will be shipped with the tarball and thus available
    in $srcdir. As $builddir is the same as $srcdir, the files will already
    exist and not be regenerated.
    
    The only change of behaviour will be when using a tarball and doing a
    $srcdir != $builddir build. In this case, the files will need to be
    regenerated, so the tools needed for that must be installed on the
    machine doing the build.

diff --git a/common/Makefile.am b/common/Makefile.am
index 73703fc..f985057 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -1,17 +1,17 @@
 NULL =
 
 # Avoid need for python(pyparsing) by end users
-CLIENT_MARSHALLERS =					\
-	$(srcdir)/generated_client_demarshallers.c	\
-	$(srcdir)/generated_client_demarshallers1.c	\
-	$(srcdir)/generated_client_marshallers.c	\
-	$(srcdir)/generated_client_marshallers1.c	\
+CLIENT_MARSHALLERS =				\
+	generated_client_demarshallers.c	\
+	generated_client_demarshallers1.c	\
+	generated_client_marshallers.c		\
+	generated_client_marshallers1.c		\
 	$(NULL)
 
-SERVER_MARSHALLERS =					\
-	$(srcdir)/generated_server_demarshallers.c	\
-	$(srcdir)/generated_server_marshallers.c	\
-	$(srcdir)/generated_server_marshallers.h	\
+SERVER_MARSHALLERS =				\
+	generated_server_demarshallers.c	\
+	generated_server_marshallers.c		\
+	generated_server_marshallers.h		\
 	$(NULL)
 
 BUILT_SOURCES = $(CLIENT_MARSHALLERS) $(SERVER_MARSHALLERS) $(top_srcdir)/spice-protocol/spice/enums.h


More information about the Spice-commits mailing list