build: Add rules to auto-generate wayland headers from protocol xml

We've been checking in protocol headers and implementations that
wayland-scanner generates.  We should just generate them from the upstream
xml files.
This commit is contained in:
Derek Foreman 2017-01-17 15:37:50 -06:00
parent 76066f2d9f
commit 553751cb40
2 changed files with 49 additions and 1 deletions

View File

@ -1975,7 +1975,19 @@ AC_ARG_ENABLE([wayland],
[want_wayland="no"])
if test "${want_wayland}" = "yes"; then
EFL_PKG_CHECK_STRICT([wayland-client >= 1.11.0])
EFL_PKG_CHECK_STRICT([wayland-client >= 1.11.0 wayland-scanner >= 1.11.0])
PKG_CHECK_MODULES([WAYLAND], [wayland-scanner >= 1.11.0],
[
AC_ARG_VAR([wayland_scanner], [The wayland-scanner executable])
AC_PATH_PROG([wayland_scanner], [wayland-scanner])
if test x$wayland_scanner = x; then
PKG_CHECK_MODULES(WAYLAND_SCANNER, [wayland-scanner])
wayland_scanner=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`
fi
AM_CONDITIONAL([HAVE_WAYLAND_SCANNER], [test x$wayland_scanner != x])
ac_wayland_protocols_pkgdatadir=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`
AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, $ac_wayland_protocols_pkgdatadir)
])
fi
# Wayland IVI-Shell

View File

@ -192,3 +192,39 @@ install-exec-hook:
mv $$FNAMEEXT $$FNAME; \
done
$(EFL_INSTALL_EXEC_HOOK)
#At the bottom because .SECONDEXPANSION is applied to all following rules.
if HAVE_WAYLAND_SCANNER
#Stolen from weston's Makefile.am and modified for Enlightenment
.SECONDEXPANSION:
define protostability
$(if $(findstring unstable,$1),unstable,stable)
endef
define protoname
$(shell echo $1 | sed 's/\([a-z\-]\+\)-[a-z]\+-v[0-9]\+/\1/')
endef
#rules for generating protocol from wayland_protocols
%-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/$$(call protostability,$$*)/$$(call protoname,$$*)/$$*.xml
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) code < $< > $@
%-server-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/$$(call protostability,$$*)/$$(call protoname,$$*)/$$*.xml
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) server-header < $< > $@
%-client-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/$$(call protostability,$$*)/$$(call protoname,$$*)/$$*.xml
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) client-header < $< > $@
#rules for generating local protocols which must be in src/wayland_protocol
%-protocol.c : $(top_srcdir)/src/wayland_protocol/$(notdir $$*).xml
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) code < $< > $@
%-server-protocol.h : $(top_srcdir)/src/wayland_protocol/$(notdir $$*).xml
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) server-header < $< > $@
%-client-protocol.h : $(top_srcdir)/src/wayland_protocol/$(notdir $$*).xml
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) client-header < $< > $@
#End of weston stuff
endif