Use installed spice-protocol for code generation

Now that spice-protocol ships the needed .proto files as well as the
corresponding python scripts, spice-common can use these in order to
generate the C code for the SPICE (de)marshallers.
This commit is contained in:
Christophe Fergeau 2015-07-06 17:57:52 +02:00
parent c48b0a0672
commit f88a7b7bec
3 changed files with 27 additions and 30 deletions

View File

@ -14,7 +14,7 @@ SERVER_MARSHALLERS = \
generated_server_marshallers.h \
$(NULL)
BUILT_SOURCES = $(CLIENT_MARSHALLERS) $(SERVER_MARSHALLERS) $(top_srcdir)/spice-protocol/spice/enums.h
BUILT_SOURCES = $(CLIENT_MARSHALLERS) $(SERVER_MARSHALLERS)
noinst_LTLIBRARIES = libspice-common.la libspice-common-server.la libspice-common-client.la
libspice_common_la_SOURCES = \
@ -99,45 +99,39 @@ libspice_common_la_LIBADD = \
$(SPICE_COMMON_LIBS) \
$(NULL)
MARSHALLERS_DEPS = \
$(top_srcdir)/python_modules/__init__.py \
$(top_srcdir)/python_modules/codegen.py \
$(top_srcdir)/python_modules/demarshal.py \
$(top_srcdir)/python_modules/marshal.py \
$(top_srcdir)/python_modules/ptypes.py \
$(top_srcdir)/python_modules/spice_parser.py \
$(top_srcdir)/spice_codegen.py \
MARSHALLERS_DEPS = \
$(CODE_GENERATOR_BASEDIR)/python_modules/__init__.py \
$(CODE_GENERATOR_BASEDIR)/python_modules/codegen.py \
$(CODE_GENERATOR_BASEDIR)/python_modules/demarshal.py \
$(CODE_GENERATOR_BASEDIR)/python_modules/marshal.py \
$(CODE_GENERATOR_BASEDIR)/python_modules/ptypes.py \
$(CODE_GENERATOR_BASEDIR)/python_modules/spice_parser.py \
$(CODE_GENERATOR_BASEDIR)/spice_codegen.py \
$(NULL)
# 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 common/messages.h $< $@ >/dev/null
generated_client_demarshallers.c: $(CODE_GENERATOR_BASEDIR)/spice.proto $(MARSHALLERS_DEPS)
$(AM_V_GEN)$(PYTHON) $(CODE_GENERATOR_BASEDIR)/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 common/messages.h --prefix 1 --ptrsize 8 $< $@ >/dev/null
generated_client_demarshallers1.c: $(CODE_GENERATOR_BASEDIR)/spice1.proto $(MARSHALLERS_DEPS)
$(AM_V_GEN)$(PYTHON) $(CODE_GENERATOR_BASEDIR)/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 common/messages.h --include client_marshallers.h --client $< $@ >/dev/null
generated_client_marshallers.c: $(CODE_GENERATOR_BASEDIR)/spice.proto $(MARSHALLERS_DEPS)
$(AM_V_GEN)$(PYTHON) $(CODE_GENERATOR_BASEDIR)/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 common/messages.h --include client_marshallers.h --client --prefix 1 --ptrsize 8 $< $@ >/dev/null
generated_client_marshallers1.c: $(CODE_GENERATOR_BASEDIR)/spice1.proto $(MARSHALLERS_DEPS)
$(AM_V_GEN)$(PYTHON) $(CODE_GENERATOR_BASEDIR)/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 common/messages.h $< $@ >/dev/null
generated_server_demarshallers.c: $(CODE_GENERATOR_BASEDIR)/spice.proto $(MARSHALLERS_DEPS)
$(AM_V_GEN)$(PYTHON) $(CODE_GENERATOR_BASEDIR)/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 common/messages.h $< $@ >/dev/null
generated_server_marshallers.c: $(CODE_GENERATOR_BASEDIR)/spice.proto $(MARSHALLERS_DEPS)
$(AM_V_GEN)$(PYTHON) $(CODE_GENERATOR_BASEDIR)/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 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
# enums.h only if the spice.proto has changed.
$(top_srcdir)/spice-protocol/spice/enums.h: $(top_srcdir)/spice.proto # $(MARSHALLERS_DEPS)
$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-enums $< $@ >/dev/null
generated_server_marshallers.h: $(CODE_GENERATOR_BASEDIR)/spice.proto $(MARSHALLERS_DEPS)
$(AM_V_GEN)$(PYTHON) $(CODE_GENERATOR_BASEDIR)/spice_codegen.py --generate-marshallers $(STRUCTS) --server --include common/messages.h -H $< $@ >/dev/null
EXTRA_DIST = \
$(CLIENT_MARSHALLERS) \

View File

@ -28,7 +28,9 @@ AM_PROG_CC_C_O
SPICE_CHECK_SYSDEPS
# Checks for libraries
PKG_CHECK_MODULES([PROTOCOL], [spice-protocol])
PKG_CHECK_MODULES([PROTOCOL], [spice-protocol >= 0.12.10])
CODE_GENERATOR_BASEDIR=`pkg-config --variable=codegendir spice-protocol`
AC_SUBST([CODE_GENERATOR_BASEDIR])
SPICE_CHECK_PYTHON_MODULES()

View File

@ -168,6 +168,7 @@ AC_DEFUN([SPICE_CHECK_GLIB2], [
# tarballs so they are disabled by default.
#---------------------------
AC_DEFUN([SPICE_CHECK_PYTHON_MODULES], [
AM_PATH_PYTHON
AC_ARG_ENABLE([python-checks],
AS_HELP_STRING([--enable-python-checks=@<:@yes/no@:>@],
[Enable checks for Python modules needed to build from git @<:@default=no@:>@]),