On 14/08/18 04:47, Frediano Ziglio wrote: >> On 13/08/18 07:23, Frediano Ziglio wrote: >>>> >>>> Ninja parallel build fails in certain environments, so it is required >>>> specify those files as a dependency so that vncdisplaykeymap.c will only >>>> be built after all files it depends on are generated. >>>> >>>> The problem is that, when using meson declare_dependency() function, >>>> only header files should be used as the "sources" keyword, as documented >>>> in >>>> http://mesonbuild.com/Wrap-best-practices-and-tips.html#declare-generated-headers-explicitly >>>> and >>>> http://mesonbuild.com/Wrap-best-practices-and-tips.html#avoid-exposing-compilable-source-files-in-declare_dependency >>>> >>>> Signed-off-by: Eduardo Lima (Etrunko) <etrunko@xxxxxxxxxx> >>> >>> Patch looks good for me, however the problem is not the file extensions, >>> but the >>> dependencies declaration. Is not the library that is dependent directly on >>> these >>> files, is the C file (src/vncdisplaykeymap.c) which is dependent directly >>> on these files. >>> So it is the meson.build file that should be updated to reflect this. >>> Does Meson lack the possibility to specify dependencies between source >>> files? >> >> Yes, this is the issue, as far as I know, it is not possible to declare >> dependency between files. >> > > Very sad! I tried to find a possible workaround like doing a custom target > but using a compiler and didn't find a way to pass the compiler instead of > an executable; I was thinking to use a library but still I would need > another file. But also this seems to indicate that Meson dependency generation > can't generate dependencies in a proper way. Why files with .h are considered > and file with .c not? We have the same problem in spice-server for template > files which are .c. Well, they are different use cases. I talked to people on meson channel and someone had the same problem with glib, and the workaround was basically the same, rename the generated files so that they are not built. https://gitlab.gnome.org/GNOME/glib/commit/f438c04fac22d31d43afef5f7666bf04dda75bf3 But that took me to the other commit that actually uses that renamed file, https://gitlab.gnome.org/GNOME/glib/commit/34e4e25d53d72db65bb2225a607d3274854fb549 Which made me realize that it is not necessary to use declare_dependency() here, but just add them to the list of sources, as the generated files have been renamed already. > >>> >>> Frediano >>> >>>> --- >>>> src/Makefile.am | 28 ++++++++++++++-------------- >>>> src/vncdisplaykeymap.c | 14 +++++++------- >>>> 2 files changed, 21 insertions(+), 21 deletions(-) >>>> >>>> diff --git a/src/Makefile.am b/src/Makefile.am >>>> index afad922..e362b02 100644 >>>> --- a/src/Makefile.am >>>> +++ b/src/Makefile.am >>>> @@ -2,13 +2,13 @@ NULL = >>>> SUBDIRS = >>>> >>>> KEYMAPS = \ >>>> - vncdisplaykeymap_xorgevdev2xtkbd.c \ >>>> - vncdisplaykeymap_xorgkbd2xtkbd.c \ >>>> - vncdisplaykeymap_xorgxquartz2xtkbd.c \ >>>> - vncdisplaykeymap_xorgxwin2xtkbd.c \ >>>> - vncdisplaykeymap_osx2xtkbd.c \ >>>> - vncdisplaykeymap_win322xtkbd.c \ >>>> - vncdisplaykeymap_x112xtkbd.c \ >>>> + vncdisplaykeymap_xorgevdev2xtkbd.h \ >>>> + vncdisplaykeymap_xorgkbd2xtkbd.h \ >>>> + vncdisplaykeymap_xorgxquartz2xtkbd.h \ >>>> + vncdisplaykeymap_xorgxwin2xtkbd.h \ >>>> + vncdisplaykeymap_osx2xtkbd.h \ >>>> + vncdisplaykeymap_win322xtkbd.h \ >>>> + vncdisplaykeymap_x112xtkbd.h \ >>>> $(NULL) >>>> >>>> # End users build dependencies can be cleaned >>>> @@ -471,25 +471,25 @@ spice-widget-enums.h: spice-widget.h >>>> vncdisplaykeymap.c: $(KEYMAPS) >>>> $(KEYMAPS): $(srcdir)/$(KEYMAP_GEN) $(srcdir)/$(KEYMAP_CSV) >>>> >>>> -vncdisplaykeymap_xorgevdev2xtkbd.c: >>>> +vncdisplaykeymap_xorgevdev2xtkbd.h: >>>> $(AM_V_GEN)$(PYTHON) $(srcdir)/$(KEYMAP_GEN) --lang glib2 --varname >>>> keymap_xorgevdev2xtkbd code-map $(srcdir)/$(KEYMAP_CSV) xorgevdev xtkbd >>>> > >>>> $@ || rm $@ >>>> >>>> -vncdisplaykeymap_xorgkbd2xtkbd.c: >>>> +vncdisplaykeymap_xorgkbd2xtkbd.h: >>>> $(AM_V_GEN)$(PYTHON) $(srcdir)/$(KEYMAP_GEN) --lang glib2 --varname >>>> keymap_xorgkbd2xtkbd code-map $(srcdir)/$(KEYMAP_CSV) xorgkbd xtkbd > $@ >>>> || rm $@ >>>> >>>> -vncdisplaykeymap_xorgxquartz2xtkbd.c: >>>> +vncdisplaykeymap_xorgxquartz2xtkbd.h: >>>> $(AM_V_GEN)$(PYTHON) $(srcdir)/$(KEYMAP_GEN) --lang glib2 --varname >>>> keymap_xorgxquartz2xtkbd code-map $(srcdir)/$(KEYMAP_CSV) xorgxquartz >>>> xtkbd > $@ || rm $@ >>>> >>>> -vncdisplaykeymap_xorgxwin2xtkbd.c: >>>> +vncdisplaykeymap_xorgxwin2xtkbd.h: >>>> $(AM_V_GEN)$(PYTHON) $(srcdir)/$(KEYMAP_GEN) --lang glib2 --varname >>>> keymap_xorgxwin2xtkbd code-map $(srcdir)/$(KEYMAP_CSV) xorgxwin xtkbd > >>>> $@ >>>> || rm $@ >>>> >>>> -vncdisplaykeymap_osx2xtkbd.c: >>>> +vncdisplaykeymap_osx2xtkbd.h: >>>> $(AM_V_GEN)$(PYTHON) $(srcdir)/$(KEYMAP_GEN) --lang glib2 --varname >>>> keymap_osx2xtkbd code-map $(srcdir)/$(KEYMAP_CSV) osx xtkbd > $@ || rm >>>> $@ >>>> >>>> -vncdisplaykeymap_win322xtkbd.c: >>>> +vncdisplaykeymap_win322xtkbd.h: >>>> $(AM_V_GEN)$(PYTHON) $(srcdir)/$(KEYMAP_GEN) --lang glib2 --varname >>>> keymap_win322xtkbd code-map $(srcdir)/$(KEYMAP_CSV) win32 xtkbd > $@ || >>>> rm >>>> $@ >>>> >>>> -vncdisplaykeymap_x112xtkbd.c: >>>> +vncdisplaykeymap_x112xtkbd.h: >>>> $(AM_V_GEN)$(PYTHON) $(srcdir)/$(KEYMAP_GEN) --lang glib2 --varname >>>> keymap_x112xtkbd code-map $(srcdir)/$(KEYMAP_CSV) x11 xtkbd > $@ || rm >>>> $@ >>>> >>>> -include $(INTROSPECTION_MAKEFILE) >>>> diff --git a/src/vncdisplaykeymap.c b/src/vncdisplaykeymap.c >>>> index e1a16aa..e09e330 100644 >>>> --- a/src/vncdisplaykeymap.c >>>> +++ b/src/vncdisplaykeymap.c >>>> @@ -66,7 +66,7 @@ static unsigned int ref_count_for_untranslated_keys = 0; >>>> >>>> #if defined(GDK_WINDOWING_X11) || defined(GDK_WINDOWING_WAYLAND) >>>> /* Xorg Linux + evdev (offset evdev keycodes) */ >>>> -#include "vncdisplaykeymap_xorgevdev2xtkbd.c" >>>> +#include "vncdisplaykeymap_xorgevdev2xtkbd.h" >>>> #endif >>>> >>>> #ifdef GDK_WINDOWING_X11 >>>> @@ -76,11 +76,11 @@ static unsigned int ref_count_for_untranslated_keys = >>>> 0; >>>> #include <string.h> >>>> >>>> /* Xorg Linux + kbd (offset + mangled XT keycodes) */ >>>> -#include "vncdisplaykeymap_xorgkbd2xtkbd.c" >>>> +#include "vncdisplaykeymap_xorgkbd2xtkbd.h" >>>> /* Xorg OS-X aka XQuartz (offset OS-X keycodes) */ >>>> -#include "vncdisplaykeymap_xorgxquartz2xtkbd.c" >>>> +#include "vncdisplaykeymap_xorgxquartz2xtkbd.h" >>>> /* Xorg Cygwin aka XWin (offset + mangled XT keycodes) */ >>>> -#include "vncdisplaykeymap_xorgxwin2xtkbd.c" >>>> +#include "vncdisplaykeymap_xorgxwin2xtkbd.h" >>>> >>>> #endif >>>> >>>> @@ -88,19 +88,19 @@ static unsigned int ref_count_for_untranslated_keys = >>>> 0; >>>> #include <gdk/gdkwin32.h> >>>> >>>> /* Win32 native virtual keycodes */ >>>> -#include "vncdisplaykeymap_win322xtkbd.c" >>>> +#include "vncdisplaykeymap_win322xtkbd.h" >>>> #endif >>>> >>>> #ifdef GDK_WINDOWING_QUARTZ >>>> #include <gdk/gdkquartz.h> >>>> >>>> /* OS-X native keycodes */ >>>> -#include "vncdisplaykeymap_osx2xtkbd.c" >>>> +#include "vncdisplaykeymap_osx2xtkbd.h" >>>> #endif >>>> >>>> #ifdef GDK_WINDOWING_BROADWAY >>>> /* X11 keysyms */ >>>> -#include "vncdisplaykeymap_x112xtkbd.c" >>>> +#include "vncdisplaykeymap_x112xtkbd.h" >>>> #endif >>>> >>>> #ifdef GDK_WINDOWING_X11 >> > > Frediano > -- Eduardo de Barros Lima (Etrunko) Software Engineer - RedHat etrunko@xxxxxxxxxx _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel