GNOME Bugzilla – Bug 792203
Makefile.am unable to build stable wayland protocols
Last modified: 2018-02-23 11:26:20 UTC
Created attachment 366283 [details] [review] Allow stable wayland protocls to build as long as they have an arbitary version number Hello, I'm currently trying to include the viewporter protocol into mutter but I'm unable to let the needed header/shim files build automatically by including something like 'viewporter-stable-protocol.c' into src/Makefile.am. Turns out that it would be the first stable wayland protocol in mutter and that there's a bug with the following part in src/Makefile.am: <code> define protostability $(shell echo $1 | sed 's/.*\(\<unstable\>\|\<stable\>\).*/\1/') endef define protoname $(shell echo $1 | sed 's/\([a-z\-]\+\)-[a-z]\+-v[0-9]\+/\1/') endef %-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/$$(call protostability,$$*)/$$(call protoname,$$*)/$$*.xml $(AM_V_GEN)$(WAYLAND_SCANNER) code $< $@ %-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/$$(call protostability,$$*)/$$(call %-server-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/$$(call protostability,$$*)/$$(call protoname,$$*)/$$*.xml $(AM_V_GEN)$(WAYLAND_SCANNER) server-header $< $@ </code> This only works for unstable protocols as they carry a version number and the 'protoname' expects one. Trying to build 'viewporter-stable-v1-protocol.c' doesn't work either, though, as the actual xml file does not have a version number in it's name. I attached a patch which allows 'viewporter-stable-v1-protocol.c' to build correctly, but I think we should change 'protoname' to allow 'viewporter-stable-protocol.c' to build.
Created attachment 366303 [details] [review] Make src/Makefile.am build stable wayland protols and make extra cases unnessecary This fixes the described issue and as a side effect eliminates the extra cases. Patch is against version 3.26.2 though, not git master
Created attachment 366421 [details] [review] Make src/Makefile.am build stable wayland protols and make extra cases unnessecary Fix rebased agains git-master and in propper format
Review of attachment 366421 [details] [review]: Commit log nit, please wrap commit log so it doesn't exceed 72 columns. ::: src/Makefile.am @@ +746,3 @@ + $(AM_V_GEN)$(WAYLAND_SCANNER) code $< $@ +%-server-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/$$(call protostability,$$*)/$$(call protoname,$$*)/$$(call protoname,$$*).xml + $(AM_V_GEN)$(WAYLAND_SCANNER) server-header $< $@ LGTM @@ -747,3 @@ %-server-protocol.h : $(srcdir)/wayland/protocol/%.xml $(AM_V_GEN)$(WAYLAND_SCANNER) server-header $< $@ -keyboard-shortcuts-inhibit-unstable-v1-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml I think it makes sense separating this last chunk into a second commit, IMHO it will be harmless to keep and will make the first commit clearer.
Created attachment 366763 [details] [review] src/Makefile.am: Fix building of stable wayland protcols Currently stable wayland-protcols do not get found because they neither contain version numbers nor an 'unstable' in their name. This patch makes them build in a usual naming patter, e.g. 'viewporter-server-protocol.h". As a side effect, it fixes building of protocls with multi-word names.
Created attachment 366764 [details] [review] src/Makefile.am: remove redundant wayland-protocol generation rules Removes previously needed generation rules
Created attachment 366765 [details] [review] src/Makefile.am: Fix building of stable wayland protcols Currently stable wayland-protcols do not get found because they neither contain version numbers nor an 'unstable' in their name. This patch makes them build in a usual naming patter, e.g. 'viewporter-server-protocol.h". As a side effect, it fixes building of protocls with multi-word names.
Created attachment 366766 [details] [review] src/Makefile.am: remove redundant wayland-protocol generation rules Removes previously needed generation rules for wayland protocols
I'd prefer if we change the rule to the one I have in https://gitlab.gnome.org/jadahl/mutter/commit/3519c05a2c760881153117a12b388b40d691ae49#67e794015a01b8816bd16290e5f8538236da8245_745_748 (which is the same in weston which has already had that rule for a while with no issues).
Comment on attachment 366766 [details] [review] src/Makefile.am: remove redundant wayland-protocol generation rules Pushed the follow up patch. Those rules weren't needed to begin with (find -name "-protocol.c" -or -name "*-server-protocol.h" -delete && make doesn't complain), so removed the comment in the commit message body about it not being possible before.
The findstring based approach to dealing with stable protocols has no landed, so closing this.
Great, thanks!