[aravis] viewer: migrate to appstream



commit 90b8d6a8925201e7f94612050d4869efb6c023b2
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Sat Nov 15 22:33:52 2014 +0100

    viewer: migrate to appstream
    
    Include appstream-xml.m4 in m4 subdirectory.

 Makefile.am             |    2 +-
 configure.ac            |    8 +----
 m4/appstream-xml.m4     |   86 +++++++++++++++++++++++++++++++++++++++++++++++
 viewer/data/Makefile.am |   10 +++---
 4 files changed, 93 insertions(+), 13 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 7a97685..c1a41c7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,7 +4,7 @@ include $(top_srcdir)/Makefile.decl
 
 ACLOCAL_AMFLAGS = -I m4
 
-DISTCHECK_CONFIGURE_FLAGS = --enable-introspection --enable-gtk-doc --enable-gst-plugin 
--enable-gst-0.10-plugin --enable-viewer --enable-cpp-test
+DISTCHECK_CONFIGURE_FLAGS = --enable-introspection --enable-gtk-doc --enable-gst-plugin 
--enable-gst-0.10-plugin --enable-viewer --enable-cpp-test --enable-appstream-util
 
 SUBDIRS = src
 
diff --git a/configure.ac b/configure.ac
index 14c7caa..4f76ea5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -173,13 +173,7 @@ GOBJECT_INTROSPECTION_CHECK([0.10.0])
 GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
 AM_CONDITIONAL([BUILD_GTK_DOC], [test "x$enable_gtk_doc" = "xyes" || test ! -f "autogen.sh"])
 
-ifdef(`APPDATA_XML','',
-[
-AC_DEFUN([APPDATA_XML],
-[
-  AC_SUBST(APPDATA_XML_RULES)
-])])
-APPDATA_XML
+APPSTREAM_XML
 
 AC_CONFIG_FILES([
 Makefile
diff --git a/m4/appstream-xml.m4 b/m4/appstream-xml.m4
new file mode 100644
index 0000000..1472802
--- /dev/null
+++ b/m4/appstream-xml.m4
@@ -0,0 +1,86 @@
+# appstream-xml.m4
+#
+# serial 6
+
+dnl APPSTREAM_XML
+dnl Installs and validates AppData XML files.
+dnl
+dnl Call APPSTREAM_XML in configure.ac to check for the appstream-util tool.
+dnl Add @APPSTREAM_XML_RULES@ to a Makefile.am to substitute the make rules. Add
+dnl .appdata.xml files to appstream_XML in Makefile.am and they will be validated
+dnl at make check time, if appstream-util is installed, as well as installed
+dnl to the correct location automatically. Add --enable-appstream-util to
+dnl DISTCHECK_CONFIGURE_FLAGS in Makefile.am to require valid AppData XML when
+dnl doing a distcheck.
+dnl
+dnl Adding files to appstream_XML does not distribute them automatically.
+
+AC_DEFUN([APPSTREAM_XML],
+[
+  m4_pattern_allow([AM_V_GEN])
+  AC_ARG_ENABLE([appstream-util],
+                [AS_HELP_STRING([--disable-appstream-util],
+                                [Disable validating AppData XML files during check phase])])
+
+  AS_IF([test "x$enable_appstream_validate" != "xno"],
+        [AC_PATH_PROG([APPSTREAM_UTIL], [appstream-util])
+         AS_IF([test "x$APPSTREAM_UTIL" = "x"],
+               [have_appstream_validate=no],
+               [have_appstream_validate=yes
+                AC_SUBST([APPSTREAM_UTIL])])],
+        [have_appstream_validate=no])
+
+  AS_IF([test "x$have_appstream_validate" != "xno"],
+        [appstream_validate=yes],
+        [appstream_validate=no
+         AS_IF([test "x$enable_appstream_validate" = "xyes"],
+               [AC_MSG_ERROR([AppData validation was requested but appstream-util was not found])])])
+
+  AC_SUBST([appstreamxmldir], [${datadir}/appdata])
+
+  APPSTREAM_XML_RULES='
+.PHONY : uninstall-appstream-xml install-appstream-xml clean-appstream-xml
+
+mostlyclean-am: clean-appstream-xml
+
+%.appdata.valid: %.appdata.xml
+       $(AM_V_GEN) if test -f "$<"; then d=; else d="$(srcdir)/"; fi; \
+               if test -n "$(APPSTREAM_UTIL)"; \
+                       then $(APPSTREAM_UTIL) --nonet validate $${d}$<; fi \
+               && touch [$]@
+
+check-am: $(appstream_XML:.appdata.xml=.appdata.valid)
+uninstall-am: uninstall-appstream-xml
+install-data-am: install-appstream-xml
+
+.SECONDARY: $(appstream_XML)
+
+install-appstream-xml: $(appstream_XML)
+       @$(NORMAL_INSTALL)
+       if test -n "$^"; then \
+               test -z "$(appstreamxmldir)" || $(MKDIR_P) "$(DESTDIR)$(appstreamxmldir)"; \
+               $(INSTALL_DATA) $^ "$(DESTDIR)$(appstreamxmldir)"; \
+       fi
+
+uninstall-appstream-xml:
+       @$(NORMAL_UNINSTALL)
+       @list='\''$(appstream_XML)'\''; test -n "$(appstreamxmldir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e '\''s|^.*/||'\''`; \
+       test -n "$$files" || exit 0; \
+       echo " ( cd '\''$(DESTDIR)$(appstreamxmldir)'\'' && rm -f" $$files ")"; \
+       cd "$(DESTDIR)$(appstreamxmldir)" && rm -f $$files
+
+clean-appstream-xml:
+       rm -f $(appstream_XML:.appdata.xml=.appdata.valid)
+'
+  _APPSTREAM_XML_SUBST(APPSTREAM_XML_RULES)
+])
+
+dnl _APPSTREAM_XML_SUBST(VARIABLE)
+dnl Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST
+AC_DEFUN([_APPSTREAM_XML_SUBST],
+[
+AC_SUBST([$1])
+m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])])
+]
+)
diff --git a/viewer/data/Makefile.am b/viewer/data/Makefile.am
index 38ea08e..a135442 100644
--- a/viewer/data/Makefile.am
+++ b/viewer/data/Makefile.am
@@ -1,12 +1,12 @@
 include $(top_srcdir)/Makefile.decl
 
- APPDATA_XML_RULES@
+ APPSTREAM_XML_RULES@
 @INTLTOOL_XML_RULE@
 
-appdata_in_files = arv-viewer.appdata.xml.in
-appdata_XML = $(appdata_in_files:.xml.in=.xml)
+appstream_in_files = arv-viewer.appdata.xml.in
+appstream_XML = $(appstream_in_files:.xml.in=.xml)
 
-EXTRA_DIST = $(appdata_in_files)
+EXTRA_DIST = $(appstream_in_files)
 
 @INTLTOOL_DESKTOP_RULE@
 desktopdir = $(datadir)/applications
@@ -17,5 +17,5 @@ dist_noinst_DATA = \
        $(desktop_in_files)
 
 CLEANFILES =                                   \
-       $(appdata_XML)                          \
+       $(appstream_XML)                                \
        $(desktop_DATA)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]