Hey,

On Tue, Mar 06, 2018 at 03:00:30PM -0300, Eduardo Lima (Etrunko) wrote:
> On 06/03/18 13:37, Christophe Fergeau wrote:
> > On Tue, Mar 06, 2018 at 11:46:33AM -0300, Eduardo Lima (Etrunko) wrote:
> >> This is a preparation for meson build, which has built-in support for
> >> generating enums, but requires the template files to be renamed. It uses
> >> the basename of template files to generate the output, and in this case
> >> it would be the same file for both '.c' and '.h'.
> >>
> >> Reference http://mesonbuild.com/Gnome-module.html#gnomemkenums
> > 
> > Hmm the generated files which should have the same base name are
> > currently spice-server-enums.c and spice-server-enums.h, so this is ok,
> > and from the link you gave, 'spice-server-enums' would be the first arg
> > to gnome.mkenums().
> > Then the link you give lists 2 separate arguments for the templates, 
> > c_template
> > and h_template.
> > So after reading the link, I'm not sure why this patch is needed?
> > 
> 
> The documentation is definitively lacking, I will provide a patch for
> that. I did not understand what was happening until I looked at the
> source code [1]. Ideally, Meson should let us specify the name of the
> output files, but this is not the case.
> 
> The declaration which failed was:
> 
> spice_server_enums = gnome.mkenums('spice-server-enums',
>                                    sources : 'spice-server.h',
>                                    c_template : 'spice-server-enums.tmpl.c',
>                                    h_template : 'spice-server-enums.tmpl.h')
> 
> 
> With the following error:
> 
> Meson encountered an error in file server/meson.build, line 30, column 0:
> Tried to create target "spice-server-enums.tmpl", but a target of that
> name already exists.

Ah ok, if a template file is specified, then the basename of the
template file is used instead of the first arg to gnome.mkenums.
Could be worth mentioning in the log that the documentation you link to
is inaccurate.

Acked-by: Christophe Fergeau <cferg...@redhat.com>

Christophe

> 
> [1]
> https://github.com/mesonbuild/meson/blob/master/mesonbuild/modules/gnome.py#L973
> 
> > 
> >>
> >> Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
> >> ---
> >>  server/Makefile.am                                           | 12 
> >> ++++++------
> >>  .../{spice-server-enums.tmpl.c => spice-server-enums.c.tmpl} |  0
> >>  .../{spice-server-enums.tmpl.h => spice-server-enums.h.tmpl} |  0
> >>  3 files changed, 6 insertions(+), 6 deletions(-)
> >>  rename server/{spice-server-enums.tmpl.c => spice-server-enums.c.tmpl} 
> >> (100%)
> >>  rename server/{spice-server-enums.tmpl.h => spice-server-enums.h.tmpl} 
> >> (100%)
> >>
> >> diff --git a/server/Makefile.am b/server/Makefile.am
> >> index 5d5590af..c1f241ac 100644
> >> --- a/server/Makefile.am
> >> +++ b/server/Makefile.am
> >> @@ -201,11 +201,11 @@ endif
> >>  libspice_server_la_LIBADD = libserver.la
> >>  libspice_server_la_SOURCES =
> >>  
> >> -spice-server-enums.c: spice-server.h spice-server-enums.tmpl.c
> >> -  $(AM_V_GEN)glib-mkenums --template $(srcdir)/spice-server-enums.tmpl.c 
> >> $< > $@
> >> +spice-server-enums.c: spice-server.h spice-server-enums.c.tmpl
> >> +  $(AM_V_GEN)glib-mkenums --template $(srcdir)/spice-server-enums.c.tmpl 
> >> $< > $@
> >>  
> >> -spice-server-enums.h: spice-server.h spice-server-enums.tmpl.h
> >> -  $(AM_V_GEN)glib-mkenums --template $(srcdir)/spice-server-enums.tmpl.h 
> >> $< > $@
> >> +spice-server-enums.h: spice-server.h spice-server-enums.h.tmpl
> >> +  $(AM_V_GEN)glib-mkenums --template $(srcdir)/spice-server-enums.h.tmpl 
> >> $< > $@
> >>  
> >>  EXTRA_DIST =                                      \
> >>    spice-bitmap-utils.tmpl.c               \
> >> @@ -213,8 +213,8 @@ EXTRA_DIST =                                   \
> >>    glz-encode-match.tmpl.c                 \
> >>    glz-encode.tmpl.c                       \
> >>    spice-server.syms                       \
> >> -  spice-server-enums.tmpl.h               \
> >> -  spice-server-enums.tmpl.c               \
> >> +  spice-server-enums.h.tmpl               \
> >> +  spice-server-enums.c.tmpl               \
> >>    $(NULL)
> >>  
> >>  BUILT_SOURCES = $(spice_built_sources)
> >> diff --git a/server/spice-server-enums.tmpl.c 
> >> b/server/spice-server-enums.c.tmpl
> >> similarity index 100%
> >> rename from server/spice-server-enums.tmpl.c
> >> rename to server/spice-server-enums.c.tmpl
> >> diff --git a/server/spice-server-enums.tmpl.h 
> >> b/server/spice-server-enums.h.tmpl
> >> similarity index 100%
> >> rename from server/spice-server-enums.tmpl.h
> >> rename to server/spice-server-enums.h.tmpl
> >> -- 
> >> 2.14.3
> >>
> >> _______________________________________________
> >> Spice-devel mailing list
> >> Spice-devel@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/spice-devel
> 
> 
> -- 
> Eduardo de Barros Lima (Etrunko)
> Software Engineer - RedHat
> etru...@redhat.com

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to