[PATCH weston] protocol: hook up xmllint to check validity

Peter Hutterer peter.hutterer at who-t.net
Wed Oct 23 06:57:02 CEST 2013


---
 configure.ac         | 11 +++++++++++
 protocol/Makefile.am | 17 ++++++++++++++++-
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index cfd4540..2d56444 100644
--- a/configure.ac
+++ b/configure.ac
@@ -474,6 +474,17 @@ if test x$wayland_scanner = x; then
 	AC_MSG_ERROR([wayland-scanner is needed to compile weston])
 fi
 
+PKG_CHECK_MODULES(WAYLAND_SCANNER, wayland-scanner)
+AC_PATH_PROG(XMLLINT, xmllint)
+AC_ARG_WITH([dtddir],
+	    AS_HELP_STRING([--with-dtddir],
+			   [Directory containing the Wayland
+			    protocol DTD @<:@default=from pkgconfig@:>@]),
+	    [dtddir="$withval"],
+	    [dtddir=$($PKG_CONFIG --variable=pkgdatadir wayland-scanner)])
+AC_SUBST([dtddir])
+AM_CONDITIONAL([HAVE_XMLLINT], [test "x$XMLLINT" != "x" -a "x$dtddir" != "x"])
+
 AC_CONFIG_FILES([Makefile
 		 shared/Makefile
 		 src/Makefile
diff --git a/protocol/Makefile.am b/protocol/Makefile.am
index 924e48f..d09d8eb 100644
--- a/protocol/Makefile.am
+++ b/protocol/Makefile.am
@@ -1,4 +1,4 @@
-EXTRA_DIST =					\
+protocol_sources =				\
 	desktop-shell.xml			\
 	screenshooter.xml			\
 	tablet-shell.xml			\
@@ -9,3 +9,18 @@ EXTRA_DIST =					\
 	subsurface.xml				\
 	text-cursor-position.xml		\
 	wayland-test.xml
+
+if HAVE_XMLLINT
+.PHONY: validate
+
+.%.xml.valid: %.xml
+	$(AM_V_GEN)$(XMLLINT) --noout --dtdvalid $(dtddir)/wayland.dtd $^ > $@
+
+validate: $(protocol_sources:%.xml=.%.xml.valid)
+
+all-local: validate
+
+CLEANFILES= $(protocol_sources:%.xml=.%.xml.valid)
+EXTRA_DIST=$(protocol_sources)
+
+endif
-- 
1.8.3.1



More information about the wayland-devel mailing list