After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 792203 - Makefile.am unable to build stable wayland protocols
Makefile.am unable to build stable wayland protocols
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: wayland
git master
Other Linux
: Normal minor
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks: 791405
 
 
Reported: 2018-01-04 13:34 UTC by RobertMader
Modified: 2018-02-23 11:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Allow stable wayland protocls to build as long as they have an arbitary version number (939 bytes, patch)
2018-01-04 13:34 UTC, RobertMader
none Details | Review
Make src/Makefile.am build stable wayland protols and make extra cases unnessecary (1.56 KB, patch)
2018-01-04 14:57 UTC, RobertMader
none Details | Review
Make src/Makefile.am build stable wayland protols and make extra cases unnessecary (3.08 KB, patch)
2018-01-06 14:00 UTC, RobertMader
none Details | Review
src/Makefile.am: Fix building of stable wayland protcols (2.21 KB, patch)
2018-01-13 14:24 UTC, RobertMader
none Details | Review
src/Makefile.am: remove redundant wayland-protocol generation rules (1.81 KB, patch)
2018-01-13 14:25 UTC, RobertMader
none Details | Review
src/Makefile.am: Fix building of stable wayland protcols (1.89 KB, patch)
2018-01-13 15:01 UTC, RobertMader
none Details | Review
src/Makefile.am: remove redundant wayland-protocol generation rules (1.81 KB, patch)
2018-01-13 15:01 UTC, RobertMader
committed Details | Review

Description RobertMader 2018-01-04 13:34:44 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.
Comment 1 RobertMader 2018-01-04 14:57:11 UTC
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
Comment 2 RobertMader 2018-01-06 14:00:24 UTC
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
Comment 3 Carlos Garnacho 2018-01-11 16:42:11 UTC
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.
Comment 4 RobertMader 2018-01-13 14:24:57 UTC
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.
Comment 5 RobertMader 2018-01-13 14:25:53 UTC
Created attachment 366764 [details] [review]
src/Makefile.am: remove redundant wayland-protocol generation rules

Removes previously needed generation rules
Comment 6 RobertMader 2018-01-13 15:01:13 UTC
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.
Comment 7 RobertMader 2018-01-13 15:01:59 UTC
Created attachment 366766 [details] [review]
src/Makefile.am: remove redundant wayland-protocol generation rules

Removes previously needed generation rules for wayland protocols
Comment 8 Jonas Ådahl 2018-02-22 10:11:22 UTC
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 9 Jonas Ådahl 2018-02-23 10:55:43 UTC
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.
Comment 10 Jonas Ådahl 2018-02-23 11:22:50 UTC
The findstring based approach to dealing with stable protocols has no landed, so closing this.
Comment 11 RobertMader 2018-02-23 11:26:20 UTC
Great, thanks!