summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2014-10-30 14:45:44 +0000
committerRichard Hughes <richard@hughsie.com>2014-10-30 14:48:13 +0000
commit2a2436de04cc3cd1ae6144785ed089449d2f5f29 (patch)
tree382089ee4e8e43a677d9076d6553445bb4b7ae39 /data
parent7a5f76a6ceb685c4468ed0afeea76cd3c937ec1f (diff)
downloadappstream-glib-2a2436de04cc3cd1ae6144785ed089449d2f5f29.tar.gz
Obsolete the appdata-tools package
Diffstat (limited to 'data')
-rw-r--r--data/Makefile.am4
-rw-r--r--data/appdata-xml.m489
2 files changed, 93 insertions, 0 deletions
diff --git a/data/Makefile.am b/data/Makefile.am
index 61ab44a..933a584 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -6,6 +6,10 @@ m4datadir = $(datadir)/aclocal
dist_m4data_DATA = \
appstream-xml.m4
+# ship this obsolete aclocal helper
+dist_m4data_DATA += \
+ appdata-xml.m4
+
man_MANS =
if ENABLE_MAN
man_MANS += \
diff --git a/data/appdata-xml.m4 b/data/appdata-xml.m4
new file mode 100644
index 0000000..180f058
--- /dev/null
+++ b/data/appdata-xml.m4
@@ -0,0 +1,89 @@
+# appdata-xml.m4
+#
+# serial 4
+
+dnl APPDATA_XML
+dnl Installs and validates AppData XML files.
+dnl
+dnl Call APPDATA_XML in configure.ac to check for the appdata-validate tool.
+dnl Add @APPDATA_XML_RULES@ to a Makefile.am to substitute the make rules. Add
+dnl .appdata.xml files to appdata_XML in Makefile.am and they will be validated
+dnl at make check time, if appdata-validate is installed, as well as installed
+dnl to the correct location automatically. Add --enable-appdata-validate to
+dnl DISTCHECK_CONFIGURE_FLAGS in Makefile.am to require valid AppData XML when
+dnl doing a distcheck.
+dnl
+dnl Adding files to appdata_XML does not distribute them automatically.
+
+AC_DEFUN([APPDATA_XML],
+[
+ m4_pattern_allow([AM_V_GEN])
+ AC_ARG_ENABLE([appdata-validate],
+ [AS_HELP_STRING([--disable-appdata-validate],
+ [Disable validating AppData XML files during check phase])])
+
+ # big fat warning
+ AC_MSG_WARN([APPDATA_XML is deprecated, use APPSTREAM_XML instead.])
+
+ AS_IF([test "x$enable_appdata_validate" != "xno"],
+ [AC_PATH_PROG([APPSTREAM_UTIL], [appstream-util])
+ AS_IF([test "x$APPSTREAM_UTIL" = "x"],
+ [have_appdata_validate=no],
+ [have_appdata_validate=yes
+ AC_SUBST([APPSTREAM_UTIL])])],
+ [have_appdata_validate=no])
+
+ AS_IF([test "x$have_appdata_validate" != "xno"],
+ [appdata_validate=yes],
+ [appdata_validate=no
+ AS_IF([test "x$enable_appdata_validate" = "xyes"],
+ [AC_MSG_ERROR([AppData validation was requested but appstream-util was not found])])])
+
+ AC_SUBST([appdataxmldir], [${datadir}/appdata])
+
+ APPDATA_XML_RULES='
+.PHONY : uninstall-appdata-xml install-appdata-xml clean-appdata-xml
+
+mostlyclean-am: clean-appdata-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: $(appdata_XML:.appdata.xml=.appdata.valid)
+uninstall-am: uninstall-appdata-xml
+install-data-am: install-appdata-xml
+
+.SECONDARY: $(appdata_XML)
+
+install-appdata-xml: $(appdata_XML)
+ @$(NORMAL_INSTALL)
+ if test -n "$^"; then \
+ test -z "$(appdataxmldir)" || $(MKDIR_P) "$(DESTDIR)$(appdataxmldir)"; \
+ $(INSTALL_DATA) $^ "$(DESTDIR)$(appdataxmldir)"; \
+ fi
+
+uninstall-appdata-xml:
+ @$(NORMAL_UNINSTALL)
+ @list='\''$(appdata_XML)'\''; test -n "$(appdataxmldir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e '\''s|^.*/||'\''`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '\''$(DESTDIR)$(appdataxmldir)'\'' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(appdataxmldir)" && rm -f $$files
+
+clean-appdata-xml:
+ rm -f $(appdata_XML:.appdata.xml=.appdata.valid)
+'
+ _APPDATA_XML_SUBST(APPDATA_XML_RULES)
+])
+
+dnl _APPDATA_XML_SUBST(VARIABLE)
+dnl Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST
+AC_DEFUN([_APPDATA_XML_SUBST],
+[
+AC_SUBST([$1])
+m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])])
+]
+)